Completed
Push — master ( 2e26b5...b4f6b0 )
by Sören
02:18
created

AbstractItemManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0
Metric Value
wmc 3
lcom 0
cbo 0
dl 0
loc 31
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A findItemById() 0 4 1
A findItemByWishlist() 0 4 1
A createItem() 0 7 1
1
<?php
2
3
/*
4
 * (c) Soeren Martius
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace SoerenMartius\Component\Wishlist\Manager;
11
12
use SoerenMartius\Component\Wishlist\Model\ItemInterface;
13
14
/**
15
 * @author Soeren Martius <[email protected]>
16
 */
17
abstract class AbstractItemManager implements
18
    ItemManagerInterface,
19
    ManagerInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24
    public function findItemById($id)
25
    {
26
        return $this->findItemBy(['id' => $id]);
27
    }
28
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function findItemByWishlist($wishlistId)
33
    {
34
        return $this->findItemBy(['wishlist' => $wishlistId]);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function createItem(): ItemInterface
41
    {
42
        $class = $this->getClass();
43
        $item  = new $class();
44
45
        return $item;
46
    }
47
}
48