@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | { |
| 28 | 28 | $_ENV['GITLAB_PATTERN'] = self::TICKET_PATTERN; |
| 29 | 29 | $activityDtoCollection = $this->createGitlabActivityPlugin()->collect()->wait(); |
| 30 | - static::assertSame(self::TICKET_PATTERN.'-1234', $activityDtoCollection->offsetGet(0)->needle); |
|
| 30 | + static::assertSame(self::TICKET_PATTERN . '-1234', $activityDtoCollection->offsetGet(0)->needle); |
|
| 31 | 31 | static::assertSame('Entwicklungsprozess: TESTNR-1234 (commented on)', $activityDtoCollection->offsetGet(0)->description); |
| 32 | 32 | static::assertSame('2021-01-01', $activityDtoCollection->offsetGet(0)->created->format('Y-m-d')); |
| 33 | 33 | static::assertSame(GitlabActivityPlugin::ACTIVITY_DURATION, $activityDtoCollection->offsetGet(0)->duration); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | ; |
| 42 | 42 | |
| 43 | 43 | $testEvent1 = new \stdClass(); |
| 44 | - $testEvent1->target_title = self::TICKET_PATTERN.'-1234'; |
|
| 44 | + $testEvent1->target_title = self::TICKET_PATTERN . '-1234'; |
|
| 45 | 45 | $testEvent1->action_name = GitlabActivityPlugin::ALLOWED_ACTION_NAMES[0]; |
| 46 | 46 | $testEvent1->created_at = '2021-01-01 00:00:00'; |
| 47 | 47 | |
@@ -28,8 +28,8 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | $_ENV['MATTERMOST_PATTERN'] = self::TICKET_PATTERN; |
| 30 | 30 | $activityDtoCollection = $this->createMattermostActivityPlugin()->collect()->wait(); |
| 31 | - static::assertSame(self::TICKET_PATTERN.'-1234', $activityDtoCollection->offsetGet(0)->needle); |
|
| 32 | - static::assertSame(MattermostActivityPlugin::POST_SUFFIX.': TESTNR-1234', $activityDtoCollection->offsetGet(0)->description); |
|
| 31 | + static::assertSame(self::TICKET_PATTERN . '-1234', $activityDtoCollection->offsetGet(0)->needle); |
|
| 32 | + static::assertSame(MattermostActivityPlugin::POST_SUFFIX . ': TESTNR-1234', $activityDtoCollection->offsetGet(0)->description); |
|
| 33 | 33 | static::assertSame((new \DateTime())->format('Y-m-d'), $activityDtoCollection->offsetGet(0)->created->format('Y-m-d')); |
| 34 | 34 | static::assertSame(MattermostActivityPlugin::ACTIVITY_DURATION, $activityDtoCollection->offsetGet(0)->duration); |
| 35 | 35 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | $testChannel = new \stdClass(); |
| 45 | 45 | $testChannel->id = 'test-channel-id'; |
| 46 | - $resolvedPromiseChannel = new Promise(function () use (&$resolvedPromiseChannel, $testChannel) { |
|
| 46 | + $resolvedPromiseChannel = new Promise(function() use (&$resolvedPromiseChannel, $testChannel) { |
|
| 47 | 47 | $resolvedPromiseChannel->resolve([$testChannel]); |
| 48 | 48 | }); |
| 49 | 49 | |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | ->willReturn($resolvedPromiseChannel) |
| 53 | 53 | ; |
| 54 | 54 | |
| 55 | - $resolvedPromisePosts = new Promise(function () use (&$resolvedPromisePosts) { |
|
| 56 | - $resolvedPromisePosts->resolve([['message' => 'testmessage '.self::TICKET_PATTERN.'-1234', 'create_at' => (new \DateTime())->format('U') * 1000]]); |
|
| 55 | + $resolvedPromisePosts = new Promise(function() use (&$resolvedPromisePosts) { |
|
| 56 | + $resolvedPromisePosts->resolve([['message' => 'testmessage ' . self::TICKET_PATTERN . '-1234', 'create_at' => (new \DateTime())->format('U') * 1000]]); |
|
| 57 | 57 | }); |
| 58 | 58 | $mattermostClientFacadeMock |
| 59 | 59 | ->method('getPosts') |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | public function testCanGetChannel(): void |
| 39 | 39 | { |
| 40 | 40 | $channels = $this->createMattermostClientFacade( |
| 41 | - $this->createChannelResponse((int) ((new \DateTime(self::LAST_POST))->format('U')) * 1000) |
|
| 41 | + $this->createChannelResponse((int)((new \DateTime(self::LAST_POST))->format('U')) * 1000) |
|
| 42 | 42 | )->getChannel( |
| 43 | 43 | [ |
| 44 | 44 | new HasMessageChannelFilter(new \DateTime(self::CHANNEL_FILTER_LAST_POSTS)), |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | private function createMattermostClientFacade(string $jsonApiResponse): MattermostClientFacade |
| 64 | 64 | { |
| 65 | - $resolvedPromise = new Promise(function () use (&$resolvedPromise, $jsonApiResponse) { |
|
| 65 | + $resolvedPromise = new Promise(function() use (&$resolvedPromise, $jsonApiResponse) { |
|
| 66 | 66 | $resolvedPromise->resolve(new Response(200, ['X-Foo' => 'Bar'], $jsonApiResponse)); |
| 67 | 67 | }); |
| 68 | 68 | $clientMock = $this->getMockBuilder(Client::class) |
@@ -107,6 +107,6 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | private function createChannelResponse(int $lastPostAt): string |
| 109 | 109 | { |
| 110 | - return '[{"id":"test-id-1234","total_msg_count":'.self::MSG_COUNT.',"type":"'.self::CHANNEL_TYPE.'","last_post_at":'.$lastPostAt.'}]'; |
|
| 110 | + return '[{"id":"test-id-1234","total_msg_count":' . self::MSG_COUNT . ',"type":"' . self::CHANNEL_TYPE . '","last_post_at":' . $lastPostAt . '}]'; |
|
| 111 | 111 | } |
| 112 | 112 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | ->onlyMethods(['collect']) |
| 46 | 46 | ->getMock() |
| 47 | 47 | ; |
| 48 | - $resolvedPromise = new Promise(function () use (&$resolvedPromise) { |
|
| 48 | + $resolvedPromise = new Promise(function() use (&$resolvedPromise) { |
|
| 49 | 49 | $resolvedPromise->resolve(new ActivityDtoCollection( |
| 50 | 50 | new ActivityDto( |
| 51 | 51 | self::TEST_NEEDLE_1, |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | return $this->getFacade() |
| 42 | 42 | ->getChannel($this->channelFilterCollection) |
| 43 | 43 | ->then( |
| 44 | - function (array $channels) { |
|
| 44 | + function(array $channels) { |
|
| 45 | 45 | $postPromises = []; |
| 46 | 46 | foreach ($channels as $channel) { |
| 47 | 47 | $postPromises[] = $this->getFacade()->getPosts( |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | $activityDtoArray[$ticketNr] = new ActivityDto( |
| 85 | 85 | $ticketNr, |
| 86 | 86 | sprintf('%s: %s', self::POST_SUFFIX, $ticketNr), |
| 87 | - new \DateTime(date('d-m-Y', (int) ($post['create_at'] / 1000))), |
|
| 87 | + new \DateTime(date('d-m-Y', (int)($post['create_at'] / 1000))), |
|
| 88 | 88 | $duration |
| 89 | 89 | ); |
| 90 | 90 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | { |
| 97 | 97 | $matchPattern = sprintf('(%s-[0-9]{1,})i', $_ENV['GITLAB_PATTERN']); |
| 98 | 98 | $resultMatch = preg_match($matchPattern, $target_title, $match); |
| 99 | - if (0 === $resultMatch || ! isset($match[0])) { |
|
| 100 | - throw new \Exception('gitlab needle not found for target_title: '.$target_title); |
|
| 99 | + if (0 === $resultMatch || !isset($match[0])) { |
|
| 100 | + throw new \Exception('gitlab needle not found for target_title: ' . $target_title); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | return strtoupper($match[0]); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | { |
| 108 | 108 | $matchPattern = sprintf('(%s-[0-9]{1,})i', $_ENV['MATTERMOST_PATTERN']); |
| 109 | 109 | $resultMatch = preg_match($matchPattern, $target_title, $match); |
| 110 | - if (0 === $resultMatch || ! isset($match[0])) { |
|
| 110 | + if (0 === $resultMatch || !isset($match[0])) { |
|
| 111 | 111 | return false; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | public function collect(): PromiseInterface |
| 32 | 32 | { |
| 33 | 33 | $wrapPromise = new Promise( |
| 34 | - function () use (&$wrapPromise) { |
|
| 34 | + function() use (&$wrapPromise) { |
|
| 35 | 35 | $wrapPromise->resolve( |
| 36 | 36 | $this->mapEventsToActivity( |
| 37 | 37 | $this->getFacade()->getEvents(new GitlabQueryDto(date(date('Y-m-d', strtotime('-1 day'))))) |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | { |
| 74 | 74 | $matchPattern = sprintf('(%s-[0-9]{1,})i', $_ENV['GITLAB_PATTERN']); |
| 75 | 75 | $resultMatch = preg_match($matchPattern, $target_title, $match); |
| 76 | - if (0 === $resultMatch || ! isset($match[0])) { |
|
| 77 | - throw new \Exception('gitlab needle not found for target_title: '.$target_title); |
|
| 76 | + if (0 === $resultMatch || !isset($match[0])) { |
|
| 77 | + throw new \Exception('gitlab needle not found for target_title: ' . $target_title); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return strtoupper($match[0]); |
@@ -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, 512, JSON_THROW_ON_ERROR); |
|
| 48 | + $channelArray = json_decode((string)$res->getBody(), null, 512, 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, 512, JSON_THROW_ON_ERROR)['posts']); |
|
| 71 | + $wrapPromise->resolve(json_decode((string)$res->getBody(), true, 512, JSON_THROW_ON_ERROR)['posts']); |
|
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | 74 | return $wrapPromise; |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | public function collect(): PromiseInterface |
| 30 | 30 | { |
| 31 | 31 | $wrapPromise = new Promise( |
| 32 | - function () use (&$wrapPromise) { |
|
| 32 | + function() use (&$wrapPromise) { |
|
| 33 | 33 | $comments = $this->getFacade()->getComments(date('Y-m-d 00:00')); |
| 34 | 34 | $wrapPromise->resolve($this->createActivityDtoCollection($comments)); |
| 35 | 35 | } |