Completed
Push — master ( e8241e...60d0c3 )
by
unknown
04:24 queued 02:47
created

BookCollection::getUrl()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 0
loc 13
ccs 3
cts 4
cp 0.75
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 2
crap 2.0625
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\Book;
9
10 View Code Duplication
class BookCollection 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
    /**
13
     * BookCollection constructor.
14
     * @param Client $client
15
     * @param array $fields
16
     * @param int $limit
17
     * @param int $offset
18
     * @throws Exception
19
     */
20 2
    public function __construct(Client $client, array $fields = [], $limit = 10, $offset = 0)
21
    {
22 2
        parent::__construct($client, $fields, Book::class, $limit, $offset);
23 2
    }
24
25
    /**
26
     * @param $method
27
     * @param array $params
28
     * @return array
29
     * @throws Exception
30
     */
31 2
    public function getUrl($method, array $params = [])
32
    {
33
        switch ($method) {
34 2
            case 'load':
35
                return [
36 2
                    'url' => '/1.0/resource/book',
37
                    'method' => 'GET',
38
                    'code' => '200'
39
                ];
40
            default:
41
                throw new Exception('Route for ' . $method . ' not found');
42
        }
43
    }
44
}