Whitespace and deadcode nitpick

This commit is contained in:
Lucas Bickel 2017-03-10 16:20:44 +01:00
parent 6e50af344a
commit 2a53241ba3
15 changed files with 59 additions and 122 deletions

View file

@ -20,7 +20,7 @@ class Application_Service_ShowFormService
public function createShowForms()
{
$formWhat = new Application_Form_AddShowWhat();
$formAutoPlaylist = new Application_Form_AddShowAutoPlaylist();
$formAutoPlaylist = new Application_Form_AddShowAutoPlaylist();
$formWho = new Application_Form_AddShowWho();
$formWhen = new Application_Form_AddShowWhen();
$formRepeats = new Application_Form_AddShowRepeats();
@ -31,7 +31,7 @@ class Application_Service_ShowFormService
$formRebroadcast = new Application_Form_AddShowRebroadcastDates();
$formWhat->removeDecorator('DtDdWrapper');
$formAutoPlaylist->removeDecorator('DtDdWrapper');
$formAutoPlaylist->removeDecorator('DtDdWrapper');
$formWho->removeDecorator('DtDdWrapper');
$formWhen->removeDecorator('DtDdWrapper');
$formRepeats->removeDecorator('DtDdWrapper');
@ -43,7 +43,7 @@ class Application_Service_ShowFormService
$forms = array();
$forms["what"] = $formWhat;
$forms["autoplaylist"] = $formAutoPlaylist;
$forms["autoplaylist"] = $formAutoPlaylist;
$forms["who"] = $formWho;
$forms["when"] = $formWhen;
$forms["repeats"] = $formRepeats;
@ -61,7 +61,7 @@ class Application_Service_ShowFormService
* Popluates the what, autoplaylist, when, and repeat forms
* with default values
*/
public function populateNewShowForms($formWhat, $formWhen, $formRepeats)
public function populateNewShowForms($formWhat, $formWhen, $formRepeats)
{
$formWhat->populate(
array('add_show_id' => '-1',
@ -96,7 +96,7 @@ class Application_Service_ShowFormService
*/
$forms["what"]->makeReadonly();
$forms["what"]->enableInstanceDesc();
$forms["autoplaylist"]->disable();
$forms["autoplaylist"]->disable();
$forms["repeats"]->disable();
$forms["who"]->disable();
$forms["style"]->disable();
@ -119,7 +119,7 @@ class Application_Service_ShowFormService
{
$this->populateFormWhat($forms["what"]);
//local show start DT
$this->populateFormAutoPlaylist($forms["autoplaylist"]);
$this->populateFormAutoPlaylist($forms["autoplaylist"]);
$showStart = $this->populateFormWhen($forms["when"]);
$this->populateFormRepeats($forms["repeats"], $showStart);
$this->populateFormWho($forms["who"]);
@ -130,12 +130,11 @@ class Application_Service_ShowFormService
$this->populateFormRebroadcastAbsolute($forms["abs_rebroadcast"]);
}
private function populateFormWhat($form)
private function populateFormWhat($form)
{
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
$form->populate(
$form->populate(
array(
'add_show_instance_id' => $this->instanceId,
'add_show_id' => $this->ccShow->getDbId(),
@ -143,18 +142,15 @@ class Application_Service_ShowFormService
'add_show_url' => $this->ccShow->getDbUrl(),
'add_show_genre' => $this->ccShow->getDbGenre(),
'add_show_description' => $this->ccShow->getDbDescription(),
'add_show_instance_description' => $ccShowInstance->getDbDescription(),
'add_show_instance_description' => $ccShowInstance->getDbDescription(),
));
}
private function populateFormAutoPlaylist($form)
{
$ccShowInstance = CcShowInstancesQuery::create()->findPk($this->instanceId);
if (!$this->ccShow->getDbAutoPlaylistId()) {
// $form->disableAutoPlaylist();
}
$form->populate(
$form->populate(
array(
'add_show_has_autoplaylist' => $this->ccShow->getDbHasAutoPlaylist() ? 1 : 0,
'add_show_autoplaylist_id' => $this->ccShow->getDbAutoPlaylistId()
@ -294,7 +290,7 @@ class Application_Service_ShowFormService
//end dates are stored non-inclusively so we need to
//subtract one day
if (!is_null($repeatEndDate)) {
$repeatEndDate->sub(new DateInterval("P1D"));
$repeatEndDate->sub(new DateInterval("P1D"));
}
//default monthly repeat type
@ -348,27 +344,27 @@ class Application_Service_ShowFormService
private function populateFormStyle($form)
{
$src = $this->ccShow->getDbImagePath() ?
$this->imagePathToDataUri($this->ccShow->getDbImagePath()) : '';
$src = $this->ccShow->getDbImagePath() ?
$this->imagePathToDataUri($this->ccShow->getDbImagePath()) : '';
$form->populate(
array(
'add_show_background_color' => $this->ccShow->getDbBackgroundColor(),
'add_show_color' => $this->ccShow->getDbColor(),
'add_show_logo_current' => $src));
'add_show_logo_current' => $src));
}
/**
* Convert a static image from disk to a base64 data URI
*
* @param unknown $path
* - the path to the image on the disk
* - the path to the image on the disk
* @return string
* - the data URI representation of the image
* - the data URI representation of the image
*/
private function imagePathToDataUri($path) {
$imageData = null;
$bytesRead = 0;
$bytesRead = 0;
try {
ob_start();
header("Content-type: image/*");
@ -382,9 +378,9 @@ class Application_Service_ShowFormService
Logging::error("Failed to read image: " . $path);
$imageData = null;
}
// return the data URI - data:{mime};base64,{data}
return ($imageData === null || $imageData === '') ?
'' : 'data: '.mime_content_type($path).';base64,'.$imageData;
// return the data URI - data:{mime};base64,{data}
return ($imageData === null || $imageData === '') ?
'' : 'data: '.mime_content_type($path).';base64,'.$imageData;
}
private function populateFormLive($form)
@ -587,8 +583,8 @@ class Application_Service_ShowFormService
public function calculateDuration($start, $end, $timezone)
{
try {
$tz = new DateTimeZone($timezone);
$tz = new DateTimeZone($timezone);
$startDateTime = new DateTime($start, $tz);
$endDateTime = new DateTime($end, $tz);
@ -606,7 +602,7 @@ class Application_Service_ShowFormService
return $duration->format('%r%Hh %Im');
}
} catch (Exception $e) {
Logging::info($e->getMessage());
Logging::info($e->getMessage());
return "Invalid Date";
}
}