@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | */ |
| 45 | 45 | public static function fromClosure(Closure $closure, $origin) : NamedClosure |
| 46 | 46 | { |
| 47 | - if(is_object($origin)) { |
|
| 47 | + if (is_object($origin)) { |
|
| 48 | 48 | $origin = get_class($origin); |
| 49 | 49 | } |
| 50 | 50 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param string|object $origin |
| 58 | 58 | * @return NamedClosure |
| 59 | 59 | */ |
| 60 | - public static function fromObject(object $object, string $method, $origin='') : NamedClosure |
|
| 60 | + public static function fromObject(object $object, string $method, $origin = '') : NamedClosure |
|
| 61 | 61 | { |
| 62 | 62 | return self::fromArray(array($object, $method), $origin); |
| 63 | 63 | } |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | * @param string|object $origin |
| 68 | 68 | * @return NamedClosure |
| 69 | 69 | */ |
| 70 | - public static function fromArray(array $callback, $origin='') : NamedClosure |
|
| 70 | + public static function fromArray(array $callback, $origin = '') : NamedClosure |
|
| 71 | 71 | { |
| 72 | - if(empty($origin)) { |
|
| 72 | + if (empty($origin)) { |
|
| 73 | 73 | $origin = ConvertHelper::callback2string($callback); |
| 74 | - } else if(is_object($origin)) { |
|
| 74 | + } else if (is_object($origin)) { |
|
| 75 | 75 | $origin = get_class($origin); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -37,19 +37,19 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | const ERROR_INVALID_SERIALIZED_DATA = 56301; |
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * @var string |
|
| 42 | - */ |
|
| 40 | + /** |
|
| 41 | + * @var string |
|
| 42 | + */ |
|
| 43 | 43 | protected $string; |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var mixed |
|
| 47 | - */ |
|
| 45 | + /** |
|
| 46 | + * @var mixed |
|
| 47 | + */ |
|
| 48 | 48 | protected $value; |
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 50 | + /** |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | 53 | protected $type; |
| 54 | 54 | |
| 55 | 55 | /** |
@@ -106,15 +106,15 @@ discard block |
||
| 106 | 106 | return new VariableInfo(null, $serialized); |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Parses a previously serialized data set to restore the |
|
| 111 | - * variable information from it. |
|
| 112 | - * |
|
| 113 | - * @param array $serialized |
|
| 114 | - * @throws BaseException |
|
| 115 | - * |
|
| 116 | - * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA |
|
| 117 | - */ |
|
| 109 | + /** |
|
| 110 | + * Parses a previously serialized data set to restore the |
|
| 111 | + * variable information from it. |
|
| 112 | + * |
|
| 113 | + * @param array $serialized |
|
| 114 | + * @throws BaseException |
|
| 115 | + * |
|
| 116 | + * @see VariableInfo::ERROR_INVALID_SERIALIZED_DATA |
|
| 117 | + */ |
|
| 118 | 118 | protected function parseSerialized(array $serialized) : void |
| 119 | 119 | { |
| 120 | 120 | if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
@@ -156,12 +156,12 @@ discard block |
||
| 156 | 156 | return $this->value; |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - /** |
|
| 160 | - * The variable type - this is the same string that |
|
| 161 | - * is returned by the PHP function `gettype`. |
|
| 162 | - * |
|
| 163 | - * @return string |
|
| 164 | - */ |
|
| 159 | + /** |
|
| 160 | + * The variable type - this is the same string that |
|
| 161 | + * is returned by the PHP function `gettype`. |
|
| 162 | + * |
|
| 163 | + * @return string |
|
| 164 | + */ |
|
| 165 | 165 | public function getType() : string |
| 166 | 166 | { |
| 167 | 167 | return $this->type; |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | ); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | - /** |
|
| 179 | - * Whether to prepend the variable type before the value, |
|
| 180 | - * like the var_dump function. Example: <code>string "Some text"</code>. |
|
| 181 | - * |
|
| 182 | - * @param bool $enable |
|
| 183 | - * @return VariableInfo |
|
| 184 | - */ |
|
| 178 | + /** |
|
| 179 | + * Whether to prepend the variable type before the value, |
|
| 180 | + * like the var_dump function. Example: <code>string "Some text"</code>. |
|
| 181 | + * |
|
| 182 | + * @param bool $enable |
|
| 183 | + * @return VariableInfo |
|
| 184 | + */ |
|
| 185 | 185 | public function enableType(bool $enable=true) : VariableInfo |
| 186 | 186 | { |
| 187 | 187 | return $this->setOption('prepend-type', $enable); |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @param array|null $serialized |
| 68 | 68 | * @throws BaseException |
| 69 | 69 | */ |
| 70 | - public function __construct($value, ?array $serialized=null) |
|
| 70 | + public function __construct($value, ?array $serialized = null) |
|
| 71 | 71 | { |
| 72 | - if(is_array($serialized)) |
|
| 72 | + if (is_array($serialized)) |
|
| 73 | 73 | { |
| 74 | 74 | $this->parseSerialized($serialized); |
| 75 | 75 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | protected function parseSerialized(array $serialized) : void |
| 119 | 119 | { |
| 120 | - if(!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
|
| 120 | + if (!isset($serialized['string']) || !isset($serialized['type']) || !isset($serialized['options'])) |
|
| 121 | 121 | { |
| 122 | 122 | throw new BaseException( |
| 123 | 123 | 'Invalid variable info serialized data.', |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | // Gettype will return a string like "Resource(closed)" when |
| 141 | 141 | // working with a resource that has already been closed. |
| 142 | - if(strstr($this->type, 'resource')) |
|
| 142 | + if (strstr($this->type, 'resource')) |
|
| 143 | 143 | { |
| 144 | 144 | $this->type = self::TYPE_RESOURCE; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if(in_array($this->type, $this->callableTypes) && is_callable($value)) { |
|
| 147 | + if (in_array($this->type, $this->callableTypes) && is_callable($value)) { |
|
| 148 | 148 | $this->type = self::TYPE_CALLABLE; |
| 149 | 149 | } |
| 150 | 150 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @param bool $enable |
| 183 | 183 | * @return VariableInfo |
| 184 | 184 | */ |
| 185 | - public function enableType(bool $enable=true) : VariableInfo |
|
| 185 | + public function enableType(bool $enable = true) : VariableInfo |
|
| 186 | 186 | { |
| 187 | 187 | return $this->setOption('prepend-type', $enable); |
| 188 | 188 | } |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | { |
| 192 | 192 | $converted = $this->string; |
| 193 | 193 | |
| 194 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
| 194 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
| 195 | 195 | { |
| 196 | - if($this->isString()) |
|
| 196 | + if ($this->isString()) |
|
| 197 | 197 | { |
| 198 | 198 | $converted = '"'.$converted.'"'; |
| 199 | 199 | } |
@@ -13,20 +13,20 @@ discard block |
||
| 13 | 13 | $string = ''; |
| 14 | 14 | |
| 15 | 15 | // Simple function call |
| 16 | - if(is_string($this->value)) |
|
| 16 | + if (is_string($this->value)) |
|
| 17 | 17 | { |
| 18 | 18 | return $this->value.'()'; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - if(is_array($this->value)) { |
|
| 21 | + if (is_array($this->value)) { |
|
| 22 | 22 | return $this->renderArray(); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if($this->value instanceof NamedClosure) { |
|
| 25 | + if ($this->value instanceof NamedClosure) { |
|
| 26 | 26 | return 'Closure:'.$this->value->getOrigin(); |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | - if($this->value instanceof Closure) { |
|
| 29 | + if ($this->value instanceof Closure) { |
|
| 30 | 30 | return 'Closure'; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | $string = ''; |
| 39 | 39 | |
| 40 | 40 | if (is_string($this->value[0])) { |
| 41 | - $string .= $this->value[0] . '::'; |
|
| 41 | + $string .= $this->value[0].'::'; |
|
| 42 | 42 | } else { |
| 43 | - $string .= get_class($this->value[0]) . '->'; |
|
| 43 | + $string .= get_class($this->value[0]).'->'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $string .= $this->value[1].'()'; |