1 | <?php |
||
18 | class ExternalLibraryBitBucketService implements JiraTicketMappedEventAware, BitBucketService |
||
19 | { |
||
20 | /** @var string */ |
||
21 | private const URL_PREFIX = 'https://farpoint.get-ag.com/jira/rest/dev-status/1.0/issue/detail?issueId='; |
||
22 | |||
23 | /** @var string */ |
||
24 | private const URL_SUFFIX = '&applicationType=stash&dataType=pullrequest'; |
||
25 | |||
26 | /** @var string */ |
||
27 | private $url; |
||
28 | |||
29 | /** @var LoggerInterface */ |
||
30 | private $logger; |
||
31 | |||
32 | /** @var ExternalLibraryHttpClient */ |
||
33 | private $httpClient; |
||
34 | |||
35 | /** @var EventDispatcherInterface */ |
||
36 | private $dispatcher; |
||
37 | |||
38 | 1 | public function __construct( |
|
47 | |||
48 | /** Recives event with mapped Jira ticket. */ |
||
49 | 1 | public function onJiraTicketMapped(JiraTicketMappedEvent $event) : void |
|
59 | |||
60 | /** |
||
61 | * Fetches data from BitBucket by tickets id. |
||
62 | * |
||
63 | * @throws RuntimeException |
||
64 | * @throws NullResultReturned |
||
65 | */ |
||
66 | 1 | public function fetchBitBucketData(int $ticketId) : void |
|
80 | |||
81 | /** |
||
82 | * Gets content from response and decodes it into array. |
||
83 | * |
||
84 | * @throws RuntimeException |
||
85 | */ |
||
86 | 1 | private function getResponseContent(Response $response) : ?array |
|
92 | |||
93 | /** |
||
94 | * Maps and filters received BitBucket data to array. |
||
95 | */ |
||
96 | 1 | private function mapToBitbucketTicket(array $bbTicket, int $ticketId) : void |
|
108 | |||
109 | /** |
||
110 | * Combines url with given ticket id. |
||
111 | */ |
||
112 | 1 | private function createUrl(int $ticketId) : void |
|
116 | } |
||
117 |