Format code using php-cs-fixer
This commit is contained in:
parent
43d7dc92cd
commit
d52c6184b9
352 changed files with 17473 additions and 17041 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Application_Service_PodcastEpisodeService
|
||||
*/
|
||||
|
@ -18,13 +17,11 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* headAction is needed as it is defined as an abstract function in the base controller
|
||||
*
|
||||
* @return void
|
||||
* headAction is needed as it is defined as an abstract function in the base controller.
|
||||
*/
|
||||
public function headAction()
|
||||
{
|
||||
Logging::info("HEAD action received");
|
||||
Logging::info('HEAD action received');
|
||||
}
|
||||
|
||||
public function indexAction()
|
||||
|
@ -34,10 +31,12 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
if (!$id) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
$totalPodcastEpisodesCount = PodcastEpisodesQuery::create()
|
||||
->filterByDbPodcastId($id)
|
||||
->count();
|
||||
->count()
|
||||
;
|
||||
|
||||
// Check if offset and limit were sent with request.
|
||||
// Default limit to zero and offset to $totalFileCount
|
||||
|
@ -51,8 +50,8 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->setHeader('X-TOTAL-COUNT', $totalPodcastEpisodesCount)
|
||||
->appendBody(json_encode($this->_service->getPodcastEpisodes($id, $offset, $limit, $sortColumn, $sortDir)));
|
||||
|
||||
->appendBody(json_encode($this->_service->getPodcastEpisodes($id, $offset, $limit, $sortColumn, $sortDir)))
|
||||
;
|
||||
} catch (PodcastNotFoundException $e) {
|
||||
$this->podcastNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
|
@ -78,8 +77,8 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
try {
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->appendBody(json_encode($this->_service->getPodcastEpisodeById($episodeId)));
|
||||
|
||||
->appendBody(json_encode($this->_service->getPodcastEpisodeById($episodeId)))
|
||||
;
|
||||
} catch (PodcastNotFoundException $e) {
|
||||
$this->podcastNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
|
@ -99,8 +98,9 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
if ($episodeId = $this->_getParam('episode_id', false)) {
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: Episode ID should not be specified when using POST. POST is only used for "
|
||||
. "importing podcast episodes, and an episode ID will be chosen by Airtime");
|
||||
$resp->appendBody('ERROR: Episode ID should not be specified when using POST. POST is only used for '
|
||||
. 'importing podcast episodes, and an episode ID will be chosen by Airtime');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -112,16 +112,15 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
|
||||
try {
|
||||
$requestData = json_decode($this->getRequest()->getRawBody(), true);
|
||||
$episode = $this->_service->importEpisode($id, $requestData["episode"]);
|
||||
$episode = $this->_service->importEpisode($id, $requestData['episode']);
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(201)
|
||||
->appendBody(json_encode($episode));
|
||||
|
||||
->appendBody(json_encode($episode))
|
||||
;
|
||||
} catch (Exception $e) {
|
||||
$this->unknownErrorResponse();
|
||||
Logging::error($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function deleteAction()
|
||||
|
@ -139,7 +138,8 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
try {
|
||||
$this->_service->deletePodcastEpisodeById($episodeId);
|
||||
$this->getResponse()
|
||||
->setHttpResponseCode(204);
|
||||
->setHttpResponseCode(204)
|
||||
;
|
||||
} catch (PodcastEpisodeNotFoundException $e) {
|
||||
$this->podcastEpisodeNotFoundResponse();
|
||||
Logging::error($e->getMessage());
|
||||
|
@ -151,7 +151,6 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
|
||||
public function putAction()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private function getId()
|
||||
|
@ -159,9 +158,11 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
if (!$id = $this->_getParam('id', false)) {
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: No podcast ID specified.");
|
||||
$resp->appendBody('ERROR: No podcast ID specified.');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
@ -170,9 +171,11 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
if (!$episodeId = $this->_getParam('episode_id', false)) {
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("ERROR: No podcast episode ID specified.");
|
||||
$resp->appendBody('ERROR: No podcast episode ID specified.');
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return $episodeId;
|
||||
}
|
||||
|
||||
|
@ -180,21 +183,20 @@ class Rest_PodcastEpisodesController extends Zend_Rest_Controller
|
|||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(400);
|
||||
$resp->appendBody("An unknown error occurred.");
|
||||
$resp->appendBody('An unknown error occurred.');
|
||||
}
|
||||
|
||||
private function podcastNotFoundResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(404);
|
||||
$resp->appendBody("ERROR: Podcast not found.");
|
||||
$resp->appendBody('ERROR: Podcast not found.');
|
||||
}
|
||||
|
||||
private function podcastEpisodeNotFoundResponse()
|
||||
{
|
||||
$resp = $this->getResponse();
|
||||
$resp->setHttpResponseCode(404);
|
||||
$resp->appendBody("ERROR: Podcast episode not found.");
|
||||
$resp->appendBody('ERROR: Podcast episode not found.');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue