Completed
Branch feature/job-plans (e266db)
by Adam
05:31
created

PlanRepository   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 26
rs 10
wmc 3
lcom 1
cbo 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A model() 0 4 1
A getDefaultId() 0 4 1
A active() 0 4 1
1
<?php
2
3
namespace Coyote\Repositories\Eloquent;
4
5
use Coyote\Plan;
6
use Coyote\Repositories\Contracts\PlanRepositoryInterface;
7
8
class PlanRepository extends Repository implements PlanRepositoryInterface
9
{
10
    /**
11
     * @return string
12
     */
13
    public function model()
14
    {
15
        return Plan::class;
16
    }
17
18
    /**
19
     * @inheritdoc
20
     */
21
    public function getDefaultId(): int
22
    {
23
        return (int) $this->model->select('id')->where('is_default', 1)->value('id');
24
    }
25
26
    /**
27
     * @inheritdoc
28
     */
29
    public function active()
30
    {
31
        return $this->model->where('is_active', 1)->orderBy('price')->get();
32
    }
33
}
34