@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function dump($dataType, int $indent):string |
| 34 | 34 | { |
| 35 | - if(is_null($dataType)) { |
|
| 35 | + if (is_null($dataType)) { |
|
| 36 | 36 | return ''; |
| 37 | - } elseif(is_resource($dataType)) { |
|
| 37 | + } elseif (is_resource($dataType)) { |
|
| 38 | 38 | return get_resource_type($dataType); |
| 39 | 39 | } elseif (is_scalar($dataType)) { |
| 40 | 40 | return $this->dumpScalar($dataType, $indent); |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
| 104 | - private function iteratorToString(iterable $iterator, string $mask, int $indent, bool $isCompact=false):string |
|
| 104 | + private function iteratorToString(iterable $iterator, string $mask, int $indent, bool $isCompact = false):string |
|
| 105 | 105 | { |
| 106 | 106 | $pairs = []; |
| 107 | 107 | foreach (new \ArrayIterator($iterator) as $key => $value) { |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | if (is_array($subject) || $subject instanceof \ArrayIterator) { |
| 134 | 134 | $max = count($subject); |
| 135 | 135 | $objectAsArray = is_array($subject) ? $subject : $subject->getArrayCopy(); |
| 136 | - if(array_keys($objectAsArray) !== range(0, $max-1)) { |
|
| 136 | + if (array_keys($objectAsArray) !== range(0, $max - 1)) { |
|
| 137 | 137 | $pairs = $objectAsArray; |
| 138 | 138 | } else { |
| 139 | 139 | $valuesList = []; |
@@ -94,7 +94,7 @@ |
||
| 94 | 94 | * @return string The child value. |
| 95 | 95 | * @todo double check behaviour for KEY and ITEM |
| 96 | 96 | */ |
| 97 | - protected function getChildValue(object $child, $refIndent=0):string |
|
| 97 | + protected function getChildValue(object $child, $refIndent = 0):string |
|
| 98 | 98 | { |
| 99 | 99 | $value = $child->value; |
| 100 | 100 | $start = ''; |
@@ -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) { |
@@ -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 | if (!preg_match(Regex::TAG_PARTS, $this->value->raw, $matches)) { |
| 44 | 44 | throw new \InvalidValueException("Tag '$this->value->raw' is invalid", 1); |
| 45 | 45 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | define('PROJECT_ROOT', __DIR__."/../"); |
| 3 | 3 | |
| 4 | -require_once PROJECT_ROOT . 'vendor/autoload.php'; |
|
| 4 | +require_once PROJECT_ROOT.'vendor/autoload.php'; |
|
| 5 | 5 | |
| 6 | 6 | use Dallgoot\Yaml; |
| 7 | 7 | // use Dallgoot\Yaml\{Loader, Dumper}; |
@@ -14,9 +14,9 @@ discard block |
||
| 14 | 14 | // $yaml = (new Loader('./dummy.yml', null, 0))->parse(); |
| 15 | 15 | // var_dump($yaml); |
| 16 | 16 | $testName = 'yamlObject_properties'; |
| 17 | -$text = Yaml::dump((include PROJECT_ROOT . "tests/cases/dumping/$testName.php"), 0); |
|
| 17 | +$text = Yaml::dump((include PROJECT_ROOT."tests/cases/dumping/$testName.php"), 0); |
|
| 18 | 18 | |
| 19 | -$nameResultPair = get_object_vars(Yaml::parseFile(PROJECT_ROOT . 'tests/definitions/dumping_tests.yml')); |
|
| 19 | +$nameResultPair = get_object_vars(Yaml::parseFile(PROJECT_ROOT.'tests/definitions/dumping_tests.yml')); |
|
| 20 | 20 | |
| 21 | 21 | // var_dump($nameResultPair); |
| 22 | 22 | |