Passed
Push — master ( 37c076...380953 )
by Jan
10:23
created

DeviceRepository::getPartsCount()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 9
rs 10
1
<?php
2
3
4
namespace App\Repository\Parts;
5
6
7
use App\Entity\Base\AbstractPartsContainingDBElement;
8
use App\Entity\Devices\Device;
9
use App\Entity\Parts\Category;
10
use App\Entity\Parts\Part;
11
use App\Repository\AbstractPartsContainingRepository;
12
13
class DeviceRepository extends AbstractPartsContainingRepository
14
{
15
16
    public function getParts(object $element, array $order_by = ['name' => 'ASC']): array
17
    {
18
        if (!$element instanceof Device) {
19
            throw new \InvalidArgumentException('$element must be an Device!');
20
        }
21
22
23
        //TODO: Change this later, when properly implemented devices
24
        return [];
25
    }
26
27
    public function getPartsCount(object $element): int
28
    {
29
        if (!$element instanceof Device) {
30
            throw new \InvalidArgumentException('$element must be an Device!');
31
        }
32
33
        //TODO: Change this later, when properly implemented devices
34
        //Prevent user from deleting devices, to not accidentally remove filled devices from old versions
35
        return 1;
36
    }
37
}