1 | <?php |
||
17 | class DocumentFinder |
||
18 | { |
||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | private $bundles; |
||
23 | |||
24 | /** |
||
25 | * @var string Directory in bundle to load documents from. |
||
26 | */ |
||
27 | private $documentDir; |
||
28 | |||
29 | /** |
||
30 | * Constructor. |
||
31 | * |
||
32 | * @param array $bundles Parameter kernel.bundles from service container. |
||
33 | */ |
||
34 | public function __construct(array $bundles) |
||
39 | |||
40 | /** |
||
41 | * @return string |
||
42 | */ |
||
43 | public function getDocumentDir() |
||
47 | |||
48 | /** |
||
49 | * @param string $documentDir |
||
50 | */ |
||
51 | public function setDocumentDir($documentDir) |
||
55 | |||
56 | /** |
||
57 | * Formats namespace from short syntax. |
||
58 | * |
||
59 | * @param string $namespace |
||
60 | * @param string $documentsDirectory Directory name where documents are stored in the bundle. |
||
61 | * |
||
62 | * @return string |
||
63 | */ |
||
64 | public function getNamespace($namespace, $documentsDirectory = null) |
||
95 | |||
96 | /** |
||
97 | * Returns bundle class namespace else throws an exception. |
||
98 | * |
||
99 | * @param string $name |
||
100 | * |
||
101 | * @return string |
||
102 | * |
||
103 | * @throws \LogicException |
||
104 | */ |
||
105 | public function getBundleClass($name) |
||
113 | |||
114 | /** |
||
115 | * Returns a list of bundle document classes. |
||
116 | * |
||
117 | * Example output: |
||
118 | * |
||
119 | * [ |
||
120 | * 'Category', |
||
121 | * 'Product', |
||
122 | * 'SubDir\SomeObject' |
||
123 | * ] |
||
124 | * |
||
125 | * @param string $bundle Bundle name. E.g. AppBundle |
||
126 | * @param string $documentsDirectory Directory name where documents are stored in the bundle. |
||
127 | * |
||
128 | * @return array |
||
129 | */ |
||
130 | public function getBundleDocumentClasses($bundle, $documentsDirectory = null) |
||
160 | } |
||
161 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: