1 | <?php |
||
13 | class ClassPattern implements PatternInterface { |
||
14 | |||
15 | /** |
||
16 | * @var QueryStrategy |
||
17 | */ |
||
18 | private $nameQuery = null; |
||
19 | |||
20 | |||
21 | /** |
||
22 | * By default we search for classes with any name |
||
23 | */ |
||
24 | 31 | public function __construct() { |
|
27 | |||
28 | |||
29 | /** |
||
30 | * @codeCoverageIgnore |
||
31 | * @deprecated |
||
32 | * @param string $name |
||
33 | * @return $this |
||
34 | */ |
||
35 | public function nameIs($name) { |
||
39 | |||
40 | |||
41 | /** |
||
42 | * @param QueryStrategy|string $name |
||
43 | * @return $this |
||
44 | */ |
||
45 | 12 | public function withName($name) { |
|
46 | 10 | if (is_string($name)) { |
|
47 | 6 | $this->nameQuery = Strict::create()->valueIs($name); |
|
48 | 7 | } elseif ($name instanceof QueryStrategy) { |
|
49 | 5 | $this->nameQuery = $name; |
|
50 | 2 | } else { |
|
51 | 2 | throw new \InvalidArgumentException('Expect string or QueryInterface'); |
|
52 | 2 | } |
|
53 | |||
54 | 10 | return $this; |
|
55 | } |
||
56 | |||
57 | |||
58 | /** |
||
59 | * @codeCoverageIgnore |
||
60 | * @deprecated |
||
61 | * @param QueryStrategy $strategy |
||
62 | * @return $this |
||
63 | */ |
||
64 | public function whereName(QueryStrategy $strategy) { |
||
68 | |||
69 | |||
70 | /** |
||
71 | * @inheritdoc |
||
72 | */ |
||
73 | 20 | public function __invoke(QuerySequence $querySequence) { |
|
86 | |||
87 | } |