@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | public function add(NodeGeneric $child):NodeGeneric |
| 63 | 63 | { |
| 64 | - if ($this->value instanceof NodeGeneric && $this->value->isOneOf('Literal','LiteralFolded', 'Anchor')) { |
|
| 64 | + if ($this->value instanceof NodeGeneric && $this->value->isOneOf('Literal', 'LiteralFolded', 'Anchor')) { |
|
| 65 | 65 | return $this->value->add($child); |
| 66 | 66 | } else { |
| 67 | 67 | return parent::add($child); |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | if ($current instanceof Comment) { |
| 97 | 97 | return true; |
| 98 | 98 | } |
| 99 | - if($current instanceof Scalar) { |
|
| 99 | + if ($current instanceof Scalar) { |
|
| 100 | 100 | return $node->isOneOf('Scalar', 'Blank'); |
| 101 | 101 | } |
| 102 | 102 | if ($current instanceof Item) { |
@@ -106,7 +106,7 @@ |
||
| 106 | 106 | if (count(self::$schemas) === 0) { |
| 107 | 107 | self::createCoreSchema(); |
| 108 | 108 | } |
| 109 | - if (!($value instanceof NodeGeneric) && !($value instanceof NodeList) ) { |
|
| 109 | + if (!($value instanceof NodeGeneric) && !($value instanceof NodeList)) { |
|
| 110 | 110 | throw new \Exception(sprintf(self::WRONG_VALUE, $identifier, gettype($value))); |
| 111 | 111 | } else { |
| 112 | 112 | // try { |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | throw new \Exception(__METHOD__." expects a YamlObject as parent", 1); |
| 40 | 40 | } |
| 41 | 41 | if (!is_null($this->value)) { |
| 42 | - if ($this->value instanceof Tag){ |
|
| 42 | + if ($this->value instanceof Tag) { |
|
| 43 | 43 | preg_match(Regex::TAG_PARTS, $this->value->raw, $tagparts); |
| 44 | 44 | if (preg_match("/(?(DEFINE)".Regex::TAG_URI.')(?&url)/', $tagparts['tagname'], $matches)) { |
| 45 | 45 | // throw new \UnexpectedValueException("Tag '".$this->value->raw."' is invalid", 1); |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | } catch (\UnexpectedValueException $e) { |
| 60 | 60 | return new Tagged($this->tag, is_null($value) ? null : $this->value->build($parent)); |
| 61 | 61 | } catch (\Throwable $e) { |
| 62 | - throw new \Exception("Tagged value could not be transformed for tag '$this->tag'", 1, $e);; |
|
| 62 | + throw new \Exception("Tagged value could not be transformed for tag '$this->tag'", 1, $e); ; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | \ No newline at end of file |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | $previousCompactMode = $this->dumper->_compactMode; |
| 104 | - $this->dumper->_compactMode = true; |
|
| 104 | + $this->dumper->_compactMode = true; |
|
| 105 | 105 | $result = $this->dumper->iteratorToString(new \ArrayIterator($source), $keyMask, ', ', $indent); |
| 106 | 106 | $this->dumper->_compactMode = $previousCompactMode; |
| 107 | 107 | return sprintf($structureFormat, $result); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | // Example 5.13. Escaped Characters |
| 124 | 124 | |
| 125 | 125 | $str = json_encode(ltrim($str)); |
| 126 | - return strspn(substr($str,1,-1), "-:?{}[]#,&*!>|'\"%") > 0 ? $str : trim($str, '"'); |
|
| 126 | + return strspn(substr($str, 1, -1), "-:?{}[]#,&*!>|'\"%") > 0 ? $str : trim($str, '"'); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | public function dumpTagged(Tagged $obj, int $indent):string |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | private $handler; |
| 32 | 32 | |
| 33 | 33 | |
| 34 | - public function __construct($options=null) |
|
| 34 | + public function __construct($options = null) |
|
| 35 | 35 | { |
| 36 | 36 | $this->options = is_int($options) ? $options : self::OPTIONS; |
| 37 | 37 | $this->handler = new DumperHandlers($this); |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | if (empty($dataType)) throw new \Exception(self::class.": No content to convert to Yaml"); |
| 52 | 52 | if (is_scalar($dataType)) { |
| 53 | - return "--- ".$this->handler->dumpScalar($dataType). self::LINEFEED ; |
|
| 53 | + return "--- ".$this->handler->dumpScalar($dataType).self::LINEFEED; |
|
| 54 | 54 | } |
| 55 | 55 | return $this->dump($dataType, 0); |
| 56 | 56 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | public function getTargetOnLessIndent(NodeGeneric &$node):NodeGeneric |
| 52 | 52 | { |
| 53 | - if ($node instanceof Scalar || $node instanceof Blank ) { |
|
| 53 | + if ($node instanceof Scalar || $node instanceof Blank) { |
|
| 54 | 54 | return $this->getParent(); |
| 55 | 55 | } else { |
| 56 | 56 | return $this->getParent($node->indent); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | \.nan | \.NaN | \.NAN tag:yaml.org,2002:float (Not a number) |
| 98 | 98 | * tag:yaml.org,2002:str (Default) |
| 99 | 99 | */ |
| 100 | - if (Regex::isDate($v)) return ($this->getRoot()->getYamlObject()->getOptions() & Loader::NO_OBJECT_FOR_DATE) && !$onlyScalar ? date_create($v) : $v; |
|
| 100 | + if (Regex::isDate($v)) return ($this->getRoot()->getYamlObject()->getOptions()&Loader::NO_OBJECT_FOR_DATE) && !$onlyScalar ? date_create($v) : $v; |
|
| 101 | 101 | if (Regex::isNumber($v)) return $this->getNumber($v); |
| 102 | 102 | $types = ['yes' => true, |
| 103 | 103 | 'no' => false, |
@@ -111,12 +111,12 @@ discard block |
||
| 111 | 111 | return array_key_exists(strtolower($v), $types) ? $types[strtolower($v)] : $this->replaceSequences($v); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - public function replaceSequences($value='') |
|
| 114 | + public function replaceSequences($value = '') |
|
| 115 | 115 | { |
| 116 | - $replaceUnicodeSeq = function ($matches) { |
|
| 116 | + $replaceUnicodeSeq = function($matches) { |
|
| 117 | 117 | return json_decode('"'.$matches[1].'"'); |
| 118 | 118 | }; |
| 119 | - $replaceNonPrintable = function ($matches) { |
|
| 119 | + $replaceNonPrintable = function($matches) { |
|
| 120 | 120 | // var_dump($matches[1]); |
| 121 | 121 | return $matches[1].""; |
| 122 | 122 | }; |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | // var_dump($yamlObject);exit(); |
| 20 | 20 | return $yamlObject->getReference($name); |
| 21 | 21 | } catch (\Throwable $e) { |
| 22 | - throw new \ParseError("Unknown anchor : '$name' this:".$this->anchor,1,$e); |
|
| 22 | + throw new \ParseError("Unknown anchor : '$name' this:".$this->anchor, 1, $e); |
|
| 23 | 23 | } |
| 24 | 24 | } else { |
| 25 | 25 | $built = is_null($this->value) ? null : $this->value->build($parent); |
@@ -96,7 +96,7 @@ |
||
| 96 | 96 | * @return string The child value. |
| 97 | 97 | * @todo double check behaviour for KEY and ITEM |
| 98 | 98 | */ |
| 99 | - protected function getChildValue($child, $refIndent=0):string |
|
| 99 | + protected function getChildValue($child, $refIndent = 0):string |
|
| 100 | 100 | { |
| 101 | 101 | $value = $child->value; |
| 102 | 102 | $start = ''; |