@@ -41,7 +41,7 @@ |
||
| 41 | 41 | self::$options = is_int($options) ? $options : self::OPTIONS; |
| 42 | 42 | $dumpHandler = new DumperHandlers($options); |
| 43 | 43 | if (is_scalar($dataType)) { |
| 44 | - return "--- ".$dumpHandler->dumpScalar($dataType). self::LINEFEED ; |
|
| 44 | + return "--- ".$dumpHandler->dumpScalar($dataType).self::LINEFEED; |
|
| 45 | 45 | } |
| 46 | 46 | return $dumpHandler->dump($dataType, 0); |
| 47 | 47 | } |
@@ -190,7 +190,7 @@ |
||
| 190 | 190 | // \x20 \xA0 \x85 \u2028 \u2029 |
| 191 | 191 | // A A A" |
| 192 | 192 | $str = json_encode(ltrim($str)); |
| 193 | - return strspn(substr($str,1,-1), "-:?{}[]#,&*!>|'\"%") > 0 ? $str : trim($str, '"'); |
|
| 193 | + return strspn(substr($str, 1, -1), "-:?{}[]#,&*!>|'\"%") > 0 ? $str : trim($str, '"'); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | public function dumpTagged(Tagged $obj, int $indent):string |
@@ -12,6 +12,6 @@ |
||
| 12 | 12 | { |
| 13 | 13 | public function build(&$parent = null) |
| 14 | 14 | { |
| 15 | - return substr(Scalar::replaceSequences(trim($this->raw)), 1,-1); |
|
| 15 | + return substr(Scalar::replaceSequences(trim($this->raw)), 1, -1); |
|
| 16 | 16 | } |
| 17 | 17 | } |
| 18 | 18 | \ No newline at end of file |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | public function getTargetOnLessIndent(NodeGeneric &$node):NodeGeneric |
| 51 | 51 | { |
| 52 | - if ($node instanceof Scalar || $node instanceof Blank ) { |
|
| 52 | + if ($node instanceof Scalar || $node instanceof Blank) { |
|
| 53 | 53 | return $this->getParent(); |
| 54 | 54 | } else { |
| 55 | 55 | return $this->getParent($node->indent); |
@@ -110,12 +110,12 @@ discard block |
||
| 110 | 110 | return array_key_exists(strtolower($v), $types) ? $types[strtolower($v)] : self::replaceSequences($v); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - public function replaceSequences($value='') |
|
| 113 | + public function replaceSequences($value = '') |
|
| 114 | 114 | { |
| 115 | - $replaceUnicodeSeq = function ($matches) { |
|
| 115 | + $replaceUnicodeSeq = function($matches) { |
|
| 116 | 116 | return json_decode('"'.$matches[1].'"'); |
| 117 | 117 | }; |
| 118 | - $replaceNonPrintable = function ($matches) { |
|
| 118 | + $replaceNonPrintable = function($matches) { |
|
| 119 | 119 | // var_dump($matches[1]); |
| 120 | 120 | return $matches[1].""; |
| 121 | 121 | }; |
@@ -6,18 +6,18 @@ |
||
| 6 | 6 | /** |
| 7 | 7 | * Display some use cases for Yaml library |
| 8 | 8 | */ |
| 9 | -const JSON_OPTIONS = JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_LINE_TERMINATORS | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION | JSON_PARTIAL_OUTPUT_ON_ERROR; |
|
| 9 | +const JSON_OPTIONS = JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_LINE_TERMINATORS|JSON_UNESCAPED_UNICODE|JSON_PRESERVE_ZERO_FRACTION|JSON_PARTIAL_OUTPUT_ON_ERROR; |
|
| 10 | 10 | |
| 11 | 11 | $debug = (int) (isset($argv[1]) ? $argv[1] : null); |
| 12 | 12 | |
| 13 | -echo memory_get_usage() . "\n"; |
|
| 13 | +echo memory_get_usage()."\n"; |
|
| 14 | 14 | /* USE CASE 1 |
| 15 | 15 | * load and parse if file exists |
| 16 | 16 | */ |
| 17 | -$content = file_get_contents('./tests/cases/examples/Example_2_25.yml');//var_dump($content); |
|
| 17 | +$content = file_get_contents('./tests/cases/examples/Example_2_25.yml'); //var_dump($content); |
|
| 18 | 18 | $yaml = Yaml::parse($content, 0, $debug); |
| 19 | 19 | |
| 20 | -echo memory_get_usage() . "\n"; |
|
| 20 | +echo memory_get_usage()."\n"; |
|
| 21 | 21 | // var_dump($yaml); |
| 22 | 22 | var_dump(json_encode($yaml, JSON_OPTIONS)); |
| 23 | 23 | exit(0); |
@@ -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,13 +14,13 @@ discard block |
||
| 14 | 14 | // $yaml = (new Loader('./dummy.yml', null, 0))->parse(); |
| 15 | 15 | // var_dump($yaml); |
| 16 | 16 | $testName = 'yamlObject_properties'; |
| 17 | -$yamlObject = (include PROJECT_ROOT . "tests/cases/dumping/$testName.php"); |
|
| 18 | -echo memory_get_usage() . "\n"; |
|
| 17 | +$yamlObject = (include PROJECT_ROOT."tests/cases/dumping/$testName.php"); |
|
| 18 | +echo memory_get_usage()."\n"; |
|
| 19 | 19 | |
| 20 | 20 | $text = Yaml::dump($yamlObject, 0); |
| 21 | 21 | |
| 22 | -echo memory_get_usage() . "\n"; |
|
| 23 | -$nameResultPair = get_object_vars(/** @scrutinizer ignore-type */ Yaml::parseFile(PROJECT_ROOT . 'tests/definitions/dumping_tests.yml')); |
|
| 22 | +echo memory_get_usage()."\n"; |
|
| 23 | +$nameResultPair = get_object_vars(/** @scrutinizer ignore-type */ Yaml::parseFile(PROJECT_ROOT.'tests/definitions/dumping_tests.yml')); |
|
| 24 | 24 | |
| 25 | 25 | // var_dump($nameResultPair); |
| 26 | 26 | |