1 | <?php |
||
32 | class FindCommandHandler |
||
33 | { |
||
34 | /** |
||
35 | * @var ResourceRepository |
||
36 | */ |
||
37 | private $repo; |
||
38 | |||
39 | /** |
||
40 | * @var Discovery |
||
41 | */ |
||
42 | private $discovery; |
||
43 | |||
44 | /** |
||
45 | * Creates the handler. |
||
46 | * |
||
47 | * @param ResourceRepository $repo The resource repository. |
||
48 | * @param Discovery $discovery The discovery. |
||
49 | */ |
||
50 | public function __construct(ResourceRepository $repo, Discovery $discovery) |
||
55 | |||
56 | /** |
||
57 | * Handles the "find" command. |
||
58 | * |
||
59 | * @param Args $args The console arguments. |
||
60 | * @param IO $io The I/O. |
||
61 | * |
||
62 | * @return int The status code. |
||
63 | */ |
||
64 | public function handle(Args $args, IO $io) |
||
96 | |||
97 | /** |
||
98 | * Lists the matches for the given search criteria. |
||
99 | * |
||
100 | * @param IO $io The I/O. |
||
101 | * @param array $criteria The array with the optional keys "pattern", |
||
102 | * "shortClass" and "bindingType". |
||
103 | * |
||
104 | * @return int The status code. |
||
105 | */ |
||
106 | private function listMatches(IO $io, array $criteria) |
||
133 | |||
134 | /** |
||
135 | * Finds the resources for a given path pattern. |
||
136 | * |
||
137 | * @param string $query The resource query. |
||
138 | * @param string $language The language of the query. |
||
139 | * |
||
140 | * @return string[] An array of short resource class names indexed by |
||
141 | * the resource path. |
||
142 | */ |
||
143 | private function findByPath($query, $language = 'glob') |
||
154 | |||
155 | /** |
||
156 | * Finds the resources for a given binding type. |
||
157 | * |
||
158 | * @param string $typeName The type name. |
||
159 | * |
||
160 | * @return string[] An array of short resource class names indexed by |
||
161 | * the resource path. |
||
162 | */ |
||
163 | private function findByBindingType($typeName) |
||
180 | |||
181 | /** |
||
182 | * Prints the given resources. |
||
183 | * |
||
184 | * @param IO $io The I/O. |
||
185 | * @param string[] $matches An array of short resource class names indexed |
||
186 | * by the resource path. |
||
187 | */ |
||
188 | private function printTable(IO $io, array $matches) |
||
198 | } |
||
199 |