Completed
Push — master ( 5ba59a...5157fd )
by Denis
02:04
created

IssueCollection::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 6
loc 6
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 5
crap 2
1
<?php
2
3
namespace Lan\Ebs\Sdk\Collection;
4
5
use Exception;
6
use Lan\Ebs\Sdk\Classes\Collection;
7
use Lan\Ebs\Sdk\Client;
8
use Lan\Ebs\Sdk\Model\Issue;
9
10 View Code Duplication
class IssueCollection extends Collection
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
11
{
12
    private $journalId = null;
13
14
    /**
15
     * BookCollection constructor.
16
     * @param $journalId
17
     * @param Client $client
18
     * @param array $fields
19
     * @param int $limit
20
     * @param int $offset
21
     * @throws Exception
22
     */
23
    public function __construct($journalId, Client $client, array $fields = [], $limit = 10, $offset = 0)
24
    {
25
        parent::__construct($client, $fields, Issue::class, $limit, $offset);
26
27
        $this->journalId = $journalId;
28
    }
29
30
    /**
31
     * @param $method
32
     * @param array $params
33
     * @return array
34
     * @throws Exception
35
     */
36
    public function getUrl($method, array $params = [])
37
    {
38
        switch ($method) {
39
            case 'load':
40
                return [
41
                    'url' => '/1.0/resource/journal/' . ((int)$this->journalId),
42
                    'method' => 'GET',
43
                    'code' => '200'
44
                ];
45
            default:
46
                throw new Exception('Route for ' . $method . ' not found');
47
        }
48
    }
49
}