@@ -57,9 +57,11 @@ discard block |
||
| 57 | 57 | $_oDateIntervalEpsilon = new \DateInterval($oJobEntity->epsilon); |
| 58 | 58 | $_iIntervalEpsilon = (int) $_oDateIntervalEpsilon->format('%Y%M%D%H%I%S'); |
| 59 | 59 | |
| 60 | - if ($_iIntervalEpsilon > 30) // if epsilon > "PT30S" |
|
| 60 | + if ($_iIntervalEpsilon > 30) { |
|
| 61 | + // if epsilon > "PT30S" |
|
| 61 | 62 | { |
| 62 | 63 | $_oIso8601Entity = $this->oDatePeriodFactory->createIso8601Entity($oJobEntity->schedule); |
| 64 | + } |
|
| 63 | 65 | |
| 64 | 66 | $_oDateIntervalScheduling = new \DateInterval($_oIso8601Entity->sInterval); |
| 65 | 67 | $_iIntervalScheduling = (int) $_oDateIntervalScheduling->format('%Y%M%D%H%I%S'); |
@@ -69,8 +71,7 @@ discard block |
||
| 69 | 71 | |
| 70 | 72 | // if epsilon is less or equal than 30sec the not empty check is enough |
| 71 | 73 | return true; |
| 72 | - } |
|
| 73 | - catch (\Exception $_oException) |
|
| 74 | + } catch (\Exception $_oException) |
|
| 74 | 75 | { |
| 75 | 76 | // can't init \DateInterval instance |
| 76 | 77 | return false; |
@@ -62,8 +62,7 @@ |
||
| 62 | 62 | { |
| 63 | 63 | $_oDataPeriod = $this->oDatePeriodFactory->createDatePeriod($oJobEntity->schedule, $oJobEntity->scheduleTimeZone); |
| 64 | 64 | return (false !== $_oDataPeriod); |
| 65 | - } |
|
| 66 | - catch (\Exception $oException) |
|
| 65 | + } catch (\Exception $oException) |
|
| 67 | 66 | { |
| 68 | 67 | // invalid: Iso8601 is not valid and/or DatePeriodFactory is able to create a valid DatePeriod |
| 69 | 68 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | public static function setAllPossibleProperties($oData, $oTarget) |
| 29 | 29 | { |
| 30 | - foreach($oData as $attrName => $attrValue) |
|
| 30 | + foreach ($oData as $attrName => $attrValue) |
|
| 31 | 31 | { |
| 32 | 32 | // dont set array or objects. |
| 33 | 33 | // Because this would need further type information to properly set. |
@@ -99,10 +99,12 @@ |
||
| 99 | 99 | { |
| 100 | 100 | if ($this->oRepositoryBridge->addJob($oJobEntity)) |
| 101 | 101 | { |
| 102 | - if (!is_null($this->oJobCollection)) // if no collection inited the new job will init by chronos request |
|
| 102 | + if (!is_null($this->oJobCollection)) { |
|
| 103 | + // if no collection inited the new job will init by chronos request |
|
| 103 | 104 | { |
| 104 | 105 | $this->oJobCollection->offsetSet($oJobEntity->getKey(), $oJobEntity); |
| 105 | 106 | } |
| 107 | + } |
|
| 106 | 108 | |
| 107 | 109 | return true; |
| 108 | 110 | } |
@@ -116,12 +116,14 @@ |
||
| 116 | 116 | if ( |
| 117 | 117 | !file_exists($this->getHomeDir() . DIRECTORY_SEPARATOR . 'parameters.yml') |
| 118 | 118 | && !file_exists($this->getWorkingDir() . DIRECTORY_SEPARATOR . '.chapiconfig') |
| 119 | - ) // one file have to exist |
|
| 119 | + ) { |
|
| 120 | + // one file have to exist |
|
| 120 | 121 | { |
| 121 | 122 | $this->oOutput->writeln(sprintf( |
| 122 | 123 | '<error>%s</error>', |
| 123 | 124 | 'No parameter file found. Please run "configure" command for initial setup or add a local `.chapiconfig` to your working directory.' |
| 124 | 125 | )); |
| 126 | + } |
|
| 125 | 127 | return false; |
| 126 | 128 | } |
| 127 | 129 | |
@@ -35,14 +35,14 @@ |
||
| 35 | 35 | |
| 36 | 36 | if (isset($aData['docker'])) |
| 37 | 37 | { |
| 38 | - $this->docker = new Docker((array)$aData['docker']); |
|
| 38 | + $this->docker = new Docker((array) $aData['docker']); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | if (isset($aData['volumes'])) |
| 42 | 42 | { |
| 43 | 43 | foreach ($aData['volumes'] as $volume) |
| 44 | 44 | { |
| 45 | - $this->volumes[] = new ContainerVolume((array)$volume); |
|
| 45 | + $this->volumes[] = new ContainerVolume((array) $volume); |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
@@ -39,17 +39,17 @@ |
||
| 39 | 39 | |
| 40 | 40 | if (isset($aData['portMappings'])) |
| 41 | 41 | { |
| 42 | - foreach($aData['portMappings'] as $portMapping) |
|
| 42 | + foreach ($aData['portMappings'] as $portMapping) |
|
| 43 | 43 | { |
| 44 | - $this->portMappings[] = new DockerPortMapping((array)$portMapping); |
|
| 44 | + $this->portMappings[] = new DockerPortMapping((array) $portMapping); |
|
| 45 | 45 | } |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | if (isset($aData['parameters'])) |
| 49 | 49 | { |
| 50 | - foreach($aData['parameters'] as $parameter) |
|
| 50 | + foreach ($aData['parameters'] as $parameter) |
|
| 51 | 51 | { |
| 52 | - $this->parameters[] = new DockerParameters((array)$parameter); |
|
| 52 | + $this->parameters[] = new DockerParameters((array) $parameter); |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
@@ -41,9 +41,9 @@ |
||
| 41 | 41 | { |
| 42 | 42 | MarathonEntityUtils::setAllPossibleProperties($aData, $this); |
| 43 | 43 | |
| 44 | - if(isset($aData['command'])) |
|
| 44 | + if (isset($aData['command'])) |
|
| 45 | 45 | { |
| 46 | - $this->command = new HealthCheckCommand((array)$aData['command']); |
|
| 46 | + $this->command = new HealthCheckCommand((array) $aData['command']); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -25,13 +25,13 @@ |
||
| 25 | 25 | { |
| 26 | 26 | MarathonEntityUtils::setAllPossibleProperties($aData, $this); |
| 27 | 27 | |
| 28 | - if(isset($aData['groups'])) |
|
| 28 | + if (isset($aData['groups'])) |
|
| 29 | 29 | { |
| 30 | 30 | $this->groups = $aData['groups']; |
| 31 | 31 | } |
| 32 | 32 | if (isset($aData['labels'])) |
| 33 | 33 | { |
| 34 | - $this->labels = (object)$aData['labels']; |
|
| 34 | + $this->labels = (object) $aData['labels']; |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | \ No newline at end of file |