BarangaysController   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

3 Methods

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