Passed
Push — master ( 4a884d...c9d1fc )
by Jeff
12:14
created

StateRepository   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 20
c 0
b 0
f 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A listCities() 0 4 1
1
<?php
2
3
namespace App\Shop\States\Repositories;
4
5
use App\Shop\Base\BaseRepository;
6
use App\Shop\Cities\City;
7
use App\Shop\Cities\Repositories\CityRepository;
8
use App\Shop\States\State;
9
use Illuminate\Support\Collection;
10
11
class StateRepository extends BaseRepository implements StateRepositoryInterface
12
{
13
    /**
14
     * StateRepository constructor.
15
     *
16
     * @param State $state
17
     */
18
    public function __construct(State $state)
19
    {
20
        parent::__construct($state);
21
        $this->model = $state;
22
    }
23
24
    /**
25
     * @return Collection
26
     */
27
    public function listCities(): Collection
28
    {
29
        $cityRepo = new CityRepository(new City);
30
        return $cityRepo->listCitiesByStateCode($this->model->state_code);
31
    }
32
}