Passed
Push — dev5 ( a24f56...eeca7a )
by Ron
08:23
created

GetEquipmentData   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 90%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 23
ccs 9
cts 10
cp 0.9
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllEquipmentWithDataList() 0 6 1
A getAllEquipmentNoCat() 0 11 2
1
<?php
2
3
namespace App\Domains\Equipment;
4
5
use Illuminate\Support\Facades\Log;
6
use Illuminate\Support\Facades\Auth;
7
8
use App\SystemTypes;
9
use App\SystemCategories;
10
use App\Http\Resources\SystemTypesCollection;
11
12
13
class GetEquipmentData
14
{
15
    //  Get a list of all equipment, but exclude the category name
16 2
    public function getAllEquipmentNoCat($collection = false)
17
    {
18 2
        $sysList = SystemTypes::orderBy('cat_id', 'ASC')->orderBy('name', 'ASC')->get();
19 2
        Log::debug('Equipment list gathered without category list.  Data Gathered - ', array($sysList));
20
21 2
        if($collection)
22
        {
23 2
            return new SystemTypesCollection($sysList);
24
        }
25
26
        return $sysList;
27
    }
28
29
    //  Get a list of all equipment along with possible data fields
30 2
    public function getAllEquipmentWithDataList()
31
    {
32 2
        $equipList = SystemCategories::with('SystemTypes')->with('SystemTypes.SystemDataFields')->get();
33 2
        Log::debug('Equipment list gathered with Data Fields.  Data Gathered - ', array($equipList));
34
35 2
        return $equipList->forget('system_data_field_types');
36
    }
37
}
38