Passed
Push — master ( 39bac6...ee7138 )
by Craig
08:23
created

ExtensionVarStubRepository::matching()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Zikula package.
5
 *
6
 * Copyright Zikula Foundation - http://zikula.org/
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Zikula\ExtensionsModule\Tests\Api\Fixtures;
13
14
use Doctrine\Common\Collections\Criteria;
15
use Zikula\ExtensionsModule\Entity\RepositoryInterface\ExtensionVarRepositoryInterface;
16
use Zikula\ExtensionsModule\Entity\ExtensionVarEntity;
17
18
class ExtensionVarStubRepository implements ExtensionVarRepositoryInterface
19
{
20
    private $entities;
21
22
    /**
23
     * StubRepository constructor.
24
     */
25
    public function __construct()
26
    {
27
        $datas = [
28
            ['modname' => 'FooExtension',
29
                'name' => 'bar',
30
                'value' => 'test',
31
            ],
32
            ['modname' => 'BarExtension',
33
                'name' => 'bar',
34
                'value' => 7,
35
            ],
36
            ['modname' => 'BarExtension',
37
                'name' => 'name',
38
                'value' => 'steve',
39
            ],
40
            ['modname' => 'BarExtension',
41
                'name' => 'string',
42
                'value' => 'xyz',
43
            ],
44
            ['modname' => 'ZConfig',
45
                'name' => 'systemvar',
46
                'value' => 'abc',
47
            ],
48
        ];
49
        foreach ($datas as $data) {
50
            $entity = new ExtensionVarEntity();
51
            $entity->merge($data);
52
            $this->entities[] = $entity;
53
        }
54
    }
55
56
    public function remove(ExtensionVarEntity $entity)
57
    {
58
    }
59
60
    public function persistAndFlush(ExtensionVarEntity $entity)
61
    {
62
        return true;
63
    }
64
65
    public function deleteByExtensionAndName($extensionName, $variableName)
66
    {
67
        if (isset($this->entities[$extensionName][$variableName])) {
68
            unset($this->entities[$extensionName][$variableName]);
69
        }
70
71
        return true;
72
    }
73
74
    public function deleteByExtension($extensionName)
75
    {
76
        if (isset($this->entities[$extensionName])) {
77
            unset($this->entities[$extensionName]);
78
        }
79
80
        return true;
81
    }
82
83
    public function findAll()
84
    {
85
        return $this->entities;
86
    }
87
88
    public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
89
    {
90
        return isset($this->entities[$criteria['modname']][$criteria['name']]) ? $this->entities[$criteria['modname']][$criteria['name']] : [];
91
    }
92
93
    public function updateName($oldName, $newName)
94
    {
95
    }
96
97
    public function find($id)
98
    {
99
    }
100
101
    public function findOneBy(array $criteria)
102
    {
103
    }
104
105
    public function getClassName()
106
    {
107
    }
108
109
    public function matching(Criteria $criteria)
110
    {
111
    }
112
}
113