@@ -21,6 +21,9 @@ |
||
| 21 | 21 | */ |
| 22 | 22 | private $endNode; |
| 23 | 23 | |
| 24 | + /** |
|
| 25 | + * @param string $value |
|
| 26 | + */ |
|
| 24 | 27 | public function __construct($value) |
| 25 | 28 | { |
| 26 | 29 | $this->value = $value; |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | |
| 74 | 74 | public function addSuffix($suffix, $word) |
| 75 | 75 | { |
| 76 | - if (count($suffix) < 1) { |
|
| 76 | + if (count($suffix) < 1) { |
|
| 77 | 77 | $this->endNode = $word; |
| 78 | 78 | return true; |
| 79 | 79 | } |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | $child = $this; |
| 44 | 44 | $prefix = str_split($prefix); |
| 45 | - foreach($prefix as $char) { |
|
| 46 | - if($child) { |
|
| 45 | + foreach ($prefix as $char) { |
|
| 46 | + if ($child) { |
|
| 47 | 47 | $child = $child->getChild($char); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function getPostfix($prefix, $postFixes = []) |
| 54 | 54 | { |
| 55 | - if($this->endNode) { |
|
| 55 | + if ($this->endNode) { |
|
| 56 | 56 | $postFixes[] = $this->endNode; |
| 57 | 57 | } |
| 58 | - foreach($this->children as $child) { |
|
| 58 | + foreach ($this->children as $child) { |
|
| 59 | 59 | $postFixes = $child->getPostfix($prefix, $postFixes); |
| 60 | 60 | } |
| 61 | 61 | return $postFixes; |
@@ -20,12 +20,12 @@ |
||
| 20 | 20 | public function build($name, $args = []) |
| 21 | 21 | { |
| 22 | 22 | $className = $this->namespace.$name.'\\'.$name; |
| 23 | - if( ! class_exists($className)) { |
|
| 23 | + if ( ! class_exists($className)) { |
|
| 24 | 24 | throw new \Exception('Class: '.$className.' not found.'); |
| 25 | 25 | } |
| 26 | 26 | $container = new \ReflectionClass($className); |
| 27 | 27 | $container = $container->newInstanceArgs($args); |
| 28 | - if( ! $container instanceof ContainerInterface) { |
|
| 28 | + if ( ! $container instanceof ContainerInterface) { |
|
| 29 | 29 | throw new \Exception('Bad container implementation'); |
| 30 | 30 | } |
| 31 | 31 | return $container; |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | { |
| 49 | 49 | $this->inputParse($prefix); |
| 50 | 50 | $child = $this->root->getClosest($prefix); |
| 51 | - if( ! $child) { |
|
| 51 | + if( ! $child) { |
|
| 52 | 52 | return []; |
| 53 | 53 | } |
| 54 | 54 | $postFixes = $child->getPostfix($prefix); |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | private function inputParse(&$input) |
| 28 | 28 | { |
| 29 | - if( ! $this->caseSensitive) { |
|
| 29 | + if ( ! $this->caseSensitive) { |
|
| 30 | 30 | $input = strtolower($input); |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $this->inputParse($prefix); |
| 50 | 50 | $child = $this->root->getClosest($prefix); |
| 51 | - if( ! $child) { |
|
| 51 | + if ( ! $child) { |
|
| 52 | 52 | return []; |
| 53 | 53 | } |
| 54 | 54 | $postFixes = $child->getPostfix($prefix); |