Completed
Pull Request — development (#546)
by Nick
06:41
created

CountryService   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 63
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 63
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 1

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A fetchAll() 0 4 1
A create() 0 4 1
A update() 0 4 1
A remove() 0 4 1
1
<?php
2
3
namespace Oc\Country;
4
5
/**
6
 * Class CountryService
7
 *
8
 * @package Oc\Country
9
 */
10
class CountryService
11
{
12
    /**
13
     * @var CountryRepository
14
     */
15
    private $countryRepository;
16
17
    /**
18
     * CountryService constructor.
19
     *
20
     * @param CountryRepository $countryRepository
21
     */
22
    public function __construct(CountryRepository $countryRepository)
23
    {
24
        $this->countryRepository = $countryRepository;
25
    }
26
27
    /**
28
     * Fetches all countries.
29
     *
30
     * @return CountryEntity[]
31
     */
32
    public function fetchAll()
33
    {
34
        return $this->countryRepository->fetchAll();
35
    }
36
37
    /**
38
     * Creates a country in the database.
39
     *
40
     * @param CountryEntity $entity
41
     *
42
     * @return CountryEntity
43
     */
44
    public function create(CountryEntity $entity)
45
    {
46
        return $this->countryRepository->create($entity);
47
    }
48
49
    /**
50
     * Update a country in the database.
51
     *
52
     * @param CountryEntity $entity
53
     *
54
     * @return CountryEntity
55
     */
56
    public function update(CountryEntity $entity)
57
    {
58
        return $this->countryRepository->update($entity);
59
    }
60
61
    /**
62
     * Removes a country from the database.
63
     *
64
     * @param CountryEntity $entity
65
     *
66
     * @return CountryEntity
67
     */
68
    public function remove(CountryEntity $entity)
69
    {
70
        return $this->countryRepository->remove($entity);
71
    }
72
}
73