@@ -36,7 +36,7 @@ |
||
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Returns MimeType |
39 | - * @return string |
|
39 | + * @return string[] |
|
40 | 40 | */ |
41 | 41 | public function getMimeType() |
42 | 42 | { |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * For instance, if you want to decode Yaml files with the extensions ".yml" and ".yaml", |
32 | 32 | * then you want to set the return array to ['yaml', 'yml']. |
33 | 33 | * |
34 | - * @return array |
|
34 | + * @return string[] |
|
35 | 35 | */ |
36 | 36 | public function getMimeType() |
37 | 37 | { |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace Michaels\Manager; |
3 | 3 | |
4 | -use Michaels\Manager\Contracts\DecoderInterface; |
|
4 | +use Exception; |
|
5 | 5 | use Michaels\Manager\Bags\FileBag; |
6 | -use Michaels\Manager\Exceptions\UnsupportedFilesException; |
|
6 | +use Michaels\Manager\Contracts\DecoderInterface; |
|
7 | 7 | use Michaels\Manager\Exceptions\BadFileDataException; |
8 | -use Exception; |
|
8 | +use Michaels\Manager\Exceptions\UnsupportedFilesException; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Loads configuration files and converts them to php arrays using Decoders |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * Process file bag to load into the data manager. |
102 | 102 | * A file bag is an array of SplFileInfo objects. |
103 | 103 | * |
104 | - * @param array|FileBag $fileBag |
|
104 | + * @param FileBag $fileBag |
|
105 | 105 | * @return array |
106 | 106 | * @throws Exception |
107 | 107 | */ |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | * Default decoder class factory method. |
173 | 173 | * Checks to make sure we have a default decoder available and if so, adds it as a decoder to the file loader. |
174 | 174 | * |
175 | - * @param $mimeType |
|
175 | + * @param string $mimeType |
|
176 | 176 | */ |
177 | 177 | protected function checkAndAddDefaultDecoder($mimeType) |
178 | 178 | { |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | if (!empty($this->unsupportedFiles)) { |
129 | 129 | $badFiles = implode(", ", $this->unsupportedFiles); |
130 | 130 | throw new UnsupportedFilesException( |
131 | - 'The file(s) ' . $badFiles . ' are not supported by the available decoders.' |
|
131 | + 'The file(s) '.$badFiles.' are not supported by the available decoders.' |
|
132 | 132 | ); |
133 | 133 | } |
134 | 134 | |
@@ -176,11 +176,11 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function checkAndAddDefaultDecoder($mimeType) |
178 | 178 | { |
179 | - $decoderClass = ucfirst($mimeType) . "Decoder"; |
|
179 | + $decoderClass = ucfirst($mimeType)."Decoder"; |
|
180 | 180 | |
181 | - if (file_exists(__DIR__ . '/Decoders/' . $decoderClass . '.php') && !$this->isSupportedMimeType($mimeType)) { |
|
181 | + if (file_exists(__DIR__.'/Decoders/'.$decoderClass.'.php') && !$this->isSupportedMimeType($mimeType)) { |
|
182 | 182 | $nameSpace = "Michaels\\Manager\\Decoders\\"; |
183 | - $fullQualifiedClassName = $nameSpace . $decoderClass; |
|
183 | + $fullQualifiedClassName = $nameSpace.$decoderClass; |
|
184 | 184 | $decoder = new $fullQualifiedClassName(); |
185 | 185 | $this->addDecoder($decoder); |
186 | 186 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | |
264 | 264 | } else { |
265 | 265 | // We are namespacing using the file's name |
266 | - $filename = rtrim($file->getBasename(), '.' . $file->getExtension()); |
|
266 | + $filename = rtrim($file->getBasename(), '.'.$file->getExtension()); |
|
267 | 267 | $namespace = $this->sanitizeNamespace($filename); |
268 | 268 | return [$namespace, $file]; |
269 | 269 | } |
@@ -435,7 +435,7 @@ |
||
435 | 435 | |
436 | 436 | /** |
437 | 437 | * Cycle through the nests to see if an item is protected |
438 | - * @param $item |
|
438 | + * @param string $item |
|
439 | 439 | */ |
440 | 440 | protected function checkIfProtected($item) |
441 | 441 | { |
@@ -7,7 +7,6 @@ |
||
7 | 7 | use Michaels\Manager\Exceptions\NestingUnderNonArrayException; |
8 | 8 | use Michaels\Manager\Helpers; |
9 | 9 | use Michaels\Manager\Messages\NoItemFoundMessage; |
10 | -use Traversable; |
|
11 | 10 | |
12 | 11 | /** |
13 | 12 | * Manages complex, nested data |
@@ -25,7 +25,7 @@ |
||
25 | 25 | return iterator_to_array($items); |
26 | 26 | } |
27 | 27 | |
28 | - return (array)$items; |
|
28 | + return (array) $items; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -31,7 +31,7 @@ |
||
31 | 31 | * For instance, if you want to decode Yaml files with the extensions ".yml" and ".yaml", |
32 | 32 | * then you want to set the return array to ['yaml', 'yml']. |
33 | 33 | * |
34 | - * @return array |
|
34 | + * @return string[] |
|
35 | 35 | */ |
36 | 36 | public function getMimeType() |
37 | 37 | { |
@@ -142,7 +142,7 @@ |
||
142 | 142 | * |
143 | 143 | * @param string $method name |
144 | 144 | * @param array $arguments to be passed along |
145 | - * @param object $instance of the Collection |
|
145 | + * @param CollectionTrait $instance of the Collection |
|
146 | 146 | * @param string $flag corresponding to the properties above |
147 | 147 | * @param string $subject Alias of data in Manager |
148 | 148 | * @return mixed |
@@ -77,7 +77,7 @@ |
||
77 | 77 | } else { |
78 | 78 | throw new \BadMethodCallException( |
79 | 79 | "Call to undefined method. `$method` does not exist in " |
80 | - . get_called_class() . " and it is not part of the Collection API" |
|
80 | + . get_called_class()." and it is not part of the Collection API" |
|
81 | 81 | ); |
82 | 82 | } |
83 | 83 | } |
@@ -103,7 +103,7 @@ |
||
103 | 103 | /** |
104 | 104 | * Turns a dependency into a singleton. |
105 | 105 | * @param $alias |
106 | - * @return mixed |
|
106 | + * @return ManagesIocTrait |
|
107 | 107 | */ |
108 | 108 | public function share($alias) |
109 | 109 | { |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function fetch($alias, $fallback = '_michaels_no_fallback') |
58 | 58 | { |
59 | - $shared = $this->getIfExists($this->nameOfIocManifest . "._singletons.$alias"); |
|
59 | + $shared = $this->getIfExists($this->nameOfIocManifest."._singletons.$alias"); |
|
60 | 60 | |
61 | 61 | if ($shared instanceof NoItemFoundMessage) { |
62 | 62 | // This is not a shared item. We want a new one each time |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | // This is shared, but we must produce and cache it |
70 | 70 | } else { |
71 | 71 | $object = $this->produceDependency($alias, $fallback); |
72 | - $this->set($this->nameOfIocManifest . "._singletons.$alias", $object); |
|
72 | + $this->set($this->nameOfIocManifest."._singletons.$alias", $object); |
|
73 | 73 | return $object; |
74 | 74 | } |
75 | 75 | } |
@@ -90,11 +90,11 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function di($alias, $factory, array $declared = null) |
92 | 92 | { |
93 | - $this->set($this->nameOfIocManifest . ".$alias", $factory); |
|
93 | + $this->set($this->nameOfIocManifest.".$alias", $factory); |
|
94 | 94 | |
95 | 95 | // Setup any declared dependencies |
96 | 96 | if ($declared) { |
97 | - $this->set($this->nameOfIocManifest . "._declarations.$alias", $declared); |
|
97 | + $this->set($this->nameOfIocManifest."._declarations.$alias", $declared); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | return $this; |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | public function share($alias) |
109 | 109 | { |
110 | - $this->add($this->nameOfIocManifest . "._singletons.$alias", true); |
|
110 | + $this->add($this->nameOfIocManifest."._singletons.$alias", true); |
|
111 | 111 | return $this; |
112 | 112 | } |
113 | 113 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function setup($alias, $pipeline) |
121 | 121 | { |
122 | - $this->add($this->nameOfIocManifest . "._pipelines.$alias", $pipeline); |
|
122 | + $this->add($this->nameOfIocManifest."._pipelines.$alias", $pipeline); |
|
123 | 123 | return $this; |
124 | 124 | } |
125 | 125 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | protected function produceDependency($alias, $fallback = '_michaels_no_fallback') |
155 | 155 | { |
156 | 156 | /* Get the registered factory (string, closure, object, container, NoItemFoundMessage) */ |
157 | - $factory = $this->getIfExists($this->nameOfIocManifest . ".$alias"); |
|
157 | + $factory = $this->getIfExists($this->nameOfIocManifest.".$alias"); |
|
158 | 158 | |
159 | 159 | /* Manage not founds and fallback */ |
160 | 160 | if ($factory instanceof NoItemFoundMessage) { |
@@ -166,13 +166,13 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | /* Get any declared dependencies */ |
169 | - $declared = $this->getIfExists($this->nameOfIocManifest . "._declarations.$alias"); |
|
169 | + $declared = $this->getIfExists($this->nameOfIocManifest."._declarations.$alias"); |
|
170 | 170 | $dependencies = []; |
171 | 171 | |
172 | 172 | // Now setup those dependencies into an array |
173 | 173 | if (!$declared instanceof NoItemFoundMessage) { |
174 | 174 | $dependencies = array_map(function(&$value) use ($alias) { |
175 | - if (is_string($value) && $this->exists($this->nameOfIocManifest . ".$alias")) { |
|
175 | + if (is_string($value) && $this->exists($this->nameOfIocManifest.".$alias")) { |
|
176 | 176 | return $this->fetch($value); |
177 | 177 | } |
178 | 178 | return $value; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | /* Run the object through the pipeline, if desired */ |
206 | - $pipeline = $this->getIfExists($this->nameOfIocManifest . "._pipelines.$alias"); |
|
206 | + $pipeline = $this->getIfExists($this->nameOfIocManifest."._pipelines.$alias"); |
|
207 | 207 | |
208 | 208 | if (!$pipeline instanceof NoItemFoundMessage) { |
209 | 209 | /** @var \Closure $pipeline */ |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | { |
41 | 41 | $prefix = $this->buildPrefix(); |
42 | 42 | |
43 | - return $this->get($prefix . $name); |
|
43 | + return $this->get($prefix.$name); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | { |
70 | 70 | $prefix = $this->buildPrefix(); |
71 | 71 | |
72 | - return $this->add($prefix . $key, $value); |
|
72 | + return $this->add($prefix.$key, $value); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $prefix = $this->currentLevel; |
86 | 86 | $this->currentLevel = false; |
87 | 87 | |
88 | - return $prefix . "."; |
|
88 | + return $prefix."."; |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | protected function addToChain($name) |
98 | 98 | { |
99 | 99 | $dot = ($this->currentLevel === false) ? '' : '.'; |
100 | - $this->currentLevel .= $dot . $name; |
|
100 | + $this->currentLevel .= $dot.$name; |
|
101 | 101 | |
102 | 102 | return $this; |
103 | 103 | } |