Repository::getBusiness()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 2
crap 2
1
<?php
2
3
namespace Timegridio\Concierge;
4
5
use Timegridio\Concierge\Models\Business;
6
7
class Repository
8
{
9
    /**
10
     * Default lookup identificator.
11
     *
12
     * @var string
13
     */
14
    private $identificator = 'slug';
15
16 1
    public function getBusiness($id, $identificator = null)
17
    {
18 1
        $identificator = $identificator ?: $this->identificator;
19
20 1
        return Business::where($identificator, $id)->first();
21
    }
22
23 3
    public function getService($business, $id, $identificator = null)
24
    {
25 3
        $identificator = $identificator ?: $this->identificator;
26
27 3
        return $business->services()->where($identificator, $id)->first();
28
    }
29
}
30