@@ -43,35 +43,35 @@ discard block |
||
43 | 43 | /** |
44 | 44 | * {@inheritdoc} |
45 | 45 | */ |
46 | - public function addSchema($id, $schema = null) |
|
46 | + public function addSchema( $id, $schema = null ) |
|
47 | 47 | { |
48 | - if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) { |
|
48 | + if ( is_null( $schema ) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI ) { |
|
49 | 49 | // if the schema was user-provided to Validator and is still null, then assume this is |
50 | 50 | // what the user intended, as there's no way for us to retrieve anything else. User-supplied |
51 | 51 | // schemas do not have an associated URI when passed via Validator::validate(). |
52 | - $schema = $this->uriRetriever->retrieve($id); |
|
52 | + $schema = $this->uriRetriever->retrieve( $id ); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // cast array schemas to object |
56 | - if (is_array($schema)) { |
|
57 | - $schema = BaseConstraint::arrayToObjectRecursive($schema); |
|
56 | + if ( is_array( $schema ) ) { |
|
57 | + $schema = BaseConstraint::arrayToObjectRecursive( $schema ); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | // workaround for bug in draft-03 & draft-04 meta-schemas (id & $ref defined with incorrect format) |
61 | 61 | // see https://github.com/json-schema-org/JSON-Schema-Test-Suite/issues/177#issuecomment-293051367 |
62 | - if (is_object($schema) && property_exists($schema, 'id')) { |
|
63 | - if ($schema->id == 'http://json-schema.org/draft-04/schema#') { |
|
62 | + if ( is_object( $schema ) && property_exists( $schema, 'id' ) ) { |
|
63 | + if ( $schema->id == 'http://json-schema.org/draft-04/schema#' ) { |
|
64 | 64 | $schema->properties->id->format = 'uri-reference'; |
65 | - } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') { |
|
65 | + } elseif ( $schema->id == 'http://json-schema.org/draft-03/schema#' ) { |
|
66 | 66 | $schema->properties->id->format = 'uri-reference'; |
67 | 67 | $schema->properties->{'$ref'}->format = 'uri-reference'; |
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
71 | 71 | // resolve references |
72 | - $this->expandRefs($schema, $id); |
|
72 | + $this->expandRefs( $schema, $id ); |
|
73 | 73 | |
74 | - $this->schemas[$id] = $schema; |
|
74 | + $this->schemas[ $id ] = $schema; |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -80,73 +80,73 @@ discard block |
||
80 | 80 | * @param mixed $schema |
81 | 81 | * @param string $base |
82 | 82 | */ |
83 | - private function expandRefs(&$schema, $base = null) |
|
83 | + private function expandRefs( &$schema, $base = null ) |
|
84 | 84 | { |
85 | - if (!is_object($schema)) { |
|
86 | - if (is_array($schema)) { |
|
87 | - foreach ($schema as &$member) { |
|
88 | - $this->expandRefs($member, $base); |
|
85 | + if ( ! is_object( $schema ) ) { |
|
86 | + if ( is_array( $schema ) ) { |
|
87 | + foreach ( $schema as &$member ) { |
|
88 | + $this->expandRefs( $member, $base ); |
|
89 | 89 | } |
90 | 90 | } |
91 | 91 | |
92 | 92 | return; |
93 | 93 | } |
94 | 94 | |
95 | - if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) { |
|
96 | - $base = $this->uriResolver->resolve($schema->id, $base); |
|
95 | + if ( property_exists( $schema, 'id' ) && is_string( $schema->id ) && $base != $schema->id ) { |
|
96 | + $base = $this->uriResolver->resolve( $schema->id, $base ); |
|
97 | 97 | } |
98 | 98 | |
99 | - if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) { |
|
100 | - $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base)); |
|
101 | - $schema->{'$ref'} = (string) $refPointer; |
|
99 | + if ( property_exists( $schema, '$ref' ) && is_string( $schema->{'$ref'}) ) { |
|
100 | + $refPointer = new JsonPointer( $this->uriResolver->resolve( $schema->{'$ref'}, $base ) ); |
|
101 | + $schema->{'$ref'} = (string)$refPointer; |
|
102 | 102 | } |
103 | 103 | |
104 | - foreach ($schema as &$member) { |
|
105 | - $this->expandRefs($member, $base); |
|
104 | + foreach ( $schema as &$member ) { |
|
105 | + $this->expandRefs( $member, $base ); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | 110 | * {@inheritdoc} |
111 | 111 | */ |
112 | - public function getSchema($id) |
|
112 | + public function getSchema( $id ) |
|
113 | 113 | { |
114 | - if (!array_key_exists($id, $this->schemas)) { |
|
115 | - $this->addSchema($id); |
|
114 | + if ( ! array_key_exists( $id, $this->schemas ) ) { |
|
115 | + $this->addSchema( $id ); |
|
116 | 116 | } |
117 | 117 | |
118 | - return $this->schemas[$id]; |
|
118 | + return $this->schemas[ $id ]; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | /** |
122 | 122 | * {@inheritdoc} |
123 | 123 | */ |
124 | - public function resolveRef($ref) |
|
124 | + public function resolveRef( $ref ) |
|
125 | 125 | { |
126 | - $jsonPointer = new JsonPointer($ref); |
|
126 | + $jsonPointer = new JsonPointer( $ref ); |
|
127 | 127 | |
128 | 128 | // resolve filename for pointer |
129 | 129 | $fileName = $jsonPointer->getFilename(); |
130 | - if (!strlen($fileName)) { |
|
131 | - throw new UnresolvableJsonPointerException(sprintf( |
|
130 | + if ( ! strlen( $fileName ) ) { |
|
131 | + throw new UnresolvableJsonPointerException( sprintf( |
|
132 | 132 | "Could not resolve fragment '%s': no file is defined", |
133 | 133 | $jsonPointer->getPropertyPathAsString() |
134 | - )); |
|
134 | + ) ); |
|
135 | 135 | } |
136 | 136 | |
137 | 137 | // get & process the schema |
138 | - $refSchema = $this->getSchema($fileName); |
|
139 | - foreach ($jsonPointer->getPropertyPaths() as $path) { |
|
140 | - if (is_object($refSchema) && property_exists($refSchema, $path)) { |
|
141 | - $refSchema = $this->resolveRefSchema($refSchema->{$path}); |
|
142 | - } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) { |
|
143 | - $refSchema = $this->resolveRefSchema($refSchema[$path]); |
|
138 | + $refSchema = $this->getSchema( $fileName ); |
|
139 | + foreach ( $jsonPointer->getPropertyPaths() as $path ) { |
|
140 | + if ( is_object( $refSchema ) && property_exists( $refSchema, $path ) ) { |
|
141 | + $refSchema = $this->resolveRefSchema( $refSchema->{$path}); |
|
142 | + } elseif ( is_array( $refSchema ) && array_key_exists( $path, $refSchema ) ) { |
|
143 | + $refSchema = $this->resolveRefSchema( $refSchema[ $path ] ); |
|
144 | 144 | } else { |
145 | - throw new UnresolvableJsonPointerException(sprintf( |
|
145 | + throw new UnresolvableJsonPointerException( sprintf( |
|
146 | 146 | 'File: %s is found, but could not resolve fragment: %s', |
147 | 147 | $jsonPointer->getFilename(), |
148 | 148 | $jsonPointer->getPropertyPathAsString() |
149 | - )); |
|
149 | + ) ); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | /** |
157 | 157 | * {@inheritdoc} |
158 | 158 | */ |
159 | - public function resolveRefSchema($refSchema) |
|
159 | + public function resolveRefSchema( $refSchema ) |
|
160 | 160 | { |
161 | - if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) { |
|
162 | - $newSchema = $this->resolveRef($refSchema->{'$ref'}); |
|
163 | - $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema)); |
|
164 | - unset($refSchema->{'$ref'}); |
|
161 | + if ( is_object( $refSchema ) && property_exists( $refSchema, '$ref' ) && is_string( $refSchema->{'$ref'}) ) { |
|
162 | + $newSchema = $this->resolveRef( $refSchema->{'$ref'}); |
|
163 | + $refSchema = (object)( get_object_vars( $refSchema ) + get_object_vars( $newSchema ) ); |
|
164 | + unset( $refSchema->{'$ref'}); |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | return $refSchema; |
@@ -13,13 +13,13 @@ |
||
13 | 13 | * @param (Identifier|Name)[] $types Types |
14 | 14 | * @param array $attributes Additional attributes |
15 | 15 | */ |
16 | - public function __construct(array $types, array $attributes = []) { |
|
16 | + public function __construct( array $types, array $attributes = [ ] ) { |
|
17 | 17 | $this->attributes = $attributes; |
18 | 18 | $this->types = $types; |
19 | 19 | } |
20 | 20 | |
21 | 21 | public function getSubNodeNames() : array { |
22 | - return ['types']; |
|
22 | + return [ 'types' ]; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function getType() : string { |
@@ -16,13 +16,13 @@ |
||
16 | 16 | * @param Expr[] $parts Encaps list |
17 | 17 | * @param array $attributes Additional attributes |
18 | 18 | */ |
19 | - public function __construct(array $parts, array $attributes = []) { |
|
19 | + public function __construct( array $parts, array $attributes = [ ] ) { |
|
20 | 20 | $this->attributes = $attributes; |
21 | 21 | $this->parts = $parts; |
22 | 22 | } |
23 | 23 | |
24 | 24 | public function getSubNodeNames() : array { |
25 | - return ['parts']; |
|
25 | + return [ 'parts' ]; |
|
26 | 26 | } |
27 | 27 | |
28 | 28 | public function getType() : string { |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | * @param float $value Value of the number |
16 | 16 | * @param array $attributes Additional attributes |
17 | 17 | */ |
18 | - public function __construct(float $value, array $attributes = []) { |
|
18 | + public function __construct( float $value, array $attributes = [ ] ) { |
|
19 | 19 | $this->attributes = $attributes; |
20 | 20 | $this->value = $value; |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function getSubNodeNames() : array { |
24 | - return ['value']; |
|
24 | + return [ 'value' ]; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | /** |
@@ -33,35 +33,35 @@ discard block |
||
33 | 33 | * |
34 | 34 | * @return float The parsed number |
35 | 35 | */ |
36 | - public static function parse(string $str) : float { |
|
37 | - $str = str_replace('_', '', $str); |
|
36 | + public static function parse( string $str ) : float { |
|
37 | + $str = str_replace( '_', '', $str ); |
|
38 | 38 | |
39 | 39 | // if string contains any of .eE just cast it to float |
40 | - if (false !== strpbrk($str, '.eE')) { |
|
41 | - return (float) $str; |
|
40 | + if ( false !== strpbrk( $str, '.eE' ) ) { |
|
41 | + return (float)$str; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // otherwise it's an integer notation that overflowed into a float |
45 | 45 | // if it starts with 0 it's one of the special integer notations |
46 | - if ('0' === $str[0]) { |
|
46 | + if ( '0' === $str[ 0 ] ) { |
|
47 | 47 | // hex |
48 | - if ('x' === $str[1] || 'X' === $str[1]) { |
|
49 | - return hexdec($str); |
|
48 | + if ( 'x' === $str[ 1 ] || 'X' === $str[ 1 ] ) { |
|
49 | + return hexdec( $str ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | // bin |
53 | - if ('b' === $str[1] || 'B' === $str[1]) { |
|
54 | - return bindec($str); |
|
53 | + if ( 'b' === $str[ 1 ] || 'B' === $str[ 1 ] ) { |
|
54 | + return bindec( $str ); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | // oct |
58 | 58 | // substr($str, 0, strcspn($str, '89')) cuts the string at the first invalid digit (8 or 9) |
59 | 59 | // so that only the digits before that are used |
60 | - return octdec(substr($str, 0, strcspn($str, '89'))); |
|
60 | + return octdec( substr( $str, 0, strcspn( $str, '89' ) ) ); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | // dec |
64 | - return (float) $str; |
|
64 | + return (float)$str; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | public function getType() : string { |
@@ -22,13 +22,13 @@ discard block |
||
22 | 22 | * @param int $value Value of the number |
23 | 23 | * @param array $attributes Additional attributes |
24 | 24 | */ |
25 | - public function __construct(int $value, array $attributes = []) { |
|
25 | + public function __construct( int $value, array $attributes = [ ] ) { |
|
26 | 26 | $this->attributes = $attributes; |
27 | 27 | $this->value = $value; |
28 | 28 | } |
29 | 29 | |
30 | 30 | public function getSubNodeNames() : array { |
31 | - return ['value']; |
|
31 | + return [ 'value' ]; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -40,36 +40,36 @@ discard block |
||
40 | 40 | * |
41 | 41 | * @return LNumber The constructed LNumber, including kind attribute |
42 | 42 | */ |
43 | - public static function fromString(string $str, array $attributes = [], bool $allowInvalidOctal = false) : LNumber { |
|
44 | - $str = str_replace('_', '', $str); |
|
43 | + public static function fromString( string $str, array $attributes = [ ], bool $allowInvalidOctal = false ) : LNumber { |
|
44 | + $str = str_replace( '_', '', $str ); |
|
45 | 45 | |
46 | - if ('0' !== $str[0] || '0' === $str) { |
|
47 | - $attributes['kind'] = LNumber::KIND_DEC; |
|
48 | - return new LNumber((int) $str, $attributes); |
|
46 | + if ( '0' !== $str[ 0 ] || '0' === $str ) { |
|
47 | + $attributes[ 'kind' ] = LNumber::KIND_DEC; |
|
48 | + return new LNumber( (int)$str, $attributes ); |
|
49 | 49 | } |
50 | 50 | |
51 | - if ('x' === $str[1] || 'X' === $str[1]) { |
|
52 | - $attributes['kind'] = LNumber::KIND_HEX; |
|
53 | - return new LNumber(hexdec($str), $attributes); |
|
51 | + if ( 'x' === $str[ 1 ] || 'X' === $str[ 1 ] ) { |
|
52 | + $attributes[ 'kind' ] = LNumber::KIND_HEX; |
|
53 | + return new LNumber( hexdec( $str ), $attributes ); |
|
54 | 54 | } |
55 | 55 | |
56 | - if ('b' === $str[1] || 'B' === $str[1]) { |
|
57 | - $attributes['kind'] = LNumber::KIND_BIN; |
|
58 | - return new LNumber(bindec($str), $attributes); |
|
56 | + if ( 'b' === $str[ 1 ] || 'B' === $str[ 1 ] ) { |
|
57 | + $attributes[ 'kind' ] = LNumber::KIND_BIN; |
|
58 | + return new LNumber( bindec( $str ), $attributes ); |
|
59 | 59 | } |
60 | 60 | |
61 | - if (!$allowInvalidOctal && strpbrk($str, '89')) { |
|
62 | - throw new Error('Invalid numeric literal', $attributes); |
|
61 | + if ( ! $allowInvalidOctal && strpbrk( $str, '89' ) ) { |
|
62 | + throw new Error( 'Invalid numeric literal', $attributes ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Strip optional explicit octal prefix. |
66 | - if ('o' === $str[1] || 'O' === $str[1]) { |
|
67 | - $str = substr($str, 2); |
|
66 | + if ( 'o' === $str[ 1 ] || 'O' === $str[ 1 ] ) { |
|
67 | + $str = substr( $str, 2 ); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | // use intval instead of octdec to get proper cutting behavior with malformed numbers |
71 | - $attributes['kind'] = LNumber::KIND_OCT; |
|
72 | - return new LNumber(intval($str, 8), $attributes); |
|
71 | + $attributes[ 'kind' ] = LNumber::KIND_OCT; |
|
72 | + return new LNumber( intval( $str, 8 ), $attributes ); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | public function getType() : string { |
@@ -15,13 +15,13 @@ |
||
15 | 15 | * @param string $value String value |
16 | 16 | * @param array $attributes Additional attributes |
17 | 17 | */ |
18 | - public function __construct(string $value, array $attributes = []) { |
|
18 | + public function __construct( string $value, array $attributes = [ ] ) { |
|
19 | 19 | $this->attributes = $attributes; |
20 | 20 | $this->value = $value; |
21 | 21 | } |
22 | 22 | |
23 | 23 | public function getSubNodeNames() : array { |
24 | - return ['value']; |
|
24 | + return [ 'value' ]; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | public function getType() : string { |
@@ -11,12 +11,12 @@ |
||
11 | 11 | * |
12 | 12 | * @param array $attributes Additional attributes |
13 | 13 | */ |
14 | - public function __construct(array $attributes = []) { |
|
14 | + public function __construct( array $attributes = [ ] ) { |
|
15 | 15 | $this->attributes = $attributes; |
16 | 16 | } |
17 | 17 | |
18 | 18 | public function getSubNodeNames() : array { |
19 | - return []; |
|
19 | + return [ ]; |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | /** |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | * @param string $value Value of the string |
34 | 34 | * @param array $attributes Additional attributes |
35 | 35 | */ |
36 | - public function __construct(string $value, array $attributes = []) { |
|
36 | + public function __construct( string $value, array $attributes = [ ] ) { |
|
37 | 37 | $this->attributes = $attributes; |
38 | 38 | $this->value = $value; |
39 | 39 | } |
40 | 40 | |
41 | 41 | public function getSubNodeNames() : array { |
42 | - return ['value']; |
|
42 | + return [ 'value' ]; |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -52,21 +52,21 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @return string The parsed string |
54 | 54 | */ |
55 | - public static function parse(string $str, bool $parseUnicodeEscape = true) : string { |
|
55 | + public static function parse( string $str, bool $parseUnicodeEscape = true ) : string { |
|
56 | 56 | $bLength = 0; |
57 | - if ('b' === $str[0] || 'B' === $str[0]) { |
|
57 | + if ( 'b' === $str[ 0 ] || 'B' === $str[ 0 ] ) { |
|
58 | 58 | $bLength = 1; |
59 | 59 | } |
60 | 60 | |
61 | - if ('\'' === $str[$bLength]) { |
|
61 | + if ( '\'' === $str[ $bLength ] ) { |
|
62 | 62 | return str_replace( |
63 | - ['\\\\', '\\\''], |
|
64 | - ['\\', '\''], |
|
65 | - substr($str, $bLength + 1, -1) |
|
63 | + [ '\\\\', '\\\'' ], |
|
64 | + [ '\\', '\'' ], |
|
65 | + substr( $str, $bLength + 1, -1 ) |
|
66 | 66 | ); |
67 | 67 | } else { |
68 | 68 | return self::parseEscapeSequences( |
69 | - substr($str, $bLength + 1, -1), '"', $parseUnicodeEscape |
|
69 | + substr( $str, $bLength + 1, -1 ), '"', $parseUnicodeEscape |
|
70 | 70 | ); |
71 | 71 | } |
72 | 72 | } |
@@ -82,29 +82,29 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return string String with escape sequences parsed |
84 | 84 | */ |
85 | - public static function parseEscapeSequences(string $str, $quote, bool $parseUnicodeEscape = true) : string { |
|
86 | - if (null !== $quote) { |
|
87 | - $str = str_replace('\\' . $quote, $quote, $str); |
|
85 | + public static function parseEscapeSequences( string $str, $quote, bool $parseUnicodeEscape = true ) : string { |
|
86 | + if ( null !== $quote ) { |
|
87 | + $str = str_replace( '\\' . $quote, $quote, $str ); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | $extra = ''; |
91 | - if ($parseUnicodeEscape) { |
|
91 | + if ( $parseUnicodeEscape ) { |
|
92 | 92 | $extra = '|u\{([0-9a-fA-F]+)\}'; |
93 | 93 | } |
94 | 94 | |
95 | 95 | return preg_replace_callback( |
96 | 96 | '~\\\\([\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3}' . $extra . ')~', |
97 | - function($matches) { |
|
98 | - $str = $matches[1]; |
|
97 | + function( $matches ) { |
|
98 | + $str = $matches[ 1 ]; |
|
99 | 99 | |
100 | - if (isset(self::$replacements[$str])) { |
|
101 | - return self::$replacements[$str]; |
|
102 | - } elseif ('x' === $str[0] || 'X' === $str[0]) { |
|
103 | - return chr(hexdec(substr($str, 1))); |
|
104 | - } elseif ('u' === $str[0]) { |
|
105 | - return self::codePointToUtf8(hexdec($matches[2])); |
|
100 | + if ( isset( self::$replacements[ $str ] ) ) { |
|
101 | + return self::$replacements[ $str ]; |
|
102 | + } elseif ( 'x' === $str[ 0 ] || 'X' === $str[ 0 ] ) { |
|
103 | + return chr( hexdec( substr( $str, 1 ) ) ); |
|
104 | + } elseif ( 'u' === $str[ 0 ] ) { |
|
105 | + return self::codePointToUtf8( hexdec( $matches[ 2 ] ) ); |
|
106 | 106 | } else { |
107 | - return chr(octdec($str)); |
|
107 | + return chr( octdec( $str ) ); |
|
108 | 108 | } |
109 | 109 | }, |
110 | 110 | $str |
@@ -118,21 +118,21 @@ discard block |
||
118 | 118 | * |
119 | 119 | * @return string UTF-8 representation of code point |
120 | 120 | */ |
121 | - private static function codePointToUtf8(int $num) : string { |
|
122 | - if ($num <= 0x7F) { |
|
123 | - return chr($num); |
|
121 | + private static function codePointToUtf8( int $num ) : string { |
|
122 | + if ( $num <= 0x7F ) { |
|
123 | + return chr( $num ); |
|
124 | 124 | } |
125 | - if ($num <= 0x7FF) { |
|
126 | - return chr(($num>>6) + 0xC0) . chr(($num&0x3F) + 0x80); |
|
125 | + if ( $num <= 0x7FF ) { |
|
126 | + return chr( ( $num >> 6 ) + 0xC0 ) . chr( ( $num & 0x3F ) + 0x80 ); |
|
127 | 127 | } |
128 | - if ($num <= 0xFFFF) { |
|
129 | - return chr(($num>>12) + 0xE0) . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80); |
|
128 | + if ( $num <= 0xFFFF ) { |
|
129 | + return chr( ( $num >> 12 ) + 0xE0 ) . chr( ( ( $num >> 6 ) & 0x3F ) + 0x80 ) . chr( ( $num & 0x3F ) + 0x80 ); |
|
130 | 130 | } |
131 | - if ($num <= 0x1FFFFF) { |
|
132 | - return chr(($num>>18) + 0xF0) . chr((($num>>12)&0x3F) + 0x80) |
|
133 | - . chr((($num>>6)&0x3F) + 0x80) . chr(($num&0x3F) + 0x80); |
|
131 | + if ( $num <= 0x1FFFFF ) { |
|
132 | + return chr( ( $num >> 18 ) + 0xF0 ) . chr( ( ( $num >> 12 ) & 0x3F ) + 0x80 ) |
|
133 | + . chr( ( ( $num >> 6 ) & 0x3F ) + 0x80 ) . chr( ( $num & 0x3F ) + 0x80 ); |
|
134 | 134 | } |
135 | - throw new Error('Invalid UTF-8 codepoint escape sequence: Codepoint too large'); |
|
135 | + throw new Error( 'Invalid UTF-8 codepoint escape sequence: Codepoint too large' ); |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | public function getType() : string { |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @param array $attributes Additional attributes |
15 | 15 | */ |
16 | - public function __construct(array $attributes = []) { |
|
16 | + public function __construct( array $attributes = [ ] ) { |
|
17 | 17 | $this->attributes = $attributes; |
18 | 18 | } |
19 | 19 | |
@@ -22,6 +22,6 @@ discard block |
||
22 | 22 | } |
23 | 23 | |
24 | 24 | public function getSubNodeNames(): array { |
25 | - return []; |
|
25 | + return [ ]; |
|
26 | 26 | } |
27 | 27 | } |
28 | 28 | \ No newline at end of file |