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

DeviceRepository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 23
rs 10
wmc 4

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getParts() 0 9 2
A getPartsCount() 0 9 2
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
}