Completed
Pull Request — development (#546)
by Nick
07:54 queued 01:05
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
 * @author Nick Lubisch <[email protected]>
10
 */
11
class CountryService
12
{
13
    /**
14
     * @var CountryRepository
15
     */
16
    private $countryRepository;
17
18
    /**
19
     * CountryService constructor.
20
     *
21
     * @param CountryRepository $countryRepository
22
     */
23
    public function __construct(CountryRepository $countryRepository)
24
    {
25
        $this->countryRepository = $countryRepository;
26
    }
27
28
    /**
29
     * Fetches all countries.
30
     *
31
     * @return CountryEntity[]
32
     */
33
    public function fetchAll()
34
    {
35
        return $this->countryRepository->fetchAll();
36
    }
37
38
    /**
39
     * Creates a country in the database.
40
     *
41
     * @param CountryEntity $entity
42
     *
43
     * @return CountryEntity
44
     */
45
    public function create(CountryEntity $entity)
46
    {
47
        return $this->countryRepository->create($entity);
48
    }
49
50
    /**
51
     * Update a country in the database.
52
     *
53
     * @param CountryEntity $entity
54
     *
55
     * @return CountryEntity
56
     */
57
    public function update(CountryEntity $entity)
58
    {
59
        return $this->countryRepository->update($entity);
60
    }
61
62
    /**
63
     * Removes a country from the database.
64
     *
65
     * @param CountryEntity $entity
66
     *
67
     * @return CountryEntity
68
     */
69
    public function remove(CountryEntity $entity)
70
    {
71
        return $this->countryRepository->remove($entity);
72
    }
73
}
74