Completed
Push — master ( 1392b0...257c81 )
by Denis
01:57
created

Book::getUrl()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 13
Code Lines 9

Duplication

Lines 13
Ratio 100 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 0
Metric Value
dl 13
loc 13
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 9
nc 2
nop 2
crap 2
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: dp
5
 * Date: 26.07.17
6
 * Time: 11:57
7
 */
8
9
namespace Lan\Ebs\Sdk\Model;
10
11
use Exception;
12
use Lan\Ebs\Sdk\Classes\Model;
13
use Lan\Ebs\Sdk\Client;
14
15
/**
16
 * @property mixed login
17
 * @property mixed email
18
 * @property mixed fio
19
 * @property mixed registered_at
20
 */
21 View Code Duplication
class Book extends Model
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...
22
{
23
    const FIELD_NAME = 'name';
24
25
    public static $defaultFields = [
26
        Book::FIELD_NAME,
27
    ];
28
29 3
    public function __construct(Client $client, array $fields = [])
30
    {
31 3
        parent::__construct($client, $fields);
32 3
    }
33
34 1
    public function getUrl($method, array $params = [])
35
    {
36
        switch ($method) {
37 1
            case 'get':
38
                return [
39 1
                    'url' => vsprintf('/1.0/resource/book/get/%d', $params),
40 1
                    'method' => 'GET',
41 1
                    'code' => 200
42
                ];
43
            default:
44
                throw new Exception('Route for ' . $method . ' not found');
45
        }
46
    }
47
}