UserCollection::getUrl()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 13

Duplication

Lines 13
Ratio 100 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 0
Metric Value
dl 13
loc 13
ccs 3
cts 4
cp 0.75
rs 9.8333
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2.0625
1
<?php
2
/**
3
 * Class UserCollection
4
 *
5
 * @author       Denis Shestakov <[email protected]>
6
 * @copyright    Copyright (c) 2017, Lan Publishing
7
 * @license      MIT
8
 */
9
10
namespace Lan\Ebs\Sdk\Collection;
11
12
use Exception;
13
use Lan\Ebs\Sdk\Classes\Collection;
14
use Lan\Ebs\Sdk\Client;
15
use Lan\Ebs\Sdk\Model\User;
16
17
/**
18
 * Коллекция пользователей
19
 *
20
 * @package      Lan\Ebs
21
 * @subpackage   Sdk
22
 * @category     Collection
23
 */
24 View Code Duplication
class UserCollection 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...
25
{
26
    /**
27
     * UserCollection constructor.
28
     *
29
     * @param Client $client
30
     * @param array $fields
31
     * @param int $limit
32
     * @param int $offset
33
     * @throws Exception
34
     */
35 1
    public function __construct(Client $client, array $fields = array(), $limit = 10, $offset = 0)
36
    {
37 1
        parent::__construct($client, $fields, User::class, $limit, $offset);
38 1
    }
39
40
    /**
41
     * Получение данных для запроса через API
42
     *
43
     * @param string $method Http-метод запроса
44
     * @param array $params Параметры для формирования урла
45
     *
46
     * @return array
47
     *
48
     * @throws Exception
49
     */
50 1
    public function getUrl($method, array $params = array())
51
    {
52
        switch ($method) {
53 1
            case 'load':
54
                return array(
55 1
                    'url' => '/1.0/security/user',
56
                    'method' => 'GET',
57
                    'code' => '200'
58
                );
59
            default:
60
                throw new Exception('Route for ' . $method . ' not found');
61
        }
62
    }
63
}