@@ -28,10 +28,10 @@ |
||
| 28 | 28 | $res = $this->guzzleClient->request( |
| 29 | 29 | 'GET', |
| 30 | 30 | self::EVENTS_API, |
| 31 | - ['query' => array_merge((array) $queryDto, $this->getToken())], |
|
| 31 | + ['query' => array_merge((array)$queryDto, $this->getToken())], |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | - return json_decode((string) $res->getBody(), null, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR); |
|
| 34 | + return json_decode((string)$res->getBody(), null, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | private function getToken(): array |
@@ -33,19 +33,19 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | $this->auth(); |
| 35 | 35 | |
| 36 | - $wrapPromise = new Promise(function () use ($channelFilterCollection, &$wrapPromise) { |
|
| 36 | + $wrapPromise = new Promise(function() use ($channelFilterCollection, &$wrapPromise) { |
|
| 37 | 37 | $res = $this->guzzleClient->requestAsync( |
| 38 | 38 | 'GET', |
| 39 | 39 | sprintf(self::CHANNEL_API, $this->mattermostConfigDto->teamId), |
| 40 | 40 | [ |
| 41 | 41 | 'headers' => [ |
| 42 | - 'Authorization' => 'Bearer '.static::$token, |
|
| 42 | + 'Authorization' => 'Bearer ' . static::$token, |
|
| 43 | 43 | 'Content-Type' => 'application/json', |
| 44 | 44 | ], |
| 45 | 45 | ] |
| 46 | 46 | )->wait(); |
| 47 | 47 | |
| 48 | - $channelArray = json_decode((string) $res->getBody(), null, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR); |
|
| 48 | + $channelArray = json_decode((string)$res->getBody(), null, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR); |
|
| 49 | 49 | $wrapPromise->resolve($this->applyChannelFilter($channelArray, $channelFilterCollection)); |
| 50 | 50 | }); |
| 51 | 51 | |
@@ -55,20 +55,20 @@ discard block |
||
| 55 | 55 | public function getPosts(MattermostPostsQueryDto $postsQueryDto): PromiseInterface |
| 56 | 56 | { |
| 57 | 57 | $this->auth(); |
| 58 | - $wrapPromise = new Promise(function () use ($postsQueryDto, &$wrapPromise) { |
|
| 58 | + $wrapPromise = new Promise(function() use ($postsQueryDto, &$wrapPromise) { |
|
| 59 | 59 | $res = $this->guzzleClient->requestAsync( |
| 60 | 60 | 'GET', |
| 61 | 61 | sprintf(self::POSTS_API, $postsQueryDto->channelId), |
| 62 | 62 | [ |
| 63 | - 'query' => ['since' => (int) $postsQueryDto->since->format('U') * 1000], |
|
| 63 | + 'query' => ['since' => (int)$postsQueryDto->since->format('U') * 1000], |
|
| 64 | 64 | 'headers' => [ |
| 65 | - 'Authorization' => 'Bearer '.static::$token, |
|
| 65 | + 'Authorization' => 'Bearer ' . static::$token, |
|
| 66 | 66 | 'Content-Type' => 'application/json', |
| 67 | 67 | ], |
| 68 | 68 | ], |
| 69 | 69 | )->wait(); |
| 70 | 70 | |
| 71 | - $wrapPromise->resolve(json_decode((string) $res->getBody(), true, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR)['posts']); |
|
| 71 | + $wrapPromise->resolve(json_decode((string)$res->getBody(), true, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR)['posts']); |
|
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | 74 | return $wrapPromise; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | $this->validator->validate( |
| 41 | 41 | $periodicalConfigCollection, |
| 42 | - (object) ['$ref' => $this->periodicalActivitySchemaPath] |
|
| 42 | + (object)['$ref' => $this->periodicalActivitySchemaPath] |
|
| 43 | 43 | ); |
| 44 | 44 | |
| 45 | 45 | if ($this->validator->isValid()) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | $periodicalConfigDtoCollection = []; |
| 74 | 74 | foreach ($periodicalConfigCollection as $periodicalConfig) { |
| 75 | - $periodicalConfigDtoCollection[] = new PeriodicalActivityConfigDto(...(array) $periodicalConfig); |
|
| 75 | + $periodicalConfigDtoCollection[] = new PeriodicalActivityConfigDto(...(array)$periodicalConfig); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return $periodicalConfigDtoCollection; |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | { |
| 33 | 33 | return new PeriodicalActivityConfigReader( |
| 34 | 34 | $_ENV['PERIODICAL_ACTIVITY_CONFIG'], |
| 35 | - 'file://'.realpath( |
|
| 35 | + 'file://' . realpath( |
|
| 36 | 36 | $this->getSchemaPath() |
| 37 | 37 | ), |
| 38 | 38 | $this->createValidator(), |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | |
| 43 | 43 | public function getSchemaPath(): string |
| 44 | 44 | { |
| 45 | - return __DIR__.DIRECTORY_SEPARATOR.'Business/Schema/periodical_activity_config_schema.json'; |
|
| 45 | + return __DIR__ . DIRECTORY_SEPARATOR . 'Business/Schema/periodical_activity_config_schema.json'; |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function createValidator(): Validator |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | $savedActivities = 0; |
| 39 | 39 | foreach ($activityDtoCollection as $activityDto) { |
| 40 | 40 | $writeTimeRegistration = [ |
| 41 | - 'person' => (int) $this->forecastConfigDto->forecastPersonId, |
|
| 41 | + 'person' => (int)$this->forecastConfigDto->forecastPersonId, |
|
| 42 | 42 | 'task' => $this->findTaskIdToNeedle($activityDto->needle), |
| 43 | 43 | 'time_registered' => $activityDto->duration, |
| 44 | 44 | 'date' => $activityDto->created->format('Y-m-d'), |
| 45 | 45 | 'notes' => $activityDto->description, |
| 46 | 46 | ]; |
| 47 | 47 | $writeResponse = $this->callPostApi(self::TIME_REGISTRATIONS_ENDPOINT, $writeTimeRegistration); |
| 48 | - $this->logFacade->info('activity sent to forecast.', (array) $writeResponse); |
|
| 48 | + $this->logFacade->info('activity sent to forecast.', (array)$writeResponse); |
|
| 49 | 49 | ++$savedActivities; |
| 50 | 50 | } |
| 51 | 51 | |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | |
| 64 | 64 | private function callGetApi(string $path): array |
| 65 | 65 | { |
| 66 | - if (! $this->cacheFacade->has($path)) { |
|
| 66 | + if (!$this->cacheFacade->has($path)) { |
|
| 67 | 67 | $res = $this->guzzleClient->request( |
| 68 | 68 | 'GET', |
| 69 | 69 | $path, |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | 'headers' => ['X-FORECAST-API-KEY' => $this->forecastConfigDto->forecastApiKey], |
| 72 | 72 | ] |
| 73 | 73 | ); |
| 74 | - $forecastResponse = json_decode((string) $res->getBody(), null, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR); |
|
| 74 | + $forecastResponse = json_decode((string)$res->getBody(), null, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR); |
|
| 75 | 75 | $this->cacheFacade->set($path, $forecastResponse); |
| 76 | 76 | } else { |
| 77 | 77 | $forecastResponse = $this->cacheFacade->get($path); |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ] |
| 96 | 96 | ); |
| 97 | 97 | |
| 98 | - return json_decode((string) $res->getBody(), null, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR); |
|
| 98 | + return json_decode((string)$res->getBody(), null, JSON_PARTIAL_OUTPUT_ON_ERROR, JSON_THROW_ON_ERROR); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | private function findTaskIdToNeedle(string $taskNeedle): int |
@@ -106,6 +106,6 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - return (int) $this->forecastConfigDto->forecastFallbackTaskId; |
|
| 109 | + return (int)$this->forecastConfigDto->forecastFallbackTaskId; |
|
| 110 | 110 | } |
| 111 | 111 | } |