@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use Spaark\CompositeUtils\Model\Reflection\ReflectionComposite; |
| 6 | 6 | use Spaark\CompositeUtils\Model\Reflection\ReflectionProperty; |
| 7 | -use Spaark\CompositeUtils\Model\Reflection\ReflectionParameter; |
|
| 8 | 7 | use Spaark\CompositeUtils\Model\Reflection\Type\BooleanType; |
| 9 | 8 | use Spaark\CompositeUtils\Model\Reflection\Type\CollectionType; |
| 10 | 9 | use Spaark\CompositeUtils\Model\Reflection\Type\IntegerType; |
@@ -40,8 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | public static function fromName($class, $property) |
| 42 | 42 | { |
| 43 | - return new static(new PHPNativeReflectionProperty |
|
| 44 | - ( |
|
| 43 | + return new static(new PHPNativeReflectionProperty( |
|
| 45 | 44 | $class, $property |
| 46 | 45 | )); |
| 47 | 46 | } |
@@ -50,8 +49,7 @@ discard block |
||
| 50 | 49 | { |
| 51 | 50 | $this->accessor->setRawValue('owner', $parent); |
| 52 | 51 | $this->accessor->setRawValue('defaultValue', $default); |
| 53 | - $this->accessor->setRawValue |
|
| 54 | - ( |
|
| 52 | + $this->accessor->setRawValue( |
|
| 55 | 53 | 'name', |
| 56 | 54 | $this->reflector->getName() |
| 57 | 55 | ); |
@@ -138,50 +136,42 @@ discard block |
||
| 138 | 136 | switch ($value[0]) |
| 139 | 137 | { |
| 140 | 138 | case 'required': |
| 141 | - $this->accessor->setRawValue |
|
| 142 | - ( |
|
| 139 | + $this->accessor->setRawValue( |
|
| 143 | 140 | 'passedToConstructor', |
| 144 | 141 | true |
| 145 | 142 | ); |
| 146 | - $this->accessor->setRawValue |
|
| 147 | - ( |
|
| 143 | + $this->accessor->setRawValue( |
|
| 148 | 144 | 'requiredInConstructor', |
| 149 | 145 | true |
| 150 | 146 | ); |
| 151 | - $compositeAccessor->rawAddToValue |
|
| 152 | - ( |
|
| 147 | + $compositeAccessor->rawAddToValue( |
|
| 153 | 148 | 'requiredProperties', |
| 154 | 149 | $this->object |
| 155 | 150 | ); |
| 156 | 151 | break; |
| 157 | 152 | case 'new': |
| 158 | - $this->accessor->setRawValue |
|
| 159 | - ( |
|
| 153 | + $this->accessor->setRawValue( |
|
| 160 | 154 | 'builtInConstructor', |
| 161 | 155 | true |
| 162 | 156 | ); |
| 163 | - $compositeAccessor->rawAddToValue |
|
| 164 | - ( |
|
| 157 | + $compositeAccessor->rawAddToValue( |
|
| 165 | 158 | 'builtProperties', |
| 166 | 159 | $this->object |
| 167 | 160 | ); |
| 168 | 161 | break; |
| 169 | 162 | case 'optional': |
| 170 | - $this->accessor->setRawValue |
|
| 171 | - ( |
|
| 163 | + $this->accessor->setRawValue( |
|
| 172 | 164 | 'passedToConstructor', |
| 173 | 165 | true |
| 174 | 166 | ); |
| 175 | - $compositeAccessor->rawAddToValue |
|
| 176 | - ( |
|
| 167 | + $compositeAccessor->rawAddToValue( |
|
| 177 | 168 | 'optionalProperties', |
| 178 | 169 | $this->object |
| 179 | 170 | ); |
| 180 | 171 | |
| 181 | 172 | if (isset($value[1]) && $value[1] === 'new') |
| 182 | 173 | { |
| 183 | - $this->accessor->setRawValue |
|
| 184 | - ( |
|
| 174 | + $this->accessor->setRawValue( |
|
| 185 | 175 | 'builtInConstructor', |
| 186 | 176 | true |
| 187 | 177 | ); |
@@ -66,8 +66,7 @@ discard block |
||
| 66 | 66 | if ($value{0} !== '?') |
| 67 | 67 | { |
| 68 | 68 | $nullable = false; |
| 69 | - } |
|
| 70 | - else |
|
| 69 | + } else |
|
| 71 | 70 | { |
| 72 | 71 | $nullable = true; |
| 73 | 72 | $value = substr($value, 1); |
@@ -76,8 +75,7 @@ discard block |
||
| 76 | 75 | if (substr($value, -2) !== '[]') |
| 77 | 76 | { |
| 78 | 77 | $collection = false; |
| 79 | - } |
|
| 80 | - else |
|
| 78 | + } else |
|
| 81 | 79 | { |
| 82 | 80 | $collection = true; |
| 83 | 81 | $value = substr($value, 0, -2); |
@@ -110,8 +108,7 @@ discard block |
||
| 110 | 108 | if ($useStatements->contains($value)) |
| 111 | 109 | { |
| 112 | 110 | $value = $useStatements[$value]->classname; |
| 113 | - } |
|
| 114 | - else |
|
| 111 | + } else |
|
| 115 | 112 | { |
| 116 | 113 | $value = $this->object->owner->namespace->namespace |
| 117 | 114 | . '\\' . $value; |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | { |
| 40 | 40 | preg_match_all |
| 41 | 41 | ( |
| 42 | - '/^' |
|
| 42 | + '/^' |
|
| 43 | 43 | . '[ \t]*\*[ \t]*' |
| 44 | 44 | . '@([a-zA-Z]+)' |
| 45 | 45 | . '(.*)' |
@@ -37,8 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | protected function parseDocComment() |
| 39 | 39 | { |
| 40 | - preg_match_all |
|
| 41 | - ( |
|
| 40 | + preg_match_all( |
|
| 42 | 41 | '/^' |
| 43 | 42 | . '[ \t]*\*[ \t]*' |
| 44 | 43 | . '@([a-zA-Z]+)' |
@@ -55,8 +54,7 @@ discard block |
||
| 55 | 54 | |
| 56 | 55 | if (isset($this->acceptedParams[$name])) |
| 57 | 56 | { |
| 58 | - call_user_func |
|
| 59 | - ( |
|
| 57 | + call_user_func( |
|
| 60 | 58 | array($this, $this->acceptedParams[$name]), |
| 61 | 59 | $name, $value |
| 62 | 60 | ); |
@@ -66,7 +64,7 @@ discard block |
||
| 66 | 64 | |
| 67 | 65 | protected function setBool($name, $value) |
| 68 | 66 | { |
| 69 | - switch(strtolower($value)) |
|
| 67 | + switch (strtolower($value)) |
|
| 70 | 68 | { |
| 71 | 69 | case '': |
| 72 | 70 | case 'true': |
@@ -13,17 +13,15 @@ |
||
| 13 | 13 | |
| 14 | 14 | public static function fromName($class, $method) |
| 15 | 15 | { |
| 16 | - return new static(new PHPNativeReflectionMethod |
|
| 17 | - ( |
|
| 16 | + return new static(new PHPNativeReflectionMethod( |
|
| 18 | 17 | $class, $method |
| 19 | 18 | )); |
| 20 | 19 | } |
| 21 | 20 | |
| 22 | - public function build(?ReflectionComposite $parent = null) |
|
| 21 | + public function build(? ReflectionComposite $parent = null) |
|
| 23 | 22 | { |
| 24 | 23 | $this->accessor->setRawValue('owner', $parent); |
| 25 | - $this->accessor->setRawValue |
|
| 26 | - ( |
|
| 24 | + $this->accessor->setRawValue( |
|
| 27 | 25 | 'name', |
| 28 | 26 | $this->reflector->getName() |
| 29 | 27 | ); |
@@ -23,8 +23,7 @@ |
||
| 23 | 23 | if ($this->locked) |
| 24 | 24 | { |
| 25 | 25 | return parent::__set($var, $val); |
| 26 | - } |
|
| 27 | - else |
|
| 26 | + } else |
|
| 28 | 27 | { |
| 29 | 28 | $this->$var = $val; |
| 30 | 29 | } |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | private function getScalar($value) |
| 28 | 28 | { |
| 29 | 29 | return |
| 30 | - (is_object($value) ? spl_object_hash($value) |
|
| 30 | + (is_object($value) ? spl_object_hash($value) |
|
| 31 | 31 | : (is_array($value) ? implode($value) |
| 32 | 32 | : ( (string)$value))); |
| 33 | 33 | } |
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | { |
| 29 | 29 | return |
| 30 | 30 | (is_object($value) ? spl_object_hash($value) |
| 31 | - : (is_array($value) ? implode($value) |
|
| 32 | - : ( (string)$value))); |
|
| 31 | + : (is_array($value) ? implode($value) |
|
| 32 | + : ((string)$value))); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -43,7 +43,9 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | public function popMultiple($i = 1) |
| 45 | 45 | { |
| 46 | - if ($i < 1) return NULL; |
|
| 46 | + if ($i < 1) { |
|
| 47 | + return NULL; |
|
| 48 | + } |
|
| 47 | 49 | |
| 48 | 50 | $ret = array_slice($this->data, -1 * $i); |
| 49 | 51 | $this->data = array_slice($this->data, 0, -1 * $i); |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | parent::__construct |
| 12 | 12 | ( |
| 13 | - 'Cannot ' . static::ACCESS_TYPE . ' non existent ' |
|
| 13 | + 'Cannot ' . static::ACCESS_TYPE . ' non existent ' |
|
| 14 | 14 | . 'property: ' . $class . '::$' . $property, |
| 15 | 15 | 0, |
| 16 | 16 | $previous |
@@ -8,8 +8,7 @@ |
||
| 8 | 8 | |
| 9 | 9 | public function __construct($class, $property, $previous = null) |
| 10 | 10 | { |
| 11 | - parent::__construct |
|
| 12 | - ( |
|
| 11 | + parent::__construct( |
|
| 13 | 12 | 'Cannot ' . static::ACCESS_TYPE . ' non existent ' |
| 14 | 13 | . 'property: ' . $class . '::$' . $property, |
| 15 | 14 | 0, |
@@ -27,7 +27,7 @@ |
||
| 27 | 27 | private function getScalar($value) |
| 28 | 28 | { |
| 29 | 29 | return |
| 30 | - (is_object($value) ? spl_object_hash($value) |
|
| 30 | + (is_object($value) ? spl_object_hash($value) |
|
| 31 | 31 | : (is_array($value) ? implode($value) |
| 32 | 32 | : ( (string)$value))); |
| 33 | 33 | } |
@@ -24,8 +24,8 @@ |
||
| 24 | 24 | { |
| 25 | 25 | return |
| 26 | 26 | (is_object($value) ? spl_object_hash($value) |
| 27 | - : (is_array($value) ? implode($value) |
|
| 28 | - : ( (string)$value))); |
|
| 27 | + : (is_array($value) ? implode($value) |
|
| 28 | + : ((string)$value))); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | public function key() |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace Spaark\CompositeUtils\Factory\Reflection; |
| 4 | 4 | |
| 5 | -use Spaark\CompositeUtils\Factory\BaseFactory; |
|
| 6 | 5 | use Spaark\CompositeUtils\Model\Reflection\ReflectionComposite; |
| 7 | 6 | use \ReflectionClass as PHPNativeReflectionClass; |
| 8 | 7 | |
@@ -21,13 +21,11 @@ discard block |
||
| 21 | 21 | (new ReflectionFileFactory($this->reflector->getFileName())) |
| 22 | 22 | ->build(); |
| 23 | 23 | $this->accessor->setRawValue('file', $file); |
| 24 | - $this->accessor->setRawValue |
|
| 25 | - ( |
|
| 24 | + $this->accessor->setRawValue( |
|
| 26 | 25 | 'classname', |
| 27 | 26 | $this->reflector->name |
| 28 | 27 | ); |
| 29 | - $this->accessor->setRawValue |
|
| 30 | - ( |
|
| 28 | + $this->accessor->setRawValue( |
|
| 31 | 29 | 'namespace', |
| 32 | 30 | $file->namespaces[$this->reflector->getNamespaceName()] |
| 33 | 31 | ); |
@@ -53,15 +51,13 @@ discard block |
||
| 53 | 51 | |
| 54 | 52 | protected function buildProperty($reflect) |
| 55 | 53 | { |
| 56 | - $properties = $this->accessor->getRawValue |
|
| 57 | - ( |
|
| 54 | + $properties = $this->accessor->getRawValue( |
|
| 58 | 55 | 'properties' |
| 59 | 56 | ); |
| 60 | 57 | |
| 61 | 58 | $properties[$reflect->getName()] = |
| 62 | 59 | (new ReflectionPropertyFactory($reflect)) |
| 63 | - ->build |
|
| 64 | - ( |
|
| 60 | + ->build( |
|
| 65 | 61 | $this->object, |
| 66 | 62 | $this->reflector |
| 67 | 63 | ->getDefaultProperties()[$reflect->getName()] |
@@ -70,8 +66,7 @@ discard block |
||
| 70 | 66 | |
| 71 | 67 | protected function buildMethod($reflect) |
| 72 | 68 | { |
| 73 | - $this->accessor->rawAddToValue |
|
| 74 | - ( |
|
| 69 | + $this->accessor->rawAddToValue( |
|
| 75 | 70 | 'methods', |
| 76 | 71 | (new ReflectionMethodFactory($reflect)) |
| 77 | 72 | ->build($this->object) |