Format code using php-cs-fixer

This commit is contained in:
jo 2021-10-11 16:10:47 +02:00
parent 43d7dc92cd
commit d52c6184b9
352 changed files with 17473 additions and 17041 deletions

View file

@ -1,28 +1,23 @@
<?php
/**
* Skeleton subclass for representing a row from the 'cc_show_instances' table.
*
*
*
* You should add additional methods to this class to meet the
* application requirements. This class will only be generated as
* long as it does not already exist in the output directory.
*
* @package propel.generator.airtime
*/
class CcShowInstances extends BaseCcShowInstances {
/**
class CcShowInstances extends BaseCcShowInstances
{
/**
* Get the [optionally formatted] temporal [starts] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @throws propelException - if unable to parse/validate the date/time value
*
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
*/
public function getDbStarts($format = 'Y-m-d H:i:s')
{
@ -31,29 +26,31 @@ class CcShowInstances extends BaseCcShowInstances {
}
try {
$dt = new DateTime($this->starts, new DateTimeZone("UTC"));
$dt = new DateTime($this->starts, new DateTimeZone('UTC'));
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->starts, true), $x);
throw new PropelException('Internally stored date/time/timestamp value could not be converted to DateTime: ' . var_export($this->starts, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
if (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
}
return $dt->format($format);
}
/**
* Get the [optionally formatted] temporal [ends] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @throws propelException - if unable to parse/validate the date/time value
*
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
*/
public function getDbEnds($format = 'Y-m-d H:i:s')
{
@ -62,29 +59,31 @@ class CcShowInstances extends BaseCcShowInstances {
}
try {
$dt = new DateTime($this->ends, new DateTimeZone("UTC"));
$dt = new DateTime($this->ends, new DateTimeZone('UTC'));
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->ends, true), $x);
throw new PropelException('Internally stored date/time/timestamp value could not be converted to DateTime: ' . var_export($this->ends, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
if (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
}
return $dt->format($format);
}
/**
* Get the [optionally formatted] temporal [last_scheduled] column value.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
*
* @param string $format The date/time format string (either date()-style or strftime()-style).
* If format is NULL, then the raw DateTime object will be returned.
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
* @throws PropelException - if unable to parse/validate the date/time value.
* @throws propelException - if unable to parse/validate the date/time value
*
* @return mixed Formatted date/time value as string or DateTime object (if format is NULL), NULL if column is NULL
*/
public function getDbLastScheduled($format = 'Y-m-d H:i:s')
{
@ -93,24 +92,25 @@ class CcShowInstances extends BaseCcShowInstances {
}
try {
$dt = new DateTime($this->last_scheduled, new DateTimeZone("UTC"));
$dt = new DateTime($this->last_scheduled, new DateTimeZone('UTC'));
} catch (Exception $x) {
throw new PropelException("Internally stored date/time/timestamp value could not be converted to DateTime: " . var_export($this->last_scheduled, true), $x);
throw new PropelException('Internally stored date/time/timestamp value could not be converted to DateTime: ' . var_export($this->last_scheduled, true), $x);
}
if ($format === null) {
// Because propel.useDateTimeClass is TRUE, we return a DateTime object.
return $dt;
} elseif (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
} else {
return $dt->format($format);
}
if (strpos($format, '%') !== false) {
return strftime($format, $dt->format('U'));
}
return $dt->format($format);
}
//post save hook to update the cc_schedule status column for the tracks in the show.
public function updateScheduleStatus(PropelPDO $con) {
public function updateScheduleStatus(PropelPDO $con)
{
$this->updateDbTimeFilled($con);
//scheduled track is in the show
@ -118,7 +118,8 @@ class CcShowInstances extends BaseCcShowInstances {
->filterByDbInstanceId($this->id)
->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL)
->filterByDbEnds($this->ends, Criteria::LESS_EQUAL)
->update(array('DbPlayoutStatus' => 1), $con);
->update(['DbPlayoutStatus' => 1], $con)
;
//scheduled track is a boundary track
CcScheduleQuery::create()
@ -126,24 +127,25 @@ class CcShowInstances extends BaseCcShowInstances {
->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL)
->filterByDbStarts($this->ends, Criteria::LESS_THAN)
->filterByDbEnds($this->ends, Criteria::GREATER_THAN)
->update(array('DbPlayoutStatus' => 2), $con);
->update(['DbPlayoutStatus' => 2], $con)
;
//scheduled track is overbooked.
CcScheduleQuery::create()
->filterByDbInstanceId($this->id)
->filterByDbPlayoutStatus(0, Criteria::GREATER_EQUAL)
->filterByDbStarts($this->ends, Criteria::GREATER_THAN)
->update(array('DbPlayoutStatus' => 0), $con);
$this->setDbLastScheduled(gmdate("Y-m-d H:i:s"));
->update(['DbPlayoutStatus' => 0], $con)
;
$this->setDbLastScheduled(gmdate('Y-m-d H:i:s'));
$this->save($con);
}
/**
*
* This function resets the cc_schedule table's position numbers so that
* tracks for each cc_show_instances start at position 1
*
* tracks for each cc_show_instances start at position 1.
*
* The position numbers can become out of sync when the user deletes items
* from linekd shows filled with dyanmic smart blocks, where each instance
* has a different amount of scheduled items
@ -153,17 +155,18 @@ class CcShowInstances extends BaseCcShowInstances {
$schedule = CcScheduleQuery::create()
->filterByDbInstanceId($this->id)
->orderByDbStarts()
->find();
->find()
;
$pos = 0;
foreach ($schedule as $item) {
$item->setDbPosition($pos)->save();
$pos++;
++$pos;
}
}
/**
* Computes the value of the aggregate column time_filled
* Computes the value of the aggregate column time_filled.
*
* @param PropelPDO $con A connection object
*
@ -174,27 +177,30 @@ class CcShowInstances extends BaseCcShowInstances {
$stmt = $con->prepare('SELECT SUM(clip_length) FROM "cc_schedule" WHERE cc_schedule.INSTANCE_ID = :p1');
$stmt->bindValue(':p1', $this->getDbId());
$stmt->execute();
return $stmt->fetchColumn();
}
/**
* Updates the aggregate column time_filled
* Updates the aggregate column time_filled.
*
* @param PropelPDO $con A connection object
*/
public function updateDbTimeFilled(PropelPDO $con)
{
$timefilled = $this->computeDbTimeFilled($con);
if(is_null($timefilled)){
$timefilled = "00:00:00";
if (is_null($timefilled)) {
$timefilled = '00:00:00';
}
$this->setDbTimeFilled($timefilled);
$this->save($con);
}
public function preInsert(PropelPDO $con = null) {
$now = new DateTime("now", new DateTimeZone("UTC"));
public function preInsert(PropelPDO $con = null)
{
$now = new DateTime('now', new DateTimeZone('UTC'));
$this->setDbCreated($now);
return true;
}
@ -211,7 +217,7 @@ class CcShowInstances extends BaseCcShowInstances {
public function getLocalStartDateTime()
{
$startDT = $this->getDbStarts(null);
return $startDT->setTimezone(new DateTimeZone(Application_Model_Preference::GetTimezone()));
}
} // CcShowInstances