@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | require_once __DIR__.'/../vendor/autoload.php'; |
11 | 11 | |
12 | -set_error_handler(function ($severity, $message, $file, $line) { |
|
12 | +set_error_handler(function($severity, $message, $file, $line) { |
|
13 | 13 | throw new ErrorException($message, 0, $severity, $file, $line); |
14 | 14 | }); |
15 | 15 | |
@@ -49,10 +49,9 @@ discard block |
||
49 | 49 | $schema = JVal\Utils::loadJsonFromFile($schemaFile[1]); |
50 | 50 | $validator = JVal\Validator::buildDefault(); |
51 | 51 | $errors = $validator->validate($instance, $schema, $schemaUri); |
52 | - echo json_encode($errors, JSON_PRETTY_PRINT) . "\n"; |
|
52 | + echo json_encode($errors, JSON_PRETTY_PRINT)."\n"; |
|
53 | 53 | ($count = count($errors)) > 0 ? |
54 | - writeln("{$count} errors.", 'error') : |
|
55 | - writeln('No error.', 'info'); |
|
54 | + writeln("{$count} errors.", 'error') : writeln('No error.', 'info'); |
|
56 | 55 | } catch (Exception $ex) { |
57 | 56 | writeln($ex->getMessage(), 'error'); |
58 | 57 | writeln($ex->getTraceAsString()); |
@@ -70,11 +70,9 @@ |
||
70 | 70 | $fMod = 0.0; |
71 | 71 | } else { |
72 | 72 | $decimals1 = mb_strpos($instance, '.') ? |
73 | - mb_strlen($instance) - mb_strpos($instance, '.') - 1 : |
|
74 | - 0; |
|
73 | + mb_strlen($instance) - mb_strpos($instance, '.') - 1 : 0; |
|
75 | 74 | $decimals2 = mb_strpos($divider, '.') ? |
76 | - mb_strlen($divider) - mb_strpos($divider, '.') - 1 : |
|
77 | - 0; |
|
75 | + mb_strlen($divider) - mb_strpos($divider, '.') - 1 : 0; |
|
78 | 76 | $fMod = (float) round($modulus, max($decimals1, $decimals2)); |
79 | 77 | } |
80 | 78 |
@@ -41,8 +41,7 @@ |
||
41 | 41 | public function apply($instance, stdClass $schema, Context $context, Walker $walker) |
42 | 42 | { |
43 | 43 | $length = extension_loaded('mbstring') ? |
44 | - mb_strlen($instance, mb_detect_encoding($instance)) : |
|
45 | - strlen($instance); |
|
44 | + mb_strlen($instance, mb_detect_encoding($instance)) : strlen($instance); |
|
46 | 45 | |
47 | 46 | if ($length > $schema->maxLength) { |
48 | 47 | $context->addViolation( |
@@ -226,7 +226,7 @@ |
||
226 | 226 | $uri = $hook($uri); |
227 | 227 | } |
228 | 228 | |
229 | - set_error_handler(function ($severity, $error) use ($uri) { |
|
229 | + set_error_handler(function($severity, $error) use ($uri) { |
|
230 | 230 | restore_error_handler(); |
231 | 231 | throw new UnfetchableUriException([$uri, $error, $severity]); |
232 | 232 | }); |
@@ -108,7 +108,7 @@ |
||
108 | 108 | |
109 | 109 | private function createConstraints(array $constraintNames) |
110 | 110 | { |
111 | - return array_map(function ($name) { |
|
111 | + return array_map(function($name) { |
|
112 | 112 | $class = "JVal\\Constraint\\{$name}Constraint"; |
113 | 113 | |
114 | 114 | return new $class(); |
@@ -91,9 +91,9 @@ |
||
91 | 91 | |
92 | 92 | if (json_last_error() !== JSON_ERROR_NONE) { |
93 | 93 | throw new JsonDecodeException(sprintf( |
94 | - 'Cannot decode JSON from file "%s" (error: %s)', |
|
95 | - $filePath, |
|
96 | - static::lastJsonErrorMessage() |
|
94 | + 'Cannot decode JSON from file "%s" (error: %s)', |
|
95 | + $filePath, |
|
96 | + static::lastJsonErrorMessage() |
|
97 | 97 | )); |
98 | 98 | } |
99 | 99 |
@@ -41,8 +41,7 @@ |
||
41 | 41 | public function apply($instance, stdClass $schema, Context $context, Walker $walker) |
42 | 42 | { |
43 | 43 | $length = extension_loaded('mbstring') ? |
44 | - mb_strlen($instance, mb_detect_encoding($instance)) : |
|
45 | - strlen($instance); |
|
44 | + mb_strlen($instance, mb_detect_encoding($instance)) : strlen($instance); |
|
46 | 45 | |
47 | 46 | if ($length > $schema->maxLength) { |
48 | 47 | $context->addViolation( |
@@ -157,10 +157,10 @@ discard block |
||
157 | 157 | protected function getLocalUri($path) |
158 | 158 | { |
159 | 159 | if (preg_match('/^[A-Z]:/', $path)) { |
160 | - $path = '/' . strtr($path, '\\', '/'); |
|
160 | + $path = '/'.strtr($path, '\\', '/'); |
|
161 | 161 | } |
162 | 162 | |
163 | - return 'file://' . $path; |
|
163 | + return 'file://'.$path; |
|
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | private function dump($variable) |
174 | 174 | { |
175 | 175 | if (defined('JSON_PRETTY_PRINT')) { |
176 | - $options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES; |
|
176 | + $options = JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES; |
|
177 | 177 | |
178 | 178 | if (defined('JSON_PRESERVE_ZERO_FRACTION')) { |
179 | 179 | $options |= JSON_PRESERVE_ZERO_FRACTION; |
@@ -201,7 +201,7 @@ |
||
201 | 201 | } |
202 | 202 | |
203 | 203 | if ($this->parts['scheme'] === 'file' && preg_match('/^[A-Z]:/', $this->parts['path'])) { |
204 | - $this->parts['path'] = '/' . $this->parts['path']; |
|
204 | + $this->parts['path'] = '/'.$this->parts['path']; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | $this->authority = $this->buildAuthority(); |