ProjectCollector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getSlugs() 0 8 1
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