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...
20
{
21
/**
22
* @var int
23
*/
24
private $totalCount;
25
26
/**
27
* @var Route[]
28
*/
29
private $items;
30
31
/**
32
* {@inheritdoc}
33
*/
34
1
public static function create(array $data)
35
{
36
1
$items = [];
37
38
1
if (isset($data['items'])) {
39
1
foreach ($data['items'] as $item) {
40
1
$items[] = Route::create($item);
41
}
42
}
43
44
1
if (isset($data['total_count'])) {
45
1
$count = $data['total_count'];
46
} else {
47
$count = count($items);
48
}
49
50
1
return new self($count, $items);
51
}
52
53
/**
54
* @param int $totalCount
55
* @param Route[] $items
56
*/
57
1
private function __construct($totalCount, array $items)
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.