@@ -6,9 +6,9 @@ |
||
| 6 | 6 | |
| 7 | 7 | abstract class VariableInfo_Renderer_String extends VariableInfo_Renderer |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var mixed |
|
| 11 | - */ |
|
| 9 | + /** |
|
| 10 | + * @var mixed |
|
| 11 | + */ |
|
| 12 | 12 | protected $value; |
| 13 | 13 | |
| 14 | 14 | protected function init() |
@@ -40,7 +40,7 @@ |
||
| 40 | 40 | str_replace(' ', '-', $this->type) |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - if($this->info->getBoolOption('prepend-type') && !$this->info->isNull()) |
|
| 43 | + if ($this->info->getBoolOption('prepend-type') && !$this->info->isNull()) |
|
| 44 | 44 | { |
| 45 | 45 | $typeLabel = '<span style="color:#1c2eb1" class="variable-type">'.$this->info->getType().'</span> '; |
| 46 | 46 | $converted = $typeLabel.' '.$converted; |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | $string = ''; |
| 12 | 12 | |
| 13 | - if(is_string($this->value[0])) |
|
| 13 | + if (is_string($this->value[0])) |
|
| 14 | 14 | { |
| 15 | 15 | $string .= $this->value[0].'::'; |
| 16 | 16 | } |
@@ -13,8 +13,7 @@ |
||
| 13 | 13 | if(is_string($this->value[0])) |
| 14 | 14 | { |
| 15 | 15 | $string .= $this->value[0].'::'; |
| 16 | - } |
|
| 17 | - else |
|
| 16 | + } else |
|
| 18 | 17 | { |
| 19 | 18 | $string .= get_class($this->value[0]).'->'; |
| 20 | 19 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | { |
| 11 | 11 | $result = array(); |
| 12 | 12 | |
| 13 | - foreach($this->value as $key => $val) |
|
| 13 | + foreach ($this->value as $key => $val) |
|
| 14 | 14 | { |
| 15 | 15 | $result[$key] = parseVariable($val)->toString(); |
| 16 | 16 | } |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | |
| 7 | 7 | abstract class VariableInfo_Renderer |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * @var mixed |
|
| 11 | - */ |
|
| 9 | + /** |
|
| 10 | + * @var mixed |
|
| 11 | + */ |
|
| 12 | 12 | protected $value; |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @var VariableInfo |
|
| 16 | - */ |
|
| 14 | + /** |
|
| 15 | + * @var VariableInfo |
|
| 16 | + */ |
|
| 17 | 17 | protected $info; |
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * @var string |
|
| 21 | - */ |
|
| 19 | + /** |
|
| 20 | + * @var string |
|
| 21 | + */ |
|
| 22 | 22 | protected $type; |
| 23 | 23 | |
| 24 | 24 | public function __construct(VariableInfo $info) |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | abstract protected function init(); |
| 33 | 33 | |
| 34 | - /** |
|
| 35 | - * Renders the value to the target format. |
|
| 36 | - * |
|
| 37 | - * @return mixed |
|
| 38 | - */ |
|
| 34 | + /** |
|
| 35 | + * Renders the value to the target format. |
|
| 36 | + * |
|
| 37 | + * @return mixed |
|
| 38 | + */ |
|
| 39 | 39 | public function render() |
| 40 | 40 | { |
| 41 | 41 | return $this->_render(); |
@@ -19,25 +19,25 @@ discard block |
||
| 19 | 19 | const TYPE_UNKNOWN = 'unknown type'; |
| 20 | 20 | const TYPE_CALLABLE = 'callable'; |
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var string |
|
| 24 | - */ |
|
| 22 | + /** |
|
| 23 | + * @var string |
|
| 24 | + */ |
|
| 25 | 25 | protected $string; |
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @var mixed |
|
| 29 | - */ |
|
| 27 | + /** |
|
| 28 | + * @var mixed |
|
| 29 | + */ |
|
| 30 | 30 | protected $value; |
| 31 | 31 | |
| 32 | - /** |
|
| 33 | - * @var string |
|
| 34 | - */ |
|
| 32 | + /** |
|
| 33 | + * @var string |
|
| 34 | + */ |
|
| 35 | 35 | protected $type; |
| 36 | 36 | |
| 37 | - /** |
|
| 38 | - * @param mixed $value |
|
| 39 | - * @param array|null $serialized |
|
| 40 | - */ |
|
| 37 | + /** |
|
| 38 | + * @param mixed $value |
|
| 39 | + * @param array|null $serialized |
|
| 40 | + */ |
|
| 41 | 41 | public function __construct($value, $serialized=null) |
| 42 | 42 | { |
| 43 | 43 | if(is_array($serialized)) |
@@ -50,26 +50,26 @@ discard block |
||
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - /** |
|
| 54 | - * Creates a new variable info instance from a PHP variable |
|
| 55 | - * of any type. |
|
| 56 | - * |
|
| 57 | - * @param mixed $variable |
|
| 58 | - * @return VariableInfo |
|
| 59 | - */ |
|
| 53 | + /** |
|
| 54 | + * Creates a new variable info instance from a PHP variable |
|
| 55 | + * of any type. |
|
| 56 | + * |
|
| 57 | + * @param mixed $variable |
|
| 58 | + * @return VariableInfo |
|
| 59 | + */ |
|
| 60 | 60 | public static function fromVariable($variable) : VariableInfo |
| 61 | 61 | { |
| 62 | 62 | return new VariableInfo($variable); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Restores a variable info instance using a previously serialized |
|
| 67 | - * array using the serialize() method. |
|
| 68 | - * |
|
| 69 | - * @param array $serialized |
|
| 70 | - * @return VariableInfo |
|
| 71 | - * @see VariableInfo::serialize() |
|
| 72 | - */ |
|
| 65 | + /** |
|
| 66 | + * Restores a variable info instance using a previously serialized |
|
| 67 | + * array using the serialize() method. |
|
| 68 | + * |
|
| 69 | + * @param array $serialized |
|
| 70 | + * @return VariableInfo |
|
| 71 | + * @see VariableInfo::serialize() |
|
| 72 | + */ |
|
| 73 | 73 | public static function fromSerialized(array $serialized) : VariableInfo |
| 74 | 74 | { |
| 75 | 75 | return new VariableInfo(null, $serialized); |
@@ -100,12 +100,12 @@ discard block |
||
| 100 | 100 | return $this->value; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | - /** |
|
| 104 | - * The variable type - this is the same string that |
|
| 105 | - * is returned by the PHP function `gettype`. |
|
| 106 | - * |
|
| 107 | - * @return string |
|
| 108 | - */ |
|
| 103 | + /** |
|
| 104 | + * The variable type - this is the same string that |
|
| 105 | + * is returned by the PHP function `gettype`. |
|
| 106 | + * |
|
| 107 | + * @return string |
|
| 108 | + */ |
|
| 109 | 109 | public function getType() : string |
| 110 | 110 | { |
| 111 | 111 | return $this->type; |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | ); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - /** |
|
| 123 | - * Whether to prepend the variable type before the value, |
|
| 124 | - * like the var_dump function. Example: <code>string "Some text"</code>. |
|
| 125 | - * |
|
| 126 | - * @param bool $enable |
|
| 127 | - * @return VariableInfo |
|
| 128 | - */ |
|
| 122 | + /** |
|
| 123 | + * Whether to prepend the variable type before the value, |
|
| 124 | + * like the var_dump function. Example: <code>string "Some text"</code>. |
|
| 125 | + * |
|
| 126 | + * @param bool $enable |
|
| 127 | + * @return VariableInfo |
|
| 128 | + */ |
|
| 129 | 129 | public function enableType(bool $enable=true) : VariableInfo |
| 130 | 130 | { |
| 131 | 131 | return $this->setOption('prepend-type', $enable); |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * @param mixed $value |
| 39 | 39 | * @param array|null $serialized |
| 40 | 40 | */ |
| 41 | - public function __construct($value, $serialized=null) |
|
| 41 | + public function __construct($value, $serialized = null) |
|
| 42 | 42 | { |
| 43 | - if(is_array($serialized)) |
|
| 43 | + if (is_array($serialized)) |
|
| 44 | 44 | { |
| 45 | 45 | $this->parseSerialized($serialized); |
| 46 | 46 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->value = $value; |
| 89 | 89 | $this->type = strtolower(gettype($value)); |
| 90 | 90 | |
| 91 | - if(is_array($value) && is_callable($value)) { |
|
| 91 | + if (is_array($value) && is_callable($value)) { |
|
| 92 | 92 | $this->type = self::TYPE_CALLABLE; |
| 93 | 93 | } |
| 94 | 94 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @param bool $enable |
| 127 | 127 | * @return VariableInfo |
| 128 | 128 | */ |
| 129 | - public function enableType(bool $enable=true) : VariableInfo |
|
| 129 | + public function enableType(bool $enable = true) : VariableInfo |
|
| 130 | 130 | { |
| 131 | 131 | return $this->setOption('prepend-type', $enable); |
| 132 | 132 | } |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | { |
| 136 | 136 | $converted = $this->string; |
| 137 | 137 | |
| 138 | - if($this->getOption('prepend-type') === true && !$this->isNull()) |
|
| 138 | + if ($this->getOption('prepend-type') === true && !$this->isNull()) |
|
| 139 | 139 | { |
| 140 | - if($this->isString()) |
|
| 140 | + if ($this->isString()) |
|
| 141 | 141 | { |
| 142 | 142 | $converted = '"'.$converted.'"'; |
| 143 | 143 | } |