@@ -16,8 +16,8 @@ |
||
| 16 | 16 | class Directive extends NodeGeneric |
| 17 | 17 | { |
| 18 | 18 | private const ERROR_BUILDING = "Error : can not build Directive"; |
| 19 | - private const WARNING_LOWER_VERSION = "The declared version '%s' is obsolete, there may be features that are deprecated and therefore not handled, minimum supported is: " . Yaml::VERSION_SUPPORT; |
|
| 20 | - private const WARNING_HIGHER_VERSION = "The declared version '%s' is not yet supported, minimum supported is: " . Yaml::VERSION_SUPPORT; |
|
| 19 | + private const WARNING_LOWER_VERSION = "The declared version '%s' is obsolete, there may be features that are deprecated and therefore not handled, minimum supported is: ".Yaml::VERSION_SUPPORT; |
|
| 20 | + private const WARNING_HIGHER_VERSION = "The declared version '%s' is not yet supported, minimum supported is: ".Yaml::VERSION_SUPPORT; |
|
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Builds a Directive : update YamlObject if applicable. |
@@ -18,11 +18,11 @@ discard block |
||
| 18 | 18 | if ($this->_parent instanceof NodeGeneric) { |
| 19 | 19 | return $this->_parent->add($child); |
| 20 | 20 | } else { |
| 21 | - throw new \ParseError(__METHOD__ . " no parent to add to", 1); |
|
| 21 | + throw new \ParseError(__METHOD__." no parent to add to", 1); |
|
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - public function specialProcess(NodeGeneric &$previous, array &$emptyLines): bool |
|
| 25 | + public function specialProcess(NodeGeneric&$previous, array &$emptyLines): bool |
|
| 26 | 26 | { |
| 27 | 27 | $deepest = $previous->getDeepestNode(); |
| 28 | 28 | if ($previous instanceof Scalar) { |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | return "\n"; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | - public function getTargetOnEqualIndent(NodeGeneric &$node): ?NodeGeneric |
|
| 41 | + public function getTargetOnEqualIndent(NodeGeneric&$node): ?NodeGeneric |
|
| 42 | 42 | { |
| 43 | 43 | return $this->getParent($node->indent); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function getTargetOnMoreIndent(NodeGeneric &$node): ?NodeGeneric |
|
| 46 | + public function getTargetOnMoreIndent(NodeGeneric&$node): ?NodeGeneric |
|
| 47 | 47 | { |
| 48 | 48 | return $this->getParent($node->indent); |
| 49 | 49 | } |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | public function build(&$parent = null) |
| 38 | 38 | { |
| 39 | 39 | if (is_null($parent)) { |
| 40 | - throw new \Exception(__METHOD__ . " expects a YamlObject as parent", 1); |
|
| 40 | + throw new \Exception(__METHOD__." expects a YamlObject as parent", 1); |
|
| 41 | 41 | } |
| 42 | 42 | if (!is_null($this->value)) { |
| 43 | 43 | if ($this->value instanceof Tag) { |
| 44 | 44 | preg_match(Regex::TAG_PARTS, $this->value->raw, $tagparts); |
| 45 | - if (preg_match("/(?(DEFINE)" . Regex::TAG_URI . ')(?&url)/', $tagparts['tagname'], $matches)) { |
|
| 45 | + if (preg_match("/(?(DEFINE)".Regex::TAG_URI.')(?&url)/', $tagparts['tagname'], $matches)) { |
|
| 46 | 46 | // throw new \UnexpectedValueException("Tag '".$this->value->raw."' is invalid", 1); |
| 47 | 47 | $parent->addTag($tagparts['handle'], $tagparts['tagname']); |
| 48 | 48 | // var_dump('HERE'); |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | return $this->value instanceof NodeGeneric && $this->value->isOneOf('Anchor', 'Literal', 'LiteralFolded'); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function getTargetOnEqualIndent(NodeGeneric &$node): NodeGeneric |
|
| 66 | + public function getTargetOnEqualIndent(NodeGeneric&$node): NodeGeneric |
|
| 67 | 67 | { |
| 68 | 68 | if ($this->value instanceof NodeGeneric) { |
| 69 | 69 | if ($this->value instanceof Tag) { |
| 70 | - if (!preg_match("/" . Regex::TAG_URI . "/", $this->value->raw)) { |
|
| 70 | + if (!preg_match("/".Regex::TAG_URI."/", $this->value->raw)) { |
|
| 71 | 71 | return $this->value; |
| 72 | 72 | } |
| 73 | 73 | } elseif ($this->value->isAwaitingChild($node)) { |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | return $value->add($child); |
| 38 | 38 | } else { |
| 39 | 39 | // throw new \ParseError('key ('.$value->identifier.')@'.$value->line.' has already a value', 1); |
| 40 | - throw new \ParseError('key @' . $value->line . ' has already a value', 1); |
|
| 40 | + throw new \ParseError('key @'.$value->line.' has already a value', 1); |
|
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | return parent::add($child); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function getTargetOnEqualIndent(NodeGeneric &$node): NodeGeneric |
|
| 46 | + public function getTargetOnEqualIndent(NodeGeneric&$node): NodeGeneric |
|
| 47 | 47 | { |
| 48 | 48 | $supposedParent = $this->getParent(); |
| 49 | 49 | if ($node->indent === $supposedParent->indent) { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | return $supposedParent; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - public function getTargetOnMoreIndent(NodeGeneric &$node): NodeGeneric |
|
| 55 | + public function getTargetOnMoreIndent(NodeGeneric&$node): NodeGeneric |
|
| 56 | 56 | { |
| 57 | 57 | return $this->value instanceof NodeGeneric && $this->value->isAwaitingChild($node) ? $this->value : $this; |
| 58 | 58 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | public function build(&$parent = null) |
| 69 | 69 | { |
| 70 | 70 | if (!is_null($parent) && !is_array($parent) && !($parent instanceof YamlObject)) { |
| 71 | - throw new \Exception("parent must be an array or YamlObject not " . |
|
| 71 | + throw new \Exception("parent must be an array or YamlObject not ". |
|
| 72 | 72 | (is_object($parent) ? get_class($parent) : gettype($parent))); |
| 73 | 73 | } |
| 74 | 74 | $value = $this->value ? $this->value->build() : null; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | */ |
| 16 | 16 | class Key extends NodeGeneric |
| 17 | 17 | { |
| 18 | - const ERROR_NO_KEYNAME = self::class . ": key has NO IDENTIFIER on line %d"; |
|
| 18 | + const ERROR_NO_KEYNAME = self::class.": key has NO IDENTIFIER on line %d"; |
|
| 19 | 19 | |
| 20 | 20 | public function __construct(string $nodeString, int $line, array $matches = null) |
| 21 | 21 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - public function getTargetOnEqualIndent(NodeGeneric &$node): NodeGeneric |
|
| 66 | + public function getTargetOnEqualIndent(NodeGeneric&$node): NodeGeneric |
|
| 67 | 67 | { |
| 68 | 68 | if ($node instanceof Item) { |
| 69 | 69 | return $this; |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | return $this->getParent(); |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - public function getTargetOnMoreIndent(NodeGeneric &$node): NodeGeneric |
|
| 74 | + public function getTargetOnMoreIndent(NodeGeneric&$node): NodeGeneric |
|
| 75 | 75 | { |
| 76 | 76 | if (!is_null($this->value)) { |
| 77 | 77 | if ($this->getDeepestNode()->isAwaitingChild($node)) { |
@@ -29,7 +29,7 @@ |
||
| 29 | 29 | $value = "\n"; |
| 30 | 30 | if (!($child instanceof Blank)) { |
| 31 | 31 | $newIndent = $indent > 0 ? $child->indent - $indent : 0; |
| 32 | - $value .= str_repeat(' ', $newIndent) . $this->getChildValue($child, $indent); |
|
| 32 | + $value .= str_repeat(' ', $newIndent).$this->getChildValue($child, $indent); |
|
| 33 | 33 | } |
| 34 | 34 | $result .= $value; |
| 35 | 35 | } |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @return boolean true to skip normal Loader process, false to continue |
| 23 | 23 | */ |
| 24 | - public function specialProcess(NodeGeneric &$current, array &$emptyLines): bool |
|
| 24 | + public function specialProcess(NodeGeneric&$current, array &$emptyLines): bool |
|
| 25 | 25 | { |
| 26 | 26 | $parent = $this->getParent(); |
| 27 | 27 | $addValue = ltrim($current->raw); |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $addValue = "\n"; |
| 34 | 34 | $separator = ''; |
| 35 | 35 | } |
| 36 | - $node = NodeFactory::get($this->raw . $separator . $addValue, $this->line); |
|
| 36 | + $node = NodeFactory::get($this->raw.$separator.$addValue, $this->line); |
|
| 37 | 37 | $node->indent = null; |
| 38 | 38 | $parent->value = null; |
| 39 | 39 | $parent->add($node); |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | try { |
| 22 | 22 | return $yamlObject->getReference($name); |
| 23 | 23 | } catch (\Throwable $e) { |
| 24 | - throw new \ParseError("Unknown anchor : '$name' this:" . $this->anchor, 1, $e); |
|
| 24 | + throw new \ParseError("Unknown anchor : '$name' this:".$this->anchor, 1, $e); |
|
| 25 | 25 | } |
| 26 | 26 | } else { |
| 27 | 27 | $built = is_null($this->value) ? null : $this->value->build($parent); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | if ($child->indent > $indent || $child instanceof Blank) { |
| 36 | 36 | $separator = "\n"; |
| 37 | 37 | } |
| 38 | - $result .= $separator . $this->getChildValue($child, $indent); |
|
| 38 | + $result .= $separator.$this->getChildValue($child, $indent); |
|
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | return $result; |