ProjectCollector::getSlugs()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 2
1
<?php
2
3
namespace MS\Sentry\Monitor\Service\Import;
4
5
use MS\Sentry\Monitor\Model\SentryRequest;
6
use MS\Sentry\Monitor\Service\SentryClient;
7
8
class ProjectCollector
9
{
10
    const PROJECTS_PATTERN = '/api/0/organizations/%s/projects/';
11
12
    /**
13
     * @var SentryClient
14
     */
15
    private $sentryClient;
16
17
    /**
18
     * @param SentryClient $sentryClient
19
     */
20
    public function __construct(SentryClient $sentryClient)
21
    {
22
        $this->sentryClient = $sentryClient;
23
    }
24
25
    /**
26
     * @param SentryRequest $sentryRequest
27
     * @param string        $organisation
28
     *
29
     * @return array
30
     */
31
    public function getSlugs(SentryRequest $sentryRequest, $organisation)
32
    {
33
        $projects = $this
34
            ->sentryClient
35
            ->get($sentryRequest, sprintf(self::PROJECTS_PATTERN, $organisation));
36
37
        return array_column($projects, 'slug');
38
    }
39
}
40