@@ -14,10 +14,10 @@ discard block |
||
| 14 | 14 | const AN = "[\w ]+"; |
| 15 | 15 | const NUM = "-?[\d.e]+"; |
| 16 | 16 | const SIMPLE = "(?P<sv>".self::NULL."|". |
| 17 | - self::FALSE."|". |
|
| 18 | - self::TRUE."|". |
|
| 19 | - self::AN."|". |
|
| 20 | - self::NUM.")"; |
|
| 17 | + self::FALSE."|". |
|
| 18 | + self::TRUE."|". |
|
| 19 | + self::AN."|". |
|
| 20 | + self::NUM.")"; |
|
| 21 | 21 | private const seqForMap = "(?P<seq>\[(?:(?:(?P>sv)|(?P>seq)|(?P>map)),?\s*)+\])"; |
| 22 | 22 | private const mapForSeq = "(?P<map>{\s*(?:".self::AN."\s*:\s*(?:(?P>sv)|(?P>seq)|(?P>map)),?\s*)+})"; |
| 23 | 23 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $matchSpaced = preg_match($spaced, $v); |
| 42 | 42 | $matchIso = preg_match($iso8601, $v); |
| 43 | 43 | if (is_bool($matchDate) || is_bool($matchCanonical) || is_bool($matchSpaced) || is_bool($matchIso)) |
| 44 | - throw new \Exception("Regex date error"); |
|
| 44 | + throw new \Exception("Regex date error"); |
|
| 45 | 45 | |
| 46 | 46 | return $matchDate || $matchCanonical || $matchSpaced || $matchIso; |
| 47 | 47 | } |
@@ -2,15 +2,15 @@ |
||
| 2 | 2 | namespace Dallgoot\Yaml; |
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | - * The returned object representing a YAML file content |
|
| 6 | - * |
|
| 7 | - * @method void addReference(string $name, $value) |
|
| 8 | - * @method mixed getReference(string $name) |
|
| 9 | - * @method array getAllReferences() |
|
| 10 | - * @method void addComment($index, $value) |
|
| 11 | - * @method string|array getComment($lineNumber) |
|
| 12 | - * @method void setText(string $value) |
|
| 13 | - * @method void addTag(string $value) |
|
| 5 | + * The returned object representing a YAML file content |
|
| 6 | + * |
|
| 7 | + * @method void addReference(string $name, $value) |
|
| 8 | + * @method mixed getReference(string $name) |
|
| 9 | + * @method array getAllReferences() |
|
| 10 | + * @method void addComment($index, $value) |
|
| 11 | + * @method string|array getComment($lineNumber) |
|
| 12 | + * @method void setText(string $value) |
|
| 13 | + * @method void addTag(string $value) |
|
| 14 | 14 | */ |
| 15 | 15 | class YamlObject extends \ArrayIterator implements \JsonSerializable |
| 16 | 16 | { |
@@ -288,13 +288,13 @@ |
||
| 288 | 288 | private static function getScalar(string $v) |
| 289 | 289 | { |
| 290 | 290 | $types = ['yes' => true, |
| 291 | - 'no' => false, |
|
| 292 | - 'true' => true, |
|
| 293 | - 'false' => false, |
|
| 294 | - 'null' => null, |
|
| 295 | - '.inf' => INF, |
|
| 296 | - '-.inf' => -INF, |
|
| 297 | - '.nan' => NAN |
|
| 291 | + 'no' => false, |
|
| 292 | + 'true' => true, |
|
| 293 | + 'false' => false, |
|
| 294 | + 'null' => null, |
|
| 295 | + '.inf' => INF, |
|
| 296 | + '-.inf' => -INF, |
|
| 297 | + '.nan' => NAN |
|
| 298 | 298 | ]; |
| 299 | 299 | if (isset($types[strtolower($v)])) return $types[strtolower($v)]; |
| 300 | 300 | if (R::isDate($v)) return date_create($v); |
@@ -8,18 +8,18 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | class Compact extends \ArrayIterator implements \JsonSerializable |
| 10 | 10 | { |
| 11 | - // private static $value; |
|
| 12 | - // public function __construct($argument) |
|
| 13 | - // { |
|
| 14 | - // self::$value = $argument; |
|
| 15 | - // // if ($argument instanceof \Countable && count($argument) > 0) { |
|
| 16 | - // // # it's an array-like |
|
| 17 | - // // } else { |
|
| 18 | - // // //it's an object-like |
|
| 19 | - // // } |
|
| 20 | - // } |
|
| 21 | - // |
|
| 22 | - public function __construct() |
|
| 11 | + // private static $value; |
|
| 12 | + // public function __construct($argument) |
|
| 13 | + // { |
|
| 14 | + // self::$value = $argument; |
|
| 15 | + // // if ($argument instanceof \Countable && count($argument) > 0) { |
|
| 16 | + // // # it's an array-like |
|
| 17 | + // // } else { |
|
| 18 | + // // //it's an object-like |
|
| 19 | + // // } |
|
| 20 | + // } |
|
| 21 | + // |
|
| 22 | + public function __construct() |
|
| 23 | 23 | { |
| 24 | 24 | parent::__construct([], 1);//1 = Array indices can be accessed as properties in read/write. |
| 25 | 25 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | public static function wrap($arrayOrObject) |
| 35 | 35 | { |
| 36 | - // |
|
| 37 | - return $this; |
|
| 36 | + // |
|
| 37 | + return $this; |
|
| 38 | 38 | } |
| 39 | 39 | } |