Completed
Push — master ( ef29db...6cb927 )
by Ariel
06:10
created

Repository   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 23
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getBusiness() 0 6 2
A getService() 0 6 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
    public function getBusiness($id, $identificator = null)
17
    {
18
        $identificator = $identificator ?: $this->identificator;
19
20
        return Business::where($identificator, $id)->first();
21
    }
22
23
    public function getService($business, $id, $identificator = null)
24
    {
25
        $identificator = $identificator ?: $this->identificator;
26
27
        return $business->services()->where($identificator, $id)->first();
28
    }
29
}
30