@@ -106,7 +106,7 @@ |
||
| 106 | 106 | |
| 107 | 107 | function isOneOf(object $obj, array $comparison) |
| 108 | 108 | { |
| 109 | - if(!is_object($obj) || !is_array($comparison)) { |
|
| 109 | + if (!is_object($obj) || !is_array($comparison)) { |
|
| 110 | 110 | throw new Exception(__FUNCTION__." only object and array are allowed for comparison", 1); |
| 111 | 111 | } |
| 112 | 112 | foreach ($comparison as $className) { |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | //public |
| 16 | 16 | /* @var null|string */ |
| 17 | 17 | public static $error; |
| 18 | - public const IGNORE_DIRECTIVES = 1;//DONT include_directive |
|
| 19 | - public const IGNORE_COMMENTS = 2;//DONT include_comments |
|
| 20 | - public const NO_PARSING_EXCEPTIONS = 4;//DONT throw Exception on parsing errors |
|
| 21 | - public const NO_OBJECT_FOR_DATE = 8;//DONT import date strings as dateTime Object |
|
| 18 | + public const IGNORE_DIRECTIVES = 1; //DONT include_directive |
|
| 19 | + public const IGNORE_COMMENTS = 2; //DONT include_comments |
|
| 20 | + public const NO_PARSING_EXCEPTIONS = 4; //DONT throw Exception on parsing errors |
|
| 21 | + public const NO_OBJECT_FOR_DATE = 8; //DONT import date strings as dateTime Object |
|
| 22 | 22 | |
| 23 | 23 | //private |
| 24 | 24 | /* @var null|false|array */ |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | /* @var null|string */ |
| 27 | 27 | private $filePath; |
| 28 | 28 | /* @var integer */ |
| 29 | - private $_debug = 0;///TODO: determine levels |
|
| 29 | + private $_debug = 0; ///TODO: determine levels |
|
| 30 | 30 | /* @var integer */ |
| 31 | 31 | private $_options = 0; |
| 32 | 32 | /* @var array */ |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | { |
| 174 | 174 | $deepest = $previous->getDeepestNode(); |
| 175 | 175 | if ($deepest instanceof NodePartial) { |
| 176 | - return $deepest->specialProcess($current, $this->_blankBuffer); |
|
| 177 | - } elseif(!($current instanceof NodePartial)) { |
|
| 176 | + return $deepest->specialProcess($current, $this->_blankBuffer); |
|
| 177 | + } elseif (!($current instanceof NodePartial)) { |
|
| 178 | 178 | return $current->specialProcess($previous, $this->_blankBuffer); |
| 179 | 179 | } |
| 180 | 180 | return false; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | foreach ($tmp as $child) { |
| 48 | 48 | if (!($child instanceof NodeComment) |
| 49 | 49 | && !($child instanceof NodeDirective) |
| 50 | - && !($child instanceof NodeDocstart && is_null($child->value)) ) return true; |
|
| 50 | + && !($child instanceof NodeDocstart && is_null($child->value))) return true; |
|
| 51 | 51 | } |
| 52 | 52 | return false; |
| 53 | 53 | } |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | public function push($node) |
| 56 | 56 | { |
| 57 | 57 | $type = null; |
| 58 | - if ($node instanceof NodeItem ) $type = self::SEQUENCE; |
|
| 58 | + if ($node instanceof NodeItem) $type = self::SEQUENCE; |
|
| 59 | 59 | elseif ($node instanceof NodeKey) $type = self::MAPPING; |
| 60 | 60 | elseif ($node instanceof NodeSetKey |
| 61 | 61 | || $node instanceof NodeSetValue) { |
| 62 | 62 | $type = self::SET; |
| 63 | - } elseif ($node instanceof NodeScalar ){ |
|
| 63 | + } elseif ($node instanceof NodeScalar) { |
|
| 64 | 64 | $type = self::MULTILINE; |
| 65 | 65 | } |
| 66 | 66 | if (!is_null($type) && $this->checkTypeCoherence($type)) { |
@@ -143,10 +143,10 @@ discard block |
||
| 143 | 143 | if ($child instanceof NodeComment) { |
| 144 | 144 | $child->build(); |
| 145 | 145 | } else { |
| 146 | - if($child->value instanceof NodeComment) { |
|
| 146 | + if ($child->value instanceof NodeComment) { |
|
| 147 | 147 | $child->value->build(); |
| 148 | 148 | $child->value = null; |
| 149 | - } elseif($child->value instanceof NodeList) { |
|
| 149 | + } elseif ($child->value instanceof NodeList) { |
|
| 150 | 150 | $child->value = $child->value->filterComment(); |
| 151 | 151 | } |
| 152 | 152 | $out->push($child); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | { |
| 34 | 34 | $reflectAPI = new \ReflectionClass(self::class); |
| 35 | 35 | $methodsList = []; |
| 36 | - $list = $reflectAPI->getMethods(RM::IS_FINAL | RM::IS_STATIC & RM::IS_PRIVATE); |
|
| 36 | + $list = $reflectAPI->getMethods(RM::IS_FINAL|RM::IS_STATIC & RM::IS_PRIVATE); |
|
| 37 | 37 | foreach ($list as $method) { |
| 38 | 38 | $methodsList[$method->name] = $method->getClosure(); |
| 39 | 39 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | foreach ($node as $key => $child) { |
| 104 | 104 | $list[] = self::strHandler($child)->raw; |
| 105 | 105 | } |
| 106 | - return new NodeScalar(implode('',$list), 0); |
|
| 106 | + return new NodeScalar(implode('', $list), 0); |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | public static function transform(string $identifier, object $value) |
| 171 | 171 | { |
| 172 | 172 | if (self::isKnown($identifier)) { |
| 173 | - if (!($value instanceof Node) && !($value instanceof NodeList) ) { |
|
| 173 | + if (!($value instanceof Node) && !($value instanceof NodeList)) { |
|
| 174 | 174 | throw new \Exception(sprintf(self::WRONG_VALUE, $identifier, gettype($value))); |
| 175 | 175 | } |
| 176 | 176 | return self::$registeredHandlers[$identifier]($value); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | if ($value instanceof NodeKey && $child instanceof NodeKey) { |
| 29 | 29 | if ($value->indent === $child->indent) { |
| 30 | 30 | return parent::add($child); |
| 31 | - } elseif ($value->isAwaitingChild($child)){ |
|
| 31 | + } elseif ($value->isAwaitingChild($child)) { |
|
| 32 | 32 | return $value->add($child); |
| 33 | 33 | } else { |
| 34 | 34 | throw new \ParseError('key ('.$value->identifier.')@'.$value->line.' has already a value', 1); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | if (is_null($this->value)) { |
| 39 | 39 | return null; |
| 40 | 40 | } else { |
| 41 | - if ($this->value instanceof NodeTag){ |
|
| 41 | + if ($this->value instanceof NodeTag) { |
|
| 42 | 42 | $parent->addTag($this->value->_tag); |
| 43 | 43 | $this->value->build($parent); |
| 44 | 44 | } else { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function __construct(string $nodeString, int $line) |
| 14 | 14 | { |
| 15 | 15 | parent::__construct($nodeString, $line); |
| 16 | - preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1,-1)), $matches); |
|
| 16 | + preg_match_all(Regex::SEQUENCE_VALUES, trim(substr(trim($nodeString), 1, -1)), $matches); |
|
| 17 | 17 | foreach ($matches['item'] as $key => $item) { |
| 18 | 18 | $i = new NodeItem('', $line); |
| 19 | 19 | $i->indent = null; |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $refSeparator = ' '; |
| 30 | 30 | $result = substr($first->raw, $first->indent); |
| 31 | 31 | foreach ($list as $child) { |
| 32 | - if($child->indent > $refIndent || ($child instanceof NodeBlank)) { |
|
| 32 | + if ($child->indent > $refIndent || ($child instanceof NodeBlank)) { |
|
| 33 | 33 | $separator = "\n"; |
| 34 | 34 | } else { |
| 35 | 35 | $separator = !empty($result) && $result[-1] === "\n" ? '' : $refSeparator; |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | $val = $child->build(); |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | - $result .= $separator .$val; |
|
| 45 | + $result .= $separator.$val; |
|
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | return $result; |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | public function __construct(string $nodeString, int $line) |
| 14 | 14 | { |
| 15 | 15 | parent::__construct($nodeString, $line); |
| 16 | - preg_match_all(Regex::MAPPING_VALUES, trim(substr(ltrim($nodeString), 1,-1)), $matches); |
|
| 16 | + preg_match_all(Regex::MAPPING_VALUES, trim(substr(ltrim($nodeString), 1, -1)), $matches); |
|
| 17 | 17 | foreach ($matches['k'] as $index => $property) { |
| 18 | 18 | $pair = $property.': '.trim($matches['v'][$index]); |
| 19 | 19 | $child = NodeFactory::get($pair, $line); |