| @@ -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 | } | 
| @@ -37,7 +37,7 @@ | ||
| 37 | 37 | $this->oDiffCompare = $oDiffCompare; | 
| 38 | 38 | } | 
| 39 | 39 | |
| 40 | - protected function preCompareModifications(JobEntityInterface &$oLocalJob, JobEntityInterface &$oRemoteJob) | |
| 40 | + protected function preCompareModifications(JobEntityInterface & $oLocalJob, JobEntityInterface & $oRemoteJob) | |
| 41 | 41 |      { | 
| 42 | 42 | if ( | 
| 43 | 43 | !$oLocalJob instanceof MarathonAppEntity || | 
| @@ -54,7 +54,7 @@ | ||
| 54 | 54 | } | 
| 55 | 55 | |
| 56 | 56 | |
| 57 | - protected function preCompareModifications(JobEntityInterface &$oLocalJob, JobEntityInterface &$oRemoteJob) | |
| 57 | + protected function preCompareModifications(JobEntityInterface & $oLocalJob, JobEntityInterface & $oRemoteJob) | |
| 58 | 58 |      { | 
| 59 | 59 | // no modification needed | 
| 60 | 60 | return; | 
| @@ -59,48 +59,42 @@ | ||
| 59 | 59 |          { | 
| 60 | 60 |              $_oResponse = $this->oGuzzelClient->request('GET', $sUrl, $_aRequestOptions); | 
| 61 | 61 | return new HttpGuzzlResponse($_oResponse); | 
| 62 | - } | |
| 63 | - catch (ClientException $oException) // 400 level errors | |
| 62 | + } catch (ClientException $oException) // 400 level errors | |
| 64 | 63 |          { | 
| 65 | 64 | throw new HttpConnectionException( | 
| 66 | 65 |                  sprintf('Client error: Calling %s returned %d', $this->oGuzzelClient->getConfig('base_uri') . $sUrl, $oException->getCode()), | 
| 67 | 66 | $oException->getCode(), | 
| 68 | 67 | $oException | 
| 69 | 68 | ); | 
| 70 | - } | |
| 71 | - catch (ServerException $oException) // 500 level errors | |
| 69 | + } catch (ServerException $oException) // 500 level errors | |
| 72 | 70 |          { | 
| 73 | 71 | throw new HttpConnectionException( | 
| 74 | 72 |                  sprintf('Server error: Calling %s returned %d', $this->oGuzzelClient->getConfig('base_uri') . $sUrl, $oException->getCode()), | 
| 75 | 73 | $oException->getCode(), | 
| 76 | 74 | $oException | 
| 77 | 75 | ); | 
| 78 | - } | |
| 79 | - catch (TooManyRedirectsException $oException) // too many redirects to follow | |
| 76 | + } catch (TooManyRedirectsException $oException) // too many redirects to follow | |
| 80 | 77 |          { | 
| 81 | 78 | throw new HttpConnectionException( | 
| 82 | 79 |                  sprintf('Request to %s failed due to too many redirects', $this->oGuzzelClient->getConfig('base_uri') . $sUrl), | 
| 83 | 80 | HttpConnectionException::ERROR_CODE_TOO_MANY_REDIRECT_EXCEPTION, | 
| 84 | 81 | $oException | 
| 85 | 82 | ); | 
| 86 | - } | |
| 87 | - catch (ConnectException $oException) // networking error | |
| 83 | + } catch (ConnectException $oException) // networking error | |
| 88 | 84 |          { | 
| 89 | 85 | throw new HttpConnectionException( | 
| 90 | 86 |                  sprintf('Cannot connect to %s due to some networking error', $this->oGuzzelClient->getConfig('base_uri') . $sUrl), | 
| 91 | 87 | HttpConnectionException::ERROR_CODE_CONNECT_EXCEPTION, | 
| 92 | 88 | $oException | 
| 93 | 89 | ); | 
| 94 | - } | |
| 95 | - catch (RequestException $oException) // networking error (connection timeout, DNS errors, etc.) | |
| 90 | + } catch (RequestException $oException) // networking error (connection timeout, DNS errors, etc.) | |
| 96 | 91 |          { | 
| 97 | 92 | throw new HttpConnectionException( | 
| 98 | 93 |                  sprintf('Cannot connect to %s due to networking error', $this->oGuzzelClient->getConfig('base_uri') . $sUrl), | 
| 99 | 94 | HttpConnectionException::ERROR_CODE_REQUEST_EXCEPTION, | 
| 100 | 95 | $oException | 
| 101 | 96 | ); | 
| 102 | - } | |
| 103 | - catch (\Exception $oException) | |
| 97 | + } catch (\Exception $oException) | |
| 104 | 98 |          { | 
| 105 | 99 | throw new HttpConnectionException( | 
| 106 | 100 |                  sprintf('Can\'t get response from "%s"', $this->oGuzzelClient->getConfig('base_uri') . $sUrl), | 
| @@ -38,8 +38,7 @@ | ||
| 38 | 38 | try | 
| 39 | 39 |          { | 
| 40 | 40 | return self::$aIso8601Entity[$_sKey] = new Iso8601Entity($sIso8601); | 
| 41 | - } | |
| 42 | - catch (\InvalidArgumentException $_oException) | |
| 41 | + } catch (\InvalidArgumentException $_oException) | |
| 43 | 42 |          { | 
| 44 | 43 |              throw new DatePeriodException(sprintf("Can't init Iso8601Entity for '%s' iso 8601 string.", $sIso8601), 1, $_oException); | 
| 45 | 44 | } | 
| @@ -219,7 +219,7 @@ | ||
| 219 | 219 | * @param JobEntityInterface $oRemoteJob | 
| 220 | 220 | * @return null | 
| 221 | 221 | */ | 
| 222 | - abstract protected function preCompareModifications(JobEntityInterface &$oLocalJob, JobEntityInterface &$oRemoteJob); | |
| 222 | + abstract protected function preCompareModifications(JobEntityInterface & $oLocalJob, JobEntityInterface & $oRemoteJob); | |
| 223 | 223 | |
| 224 | 224 | /** | 
| 225 | 225 | * Gets entity for each system with defaults set | 
| @@ -95,8 +95,7 @@ | ||
| 95 | 95 | )); | 
| 96 | 96 | return false; | 
| 97 | 97 | } | 
| 98 | - } | |
| 99 | - catch (\Exception $e) | |
| 98 | + } catch (\Exception $e) | |
| 100 | 99 |                  { | 
| 101 | 100 | $this->oLogger->error(sprintf( | 
| 102 | 101 | 'Job %s cannot be added to remote : %s', $sAppId, $e->getMessage() | 
| @@ -225,7 +225,7 @@ | ||
| 225 | 225 | } | 
| 226 | 226 | |
| 227 | 227 | /** | 
| 228 | - * @param null $sProfile | |
| 228 | + * @param string $sProfile | |
| 229 | 229 | * @return array|mixed | 
| 230 | 230 | */ | 
| 231 | 231 | private function loadConfigFile($sProfile = null) | 
| @@ -9,8 +9,6 @@ | ||
| 9 | 9 | |
| 10 | 10 | namespace Chapi\Commands; | 
| 11 | 11 | |
| 12 | -use Chapi\Component\DependencyInjection\Loader\YamChapiConfigLoader; | |
| 13 | -use Symfony\Component\Config\FileLocator; | |
| 14 | 12 | use Symfony\Component\Console\Input\InputInterface; | 
| 15 | 13 | use Symfony\Component\Console\Input\InputOption; | 
| 16 | 14 | use Symfony\Component\Console\Output\OutputInterface; |