ProvincesController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A all() 0 4 1
A getByRegion() 0 4 1
1
<?php
2
3
namespace Yajra\Address\Controllers;
4
5
use Illuminate\Routing\Controller;
6
use Yajra\Address\Repositories\Provinces\ProvincesRepository;
7
8
class ProvincesController extends Controller
9
{
10
    /**
11
     * @var ProvincesRepository
12
     */
13
    protected $repository;
14
15
    /**
16
     * ProvincesController constructor.
17
     *
18
     * @param ProvincesRepository $repository
19
     */
20
    public function __construct(ProvincesRepository $repository)
21
    {
22
        $this->repository = $repository;
23
    }
24
25
    /**
26
     * Get all provinces.
27
     *
28
     * @return \Illuminate\Database\Eloquent\Collection
29
     */
30
    public function all()
31
    {
32
        return $this->repository->all();
33
    }
34
35
    /**
36
     * Get province by region Id.
37
     *
38
     * @param string $regionId
39
     * @return \Illuminate\Database\Eloquent\Collection
40
     */
41
    public function getByRegion($regionId)
42
    {
43
        return $this->repository->getProvinceByRegion($regionId);
44
    }
45
}
46