Completed
Push — develop ( 316159...00443b )
by Zack
20:22
created
json-schema/src/JsonSchema/Constraints/ConstraintInterface.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      *
31 31
      * @param array $errors
32 32
      */
33
-    public function addErrors(array $errors);
33
+    public function addErrors( array $errors );
34 34
 
35 35
     /**
36 36
      * adds an error
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param string           $constraint the constraint/rule that is broken, e.g.: 'minLength'
41 41
      * @param array            $more       more array elements to add to the error
42 42
      */
43
-    public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
43
+    public function addError( JsonPointer $path = null, $message, $constraint = '', array $more = null );
44 44
 
45 45
     /**
46 46
      * checks if the validator has not raised errors
@@ -61,5 +61,5 @@  discard block
 block discarded – undo
61 61
      *
62 62
      * @throws \JsonSchema\Exception\ExceptionInterface
63 63
      */
64
-    public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
64
+    public function check( &$value, $schema = null, JsonPointer $path = null, $i = null );
65 65
 }
Please login to merge, or discard this patch.
vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
         $checkMode = Constraint::CHECK_MODE_NORMAL
80 80
     ) {
81 81
         // set provided config options
82
-        $this->setConfig($checkMode);
82
+        $this->setConfig( $checkMode );
83 83
 
84 84
         $this->uriRetriever = $uriRetriever ?: new UriRetriever();
85
-        $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
85
+        $this->schemaStorage = $schemaStorage ?: new SchemaStorage( $this->uriRetriever );
86 86
     }
87 87
 
88 88
     /**
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
      *
91 91
      * @param int $checkMode Set checkMode options - does not preserve existing flags
92 92
      */
93
-    public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
93
+    public function setConfig( $checkMode = Constraint::CHECK_MODE_NORMAL )
94 94
     {
95 95
         $this->checkMode = $checkMode;
96 96
     }
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @param int $options
102 102
      */
103
-    public function addConfig($options)
103
+    public function addConfig( $options )
104 104
     {
105 105
         $this->checkMode |= $options;
106 106
     }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
      *
111 111
      * @param int $options
112 112
      */
113
-    public function removeConfig($options)
113
+    public function removeConfig( $options )
114 114
     {
115 115
         $this->checkMode &= ~$options;
116 116
     }
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return int
124 124
      */
125
-    public function getConfig($options = null)
125
+    public function getConfig( $options = null )
126 126
     {
127
-        if ($options === null) {
127
+        if ( $options === null ) {
128 128
             return $this->checkMode;
129 129
         }
130 130
 
@@ -146,13 +146,13 @@  discard block
 block discarded – undo
146 146
 
147 147
     public function getTypeCheck()
148 148
     {
149
-        if (!isset($this->typeCheck[$this->checkMode])) {
150
-            $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
149
+        if ( ! isset( $this->typeCheck[ $this->checkMode ] ) ) {
150
+            $this->typeCheck[ $this->checkMode ] = ( $this->checkMode & Constraint::CHECK_MODE_TYPE_CAST )
151 151
                 ? new TypeCheck\LooseTypeCheck()
152 152
                 : new TypeCheck\StrictTypeCheck();
153 153
         }
154 154
 
155
-        return $this->typeCheck[$this->checkMode];
155
+        return $this->typeCheck[ $this->checkMode ];
156 156
     }
157 157
 
158 158
     /**
@@ -161,17 +161,17 @@  discard block
 block discarded – undo
161 161
      *
162 162
      * @return Factory
163 163
      */
164
-    public function setConstraintClass($name, $class)
164
+    public function setConstraintClass( $name, $class )
165 165
     {
166 166
         // Ensure class exists
167
-        if (!class_exists($class)) {
168
-            throw new InvalidArgumentException('Unknown constraint ' . $name);
167
+        if ( ! class_exists( $class ) ) {
168
+            throw new InvalidArgumentException( 'Unknown constraint ' . $name );
169 169
         }
170 170
         // Ensure class is appropriate
171
-        if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
172
-            throw new InvalidArgumentException('Invalid class ' . $name);
171
+        if ( ! in_array( 'JsonSchema\Constraints\ConstraintInterface', class_implements( $class ) ) ) {
172
+            throw new InvalidArgumentException( 'Invalid class ' . $name );
173 173
         }
174
-        $this->constraintMap[$name] = $class;
174
+        $this->constraintMap[ $name ] = $class;
175 175
 
176 176
         return $this;
177 177
     }
@@ -185,17 +185,17 @@  discard block
 block discarded – undo
185 185
      *
186 186
      * @return ConstraintInterface|ObjectConstraint
187 187
      */
188
-    public function createInstanceFor($constraintName)
188
+    public function createInstanceFor( $constraintName )
189 189
     {
190
-        if (!isset($this->constraintMap[$constraintName])) {
191
-            throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
190
+        if ( ! isset( $this->constraintMap[ $constraintName ] ) ) {
191
+            throw new InvalidArgumentException( 'Unknown constraint ' . $constraintName );
192 192
         }
193 193
 
194
-        if (!isset($this->instanceCache[$constraintName])) {
195
-            $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
194
+        if ( ! isset( $this->instanceCache[ $constraintName ] ) ) {
195
+            $this->instanceCache[ $constraintName ] = new $this->constraintMap[ $constraintName ]( $this );
196 196
         }
197 197
 
198
-        return clone $this->instanceCache[$constraintName];
198
+        return clone $this->instanceCache[ $constraintName ];
199 199
     }
200 200
 
201 201
     /**
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
      *
214 214
      * @param string $validationContext
215 215
      */
216
-    public function setErrorContext($errorContext)
216
+    public function setErrorContext( $errorContext )
217 217
     {
218 218
         $this->errorContext = $errorContext;
219 219
     }
Please login to merge, or discard this patch.
vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 
24 24
     public function __construct()
25 25
     {
26
-        if (!function_exists('curl_init')) {
26
+        if ( ! function_exists( 'curl_init' ) ) {
27 27
             // Cannot test this, because curl_init is present on all test platforms plus mock
28
-            throw new RuntimeException('cURL not installed'); // @codeCoverageIgnore
28
+            throw new RuntimeException( 'cURL not installed' ); // @codeCoverageIgnore
29 29
         }
30 30
     }
31 31
 
@@ -34,24 +34,24 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve()
36 36
      */
37
-    public function retrieve($uri)
37
+    public function retrieve( $uri )
38 38
     {
39 39
         $ch = curl_init();
40 40
 
41
-        curl_setopt($ch, CURLOPT_URL, $uri);
42
-        curl_setopt($ch, CURLOPT_HEADER, true);
43
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
44
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
41
+        curl_setopt( $ch, CURLOPT_URL, $uri );
42
+        curl_setopt( $ch, CURLOPT_HEADER, true );
43
+        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
44
+        curl_setopt( $ch, CURLOPT_HTTPHEADER, array( 'Accept: ' . Validator::SCHEMA_MEDIA_TYPE ) );
45 45
 
46
-        $response = curl_exec($ch);
47
-        if (false === $response) {
48
-            throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
46
+        $response = curl_exec( $ch );
47
+        if ( false === $response ) {
48
+            throw new \JsonSchema\Exception\ResourceNotFoundException( 'JSON schema not found' );
49 49
         }
50 50
 
51
-        $this->fetchMessageBody($response);
52
-        $this->fetchContentType($response);
51
+        $this->fetchMessageBody( $response );
52
+        $this->fetchContentType( $response );
53 53
 
54
-        curl_close($ch);
54
+        curl_close( $ch );
55 55
 
56 56
         return $this->messageBody;
57 57
     }
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
     /**
60 60
      * @param string $response cURL HTTP response
61 61
      */
62
-    private function fetchMessageBody($response)
62
+    private function fetchMessageBody( $response )
63 63
     {
64
-        preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
65
-        $this->messageBody = $match[1];
64
+        preg_match( "/(?:\r\n){2}(.*)$/ms", $response, $match );
65
+        $this->messageBody = $match[ 1 ];
66 66
     }
67 67
 
68 68
     /**
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
      *
71 71
      * @return bool Whether the Content-Type header was found or not
72 72
      */
73
-    protected function fetchContentType($response)
73
+    protected function fetchContentType( $response )
74 74
     {
75
-        if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
76
-            $this->contentType = trim($match[1]);
75
+        if ( 0 < preg_match( "/Content-Type:(\V*)/ims", $response, $match ) ) {
76
+            $this->contentType = trim( $match[ 1 ] );
77 77
 
78 78
             return true;
79 79
         }
Please login to merge, or discard this patch.
justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @param array  $schemas
32 32
      * @param string $contentType
33 33
      */
34
-    public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
34
+    public function __construct( array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE )
35 35
     {
36 36
         $this->schemas     = $schemas;
37 37
         $this->contentType = $contentType;
@@ -42,15 +42,15 @@  discard block
 block discarded – undo
42 42
      *
43 43
      * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve()
44 44
      */
45
-    public function retrieve($uri)
45
+    public function retrieve( $uri )
46 46
     {
47
-        if (!array_key_exists($uri, $this->schemas)) {
48
-            throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
47
+        if ( ! array_key_exists( $uri, $this->schemas ) ) {
48
+            throw new \JsonSchema\Exception\ResourceNotFoundException( sprintf(
49 49
                 'The JSON schema "%s" was not found.',
50 50
                 $uri
51
-            ));
51
+            ) );
52 52
         }
53 53
 
54
-        return $this->schemas[$uri];
54
+        return $this->schemas[ $uri ];
55 55
     }
56 56
 }
Please login to merge, or discard this patch.
justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,34 +25,34 @@  discard block
 block discarded – undo
25 25
      *
26 26
      * @see \JsonSchema\Uri\Retrievers\UriRetrieverInterface::retrieve()
27 27
      */
28
-    public function retrieve($uri)
28
+    public function retrieve( $uri )
29 29
     {
30 30
         $errorMessage = null;
31
-        set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
31
+        set_error_handler( function( $errno, $errstr ) use ( &$errorMessage ) {
32 32
             $errorMessage = $errstr;
33 33
         });
34
-        $response = file_get_contents($uri);
34
+        $response = file_get_contents( $uri );
35 35
         restore_error_handler();
36 36
 
37
-        if ($errorMessage) {
38
-            throw new ResourceNotFoundException($errorMessage);
37
+        if ( $errorMessage ) {
38
+            throw new ResourceNotFoundException( $errorMessage );
39 39
         }
40 40
 
41
-        if (false === $response) {
42
-            throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
41
+        if ( false === $response ) {
42
+            throw new ResourceNotFoundException( 'JSON schema not found at ' . $uri );
43 43
         }
44 44
 
45
-        if ($response == ''
46
-            && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
45
+        if ( $response == ''
46
+            && substr( $uri, 0, 7 ) == 'file://' && substr( $uri, -1 ) == '/'
47 47
         ) {
48
-            throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
48
+            throw new ResourceNotFoundException( 'JSON schema not found at ' . $uri );
49 49
         }
50 50
 
51 51
         $this->messageBody = $response;
52
-        if (!empty($http_response_header)) {
52
+        if ( ! empty( $http_response_header ) ) {
53 53
             // $http_response_header cannot be tested, because it's defined in the method's local scope
54 54
             // See http://php.net/manual/en/reserved.variables.httpresponseheader.php for more info.
55
-            $this->fetchContentType($http_response_header); // @codeCoverageIgnore
55
+            $this->fetchContentType( $http_response_header ); // @codeCoverageIgnore
56 56
         } else {                                            // @codeCoverageIgnore
57 57
             // Could be a "file://" url or something else - fake up the response
58 58
             $this->contentType = null;
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
      *
67 67
      * @return bool Whether the Content-Type header was found or not
68 68
      */
69
-    private function fetchContentType(array $headers)
69
+    private function fetchContentType( array $headers )
70 70
     {
71
-        foreach ($headers as $header) {
72
-            if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
71
+        foreach ( $headers as $header ) {
72
+            if ( $this->contentType = self::getContentTypeMatchInHeader( $header ) ) {
73 73
                 return true;
74 74
             }
75 75
         }
@@ -82,10 +82,10 @@  discard block
 block discarded – undo
82 82
      *
83 83
      * @return string|null
84 84
      */
85
-    protected static function getContentTypeMatchInHeader($header)
85
+    protected static function getContentTypeMatchInHeader( $header )
86 86
     {
87
-        if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
88
-            return trim($match[1]);
87
+        if ( 0 < preg_match( "/Content-Type:(\V*)/ims", $header, $match ) ) {
88
+            return trim( $match[ 1 ] );
89 89
         }
90 90
 
91 91
         return null;
Please login to merge, or discard this patch.
json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@
 block discarded – undo
25 25
      *
26 26
      * @return mixed string|null
27 27
      */
28
-    public function retrieve($uri);
28
+    public function retrieve( $uri );
29 29
 
30 30
     /**
31 31
      * Get media content type
Please login to merge, or discard this patch.
vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -26,23 +26,23 @@  discard block
 block discarded – undo
26 26
      *
27 27
      * @return array
28 28
      */
29
-    public function parse($uri)
29
+    public function parse( $uri )
30 30
     {
31
-        preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
31
+        preg_match( '|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match );
32 32
 
33 33
         $components = array();
34
-        if (5 < count($match)) {
35
-            $components =  array(
36
-                'scheme'    => $match[2],
37
-                'authority' => $match[4],
38
-                'path'      => $match[5]
34
+        if ( 5 < count( $match ) ) {
35
+            $components = array(
36
+                'scheme'    => $match[ 2 ],
37
+                'authority' => $match[ 4 ],
38
+                'path'      => $match[ 5 ]
39 39
             );
40 40
         }
41
-        if (7 < count($match)) {
42
-            $components['query'] = $match[7];
41
+        if ( 7 < count( $match ) ) {
42
+            $components[ 'query' ] = $match[ 7 ];
43 43
         }
44
-        if (9 < count($match)) {
45
-            $components['fragment'] = $match[9];
44
+        if ( 9 < count( $match ) ) {
45
+            $components[ 'fragment' ] = $match[ 9 ];
46 46
         }
47 47
 
48 48
         return $components;
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return string
57 57
      */
58
-    public function generate(array $components)
58
+    public function generate( array $components )
59 59
     {
60
-        $uri = $components['scheme'] . '://'
61
-             . $components['authority']
62
-             . $components['path'];
60
+        $uri = $components[ 'scheme' ] . '://'
61
+             . $components[ 'authority' ]
62
+             . $components[ 'path' ];
63 63
 
64
-        if (array_key_exists('query', $components) && strlen($components['query'])) {
65
-            $uri .= '?' . $components['query'];
64
+        if ( array_key_exists( 'query', $components ) && strlen( $components[ 'query' ] ) ) {
65
+            $uri .= '?' . $components[ 'query' ];
66 66
         }
67
-        if (array_key_exists('fragment', $components)) {
68
-            $uri .= '#' . $components['fragment'];
67
+        if ( array_key_exists( 'fragment', $components ) ) {
68
+            $uri .= '#' . $components[ 'fragment' ];
69 69
         }
70 70
 
71 71
         return $uri;
@@ -74,42 +74,42 @@  discard block
 block discarded – undo
74 74
     /**
75 75
      * {@inheritdoc}
76 76
      */
77
-    public function resolve($uri, $baseUri = null)
77
+    public function resolve( $uri, $baseUri = null )
78 78
     {
79 79
         // treat non-uri base as local file path
80 80
         if (
81
-            !is_null($baseUri) &&
82
-            !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
83
-            !preg_match('|^[^/]+://|u', $baseUri)
81
+            ! is_null( $baseUri ) &&
82
+            ! filter_var( $baseUri, \FILTER_VALIDATE_URL ) &&
83
+            ! preg_match( '|^[^/]+://|u', $baseUri )
84 84
         ) {
85
-            if (is_file($baseUri)) {
86
-                $baseUri = 'file://' . realpath($baseUri);
87
-            } elseif (is_dir($baseUri)) {
88
-                $baseUri = 'file://' . realpath($baseUri) . '/';
85
+            if ( is_file( $baseUri ) ) {
86
+                $baseUri = 'file://' . realpath( $baseUri );
87
+            } elseif ( is_dir( $baseUri ) ) {
88
+                $baseUri = 'file://' . realpath( $baseUri ) . '/';
89 89
             } else {
90 90
                 $baseUri = 'file://' . getcwd() . '/' . $baseUri;
91 91
             }
92 92
         }
93 93
 
94
-        if ($uri == '') {
94
+        if ( $uri == '' ) {
95 95
             return $baseUri;
96 96
         }
97 97
 
98
-        $components = $this->parse($uri);
99
-        $path = $components['path'];
98
+        $components = $this->parse( $uri );
99
+        $path = $components[ 'path' ];
100 100
 
101
-        if (!empty($components['scheme'])) {
101
+        if ( ! empty( $components[ 'scheme' ] ) ) {
102 102
             return $uri;
103 103
         }
104
-        $baseComponents = $this->parse($baseUri);
105
-        $basePath = $baseComponents['path'];
104
+        $baseComponents = $this->parse( $baseUri );
105
+        $basePath = $baseComponents[ 'path' ];
106 106
 
107
-        $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
108
-        if (isset($components['fragment'])) {
109
-            $baseComponents['fragment'] = $components['fragment'];
107
+        $baseComponents[ 'path' ] = self::combineRelativePathWithBasePath( $path, $basePath );
108
+        if ( isset( $components[ 'fragment' ] ) ) {
109
+            $baseComponents[ 'fragment' ] = $components[ 'fragment' ];
110 110
         }
111 111
 
112
-        return $this->generate($baseComponents);
112
+        return $this->generate( $baseComponents );
113 113
     }
114 114
 
115 115
     /**
@@ -122,28 +122,28 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return string Merged path
124 124
      */
125
-    public static function combineRelativePathWithBasePath($relativePath, $basePath)
125
+    public static function combineRelativePathWithBasePath( $relativePath, $basePath )
126 126
     {
127
-        $relativePath = self::normalizePath($relativePath);
128
-        if ($relativePath == '') {
127
+        $relativePath = self::normalizePath( $relativePath );
128
+        if ( $relativePath == '' ) {
129 129
             return $basePath;
130 130
         }
131
-        if ($relativePath[0] == '/') {
131
+        if ( $relativePath[ 0 ] == '/' ) {
132 132
             return $relativePath;
133 133
         }
134 134
 
135
-        $basePathSegments = explode('/', $basePath);
135
+        $basePathSegments = explode( '/', $basePath );
136 136
 
137
-        preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
138
-        $numLevelUp = strlen($match[0]) /3 + 1;
139
-        if ($numLevelUp >= count($basePathSegments)) {
140
-            throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
137
+        preg_match( '|^/?(\.\./(?:\./)*)*|', $relativePath, $match );
138
+        $numLevelUp = strlen( $match[ 0 ] ) / 3 + 1;
139
+        if ( $numLevelUp >= count( $basePathSegments ) ) {
140
+            throw new UriResolverException( sprintf( "Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath ) );
141 141
         }
142 142
 
143
-        $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
144
-        $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
143
+        $basePathSegments = array_slice( $basePathSegments, 0, -$numLevelUp );
144
+        $path = preg_replace( '|^/?(\.\./(\./)*)*|', '', $relativePath );
145 145
 
146
-        return implode('/', $basePathSegments) . '/' . $path;
146
+        return implode( '/', $basePathSegments ) . '/' . $path;
147 147
     }
148 148
 
149 149
     /**
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
      *
154 154
      * @return string
155 155
      */
156
-    private static function normalizePath($path)
156
+    private static function normalizePath( $path )
157 157
     {
158
-        $path = preg_replace('|((?<!\.)\./)*|', '', $path);
159
-        $path = preg_replace('|//|', '/', $path);
158
+        $path = preg_replace( '|((?<!\.)\./)*|', '', $path );
159
+        $path = preg_replace( '|//|', '/', $path );
160 160
 
161 161
         return $path;
162 162
     }
@@ -166,10 +166,10 @@  discard block
 block discarded – undo
166 166
      *
167 167
      * @return bool
168 168
      */
169
-    public function isValid($uri)
169
+    public function isValid( $uri )
170 170
     {
171
-        $components = $this->parse($uri);
171
+        $components = $this->parse( $uri );
172 172
 
173
-        return !empty($components);
173
+        return ! empty( $components );
174 174
     }
175 175
 }
Please login to merge, or discard this patch.
vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.php 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @param string $endpoint
59 59
      */
60
-    public function addInvalidContentTypeEndpoint($endpoint)
60
+    public function addInvalidContentTypeEndpoint( $endpoint )
61 61
     {
62
-        $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
62
+        $this->allowedInvalidContentTypeEndpoints[ ] = $endpoint;
63 63
     }
64 64
 
65 65
     /**
@@ -70,26 +70,26 @@  discard block
 block discarded – undo
70 70
      *
71 71
      * @return bool|void
72 72
      */
73
-    public function confirmMediaType($uriRetriever, $uri)
73
+    public function confirmMediaType( $uriRetriever, $uri )
74 74
     {
75 75
         $contentType = $uriRetriever->getContentType();
76 76
 
77
-        if (is_null($contentType)) {
77
+        if ( is_null( $contentType ) ) {
78 78
             // Well, we didn't get an invalid one
79 79
             return;
80 80
         }
81 81
 
82
-        if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
82
+        if ( in_array( $contentType, array( Validator::SCHEMA_MEDIA_TYPE, 'application/json' ) ) ) {
83 83
             return;
84 84
         }
85 85
 
86
-        foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
87
-            if (strpos($uri, $endpoint) === 0) {
86
+        foreach ( $this->allowedInvalidContentTypeEndpoints as $endpoint ) {
87
+            if ( strpos( $uri, $endpoint ) === 0 ) {
88 88
                 return true;
89 89
             }
90 90
         }
91 91
 
92
-        throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
92
+        throw new InvalidSchemaMediaTypeException( sprintf( 'Media type %s expected', Validator::SCHEMA_MEDIA_TYPE ) );
93 93
     }
94 94
 
95 95
     /**
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function getUriRetriever()
104 104
     {
105
-        if (is_null($this->uriRetriever)) {
106
-            $this->setUriRetriever(new FileGetContents());
105
+        if ( is_null( $this->uriRetriever ) ) {
106
+            $this->setUriRetriever( new FileGetContents() );
107 107
         }
108 108
 
109 109
         return $this->uriRetriever;
@@ -123,30 +123,30 @@  discard block
 block discarded – undo
123 123
      *
124 124
      * @return object JSON Schema after walking down the fragment pieces
125 125
      */
126
-    public function resolvePointer($jsonSchema, $uri)
126
+    public function resolvePointer( $jsonSchema, $uri )
127 127
     {
128 128
         $resolver = new UriResolver();
129
-        $parsed = $resolver->parse($uri);
130
-        if (empty($parsed['fragment'])) {
129
+        $parsed = $resolver->parse( $uri );
130
+        if ( empty( $parsed[ 'fragment' ] ) ) {
131 131
             return $jsonSchema;
132 132
         }
133 133
 
134
-        $path = explode('/', $parsed['fragment']);
135
-        while ($path) {
136
-            $pathElement = array_shift($path);
137
-            if (!empty($pathElement)) {
138
-                $pathElement = str_replace('~1', '/', $pathElement);
139
-                $pathElement = str_replace('~0', '~', $pathElement);
140
-                if (!empty($jsonSchema->$pathElement)) {
134
+        $path = explode( '/', $parsed[ 'fragment' ] );
135
+        while ( $path ) {
136
+            $pathElement = array_shift( $path );
137
+            if ( ! empty( $pathElement ) ) {
138
+                $pathElement = str_replace( '~1', '/', $pathElement );
139
+                $pathElement = str_replace( '~0', '~', $pathElement );
140
+                if ( ! empty( $jsonSchema->$pathElement ) ) {
141 141
                     $jsonSchema = $jsonSchema->$pathElement;
142 142
                 } else {
143 143
                     throw new ResourceNotFoundException(
144
-                        'Fragment "' . $parsed['fragment'] . '" not found'
144
+                        'Fragment "' . $parsed[ 'fragment' ] . '" not found'
145 145
                         . ' in ' . $uri
146 146
                     );
147 147
                 }
148 148
 
149
-                if (!is_object($jsonSchema)) {
149
+                if ( ! is_object( $jsonSchema ) ) {
150 150
                     throw new ResourceNotFoundException(
151 151
                         'Fragment part "' . $pathElement . '" is no object '
152 152
                         . ' in ' . $uri
@@ -161,29 +161,29 @@  discard block
 block discarded – undo
161 161
     /**
162 162
      * {@inheritdoc}
163 163
      */
164
-    public function retrieve($uri, $baseUri = null, $translate = true)
164
+    public function retrieve( $uri, $baseUri = null, $translate = true )
165 165
     {
166 166
         $resolver = new UriResolver();
167
-        $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
167
+        $resolvedUri = $fetchUri = $resolver->resolve( $uri, $baseUri );
168 168
 
169 169
         //fetch URL without #fragment
170
-        $arParts = $resolver->parse($resolvedUri);
171
-        if (isset($arParts['fragment'])) {
172
-            unset($arParts['fragment']);
173
-            $fetchUri = $resolver->generate($arParts);
170
+        $arParts = $resolver->parse( $resolvedUri );
171
+        if ( isset( $arParts[ 'fragment' ] ) ) {
172
+            unset( $arParts[ 'fragment' ] );
173
+            $fetchUri = $resolver->generate( $arParts );
174 174
         }
175 175
 
176 176
         // apply URI translations
177
-        if ($translate) {
178
-            $fetchUri = $this->translate($fetchUri);
177
+        if ( $translate ) {
178
+            $fetchUri = $this->translate( $fetchUri );
179 179
         }
180 180
 
181
-        $jsonSchema = $this->loadSchema($fetchUri);
181
+        $jsonSchema = $this->loadSchema( $fetchUri );
182 182
 
183 183
         // Use the JSON pointer if specified
184
-        $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
184
+        $jsonSchema = $this->resolvePointer( $jsonSchema, $resolvedUri );
185 185
 
186
-        if ($jsonSchema instanceof \stdClass) {
186
+        if ( $jsonSchema instanceof \stdClass ) {
187 187
             $jsonSchema->id = $resolvedUri;
188 188
         }
189 189
 
@@ -198,22 +198,22 @@  discard block
 block discarded – undo
198 198
      *
199 199
      * @return object JSON schema object
200 200
      */
201
-    protected function loadSchema($fetchUri)
201
+    protected function loadSchema( $fetchUri )
202 202
     {
203
-        if (isset($this->schemaCache[$fetchUri])) {
204
-            return $this->schemaCache[$fetchUri];
203
+        if ( isset( $this->schemaCache[ $fetchUri ] ) ) {
204
+            return $this->schemaCache[ $fetchUri ];
205 205
         }
206 206
 
207 207
         $uriRetriever = $this->getUriRetriever();
208
-        $contents = $this->uriRetriever->retrieve($fetchUri);
209
-        $this->confirmMediaType($uriRetriever, $fetchUri);
210
-        $jsonSchema = json_decode($contents);
208
+        $contents = $this->uriRetriever->retrieve( $fetchUri );
209
+        $this->confirmMediaType( $uriRetriever, $fetchUri );
210
+        $jsonSchema = json_decode( $contents );
211 211
 
212
-        if (JSON_ERROR_NONE < $error = json_last_error()) {
213
-            throw new JsonDecodingException($error);
212
+        if ( JSON_ERROR_NONE < $error = json_last_error() ) {
213
+            throw new JsonDecodingException( $error );
214 214
         }
215 215
 
216
-        $this->schemaCache[$fetchUri] = $jsonSchema;
216
+        $this->schemaCache[ $fetchUri ] = $jsonSchema;
217 217
 
218 218
         return $jsonSchema;
219 219
     }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
      *
226 226
      * @return $this for chaining
227 227
      */
228
-    public function setUriRetriever(UriRetrieverInterface $uriRetriever)
228
+    public function setUriRetriever( UriRetrieverInterface $uriRetriever )
229 229
     {
230 230
         $this->uriRetriever = $uriRetriever;
231 231
 
@@ -239,25 +239,25 @@  discard block
 block discarded – undo
239 239
      *
240 240
      * @return array
241 241
      */
242
-    public function parse($uri)
242
+    public function parse( $uri )
243 243
     {
244
-        preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
244
+        preg_match( '|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match );
245 245
 
246 246
         $components = array();
247
-        if (5 < count($match)) {
248
-            $components =  array(
249
-                'scheme'    => $match[2],
250
-                'authority' => $match[4],
251
-                'path'      => $match[5]
247
+        if ( 5 < count( $match ) ) {
248
+            $components = array(
249
+                'scheme'    => $match[ 2 ],
250
+                'authority' => $match[ 4 ],
251
+                'path'      => $match[ 5 ]
252 252
             );
253 253
         }
254 254
 
255
-        if (7 < count($match)) {
256
-            $components['query'] = $match[7];
255
+        if ( 7 < count( $match ) ) {
256
+            $components[ 'query' ] = $match[ 7 ];
257 257
         }
258 258
 
259
-        if (9 < count($match)) {
260
-            $components['fragment'] = $match[9];
259
+        if ( 9 < count( $match ) ) {
260
+            $components[ 'fragment' ] = $match[ 9 ];
261 261
         }
262 262
 
263 263
         return $components;
@@ -270,18 +270,18 @@  discard block
 block discarded – undo
270 270
      *
271 271
      * @return string
272 272
      */
273
-    public function generate(array $components)
273
+    public function generate( array $components )
274 274
     {
275
-        $uri = $components['scheme'] . '://'
276
-             . $components['authority']
277
-             . $components['path'];
275
+        $uri = $components[ 'scheme' ] . '://'
276
+             . $components[ 'authority' ]
277
+             . $components[ 'path' ];
278 278
 
279
-        if (array_key_exists('query', $components)) {
280
-            $uri .= $components['query'];
279
+        if ( array_key_exists( 'query', $components ) ) {
280
+            $uri .= $components[ 'query' ];
281 281
         }
282 282
 
283
-        if (array_key_exists('fragment', $components)) {
284
-            $uri .= $components['fragment'];
283
+        if ( array_key_exists( 'fragment', $components ) ) {
284
+            $uri .= $components[ 'fragment' ];
285 285
         }
286 286
 
287 287
         return $uri;
@@ -295,21 +295,21 @@  discard block
 block discarded – undo
295 295
      *
296 296
      * @return string
297 297
      */
298
-    public function resolve($uri, $baseUri = null)
298
+    public function resolve( $uri, $baseUri = null )
299 299
     {
300
-        $components = $this->parse($uri);
301
-        $path = $components['path'];
300
+        $components = $this->parse( $uri );
301
+        $path = $components[ 'path' ];
302 302
 
303
-        if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
303
+        if ( ( array_key_exists( 'scheme', $components ) ) && ( 'http' === $components[ 'scheme' ] ) ) {
304 304
             return $uri;
305 305
         }
306 306
 
307
-        $baseComponents = $this->parse($baseUri);
308
-        $basePath = $baseComponents['path'];
307
+        $baseComponents = $this->parse( $baseUri );
308
+        $basePath = $baseComponents[ 'path' ];
309 309
 
310
-        $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
310
+        $baseComponents[ 'path' ] = UriResolver::combineRelativePathWithBasePath( $path, $basePath );
311 311
 
312
-        return $this->generate($baseComponents);
312
+        return $this->generate( $baseComponents );
313 313
     }
314 314
 
315 315
     /**
@@ -317,32 +317,32 @@  discard block
 block discarded – undo
317 317
      *
318 318
      * @return bool
319 319
      */
320
-    public function isValid($uri)
320
+    public function isValid( $uri )
321 321
     {
322
-        $components = $this->parse($uri);
322
+        $components = $this->parse( $uri );
323 323
 
324
-        return !empty($components);
324
+        return ! empty( $components );
325 325
     }
326 326
 
327 327
     /**
328 328
      * Set a URL translation rule
329 329
      */
330
-    public function setTranslation($from, $to)
330
+    public function setTranslation( $from, $to )
331 331
     {
332
-        $this->translationMap[$from] = $to;
332
+        $this->translationMap[ $from ] = $to;
333 333
     }
334 334
 
335 335
     /**
336 336
      * Apply URI translation rules
337 337
      */
338
-    public function translate($uri)
338
+    public function translate( $uri )
339 339
     {
340
-        foreach ($this->translationMap as $from => $to) {
341
-            $uri = preg_replace($from, $to, $uri);
340
+        foreach ( $this->translationMap as $from => $to ) {
341
+            $uri = preg_replace( $from, $to, $uri );
342 342
         }
343 343
 
344 344
         // translate references to local files within the json-schema package
345
-        $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
345
+        $uri = preg_replace( '|^package://|', sprintf( 'file://%s/', realpath( __DIR__ . '/../../..' ) ), $uri );
346 346
 
347 347
         return $uri;
348 348
     }
Please login to merge, or discard this patch.
vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
     /**
32 32
      * @param object $object
33 33
      */
34
-    public function __construct($object)
34
+    public function __construct( $object )
35 35
     {
36 36
         $this->object = $object;
37 37
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
     {
44 44
         $this->initialize();
45 45
 
46
-        return $this->data[$this->position];
46
+        return $this->data[ $this->position ];
47 47
     }
48 48
 
49 49
     /**
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     {
73 73
         $this->initialize();
74 74
 
75
-        return isset($this->data[$this->position]);
75
+        return isset( $this->data[ $this->position ] );
76 76
     }
77 77
 
78 78
     /**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     {
92 92
         $this->initialize();
93 93
 
94
-        return count($this->data);
94
+        return count( $this->data );
95 95
     }
96 96
 
97 97
     /**
@@ -99,8 +99,8 @@  discard block
 block discarded – undo
99 99
      */
100 100
     private function initialize()
101 101
     {
102
-        if (!$this->initialized) {
103
-            $this->data = $this->buildDataFromObject($this->object);
102
+        if ( ! $this->initialized ) {
103
+            $this->data = $this->buildDataFromObject( $this->object );
104 104
             $this->initialized = true;
105 105
         }
106 106
     }
@@ -110,22 +110,22 @@  discard block
 block discarded – undo
110 110
      *
111 111
      * @return array
112 112
      */
113
-    private function buildDataFromObject($object)
113
+    private function buildDataFromObject( $object )
114 114
     {
115 115
         $result = array();
116 116
 
117 117
         $stack = new \SplStack();
118
-        $stack->push($object);
118
+        $stack->push( $object );
119 119
 
120
-        while (!$stack->isEmpty()) {
120
+        while ( ! $stack->isEmpty() ) {
121 121
             $current = $stack->pop();
122
-            if (is_object($current)) {
123
-                array_push($result, $current);
122
+            if ( is_object( $current ) ) {
123
+                array_push( $result, $current );
124 124
             }
125 125
 
126
-            foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
127
-                if (is_object($propertyValue) || is_array($propertyValue)) {
128
-                    $stack->push($propertyValue);
126
+            foreach ( $this->getDataFromItem( $current ) as $propertyName => $propertyValue ) {
127
+                if ( is_object( $propertyValue ) || is_array( $propertyValue ) ) {
128
+                    $stack->push( $propertyValue );
129 129
                 }
130 130
             }
131 131
         }
@@ -138,12 +138,12 @@  discard block
 block discarded – undo
138 138
      *
139 139
      * @return array
140 140
      */
141
-    private function getDataFromItem($item)
141
+    private function getDataFromItem( $item )
142 142
     {
143
-        if (!is_object($item) && !is_array($item)) {
143
+        if ( ! is_object( $item ) && ! is_array( $item ) ) {
144 144
             return array();
145 145
         }
146 146
 
147
-        return is_object($item) ? get_object_vars($item) : $item;
147
+        return is_object( $item ) ? get_object_vars( $item ) : $item;
148 148
     }
149 149
 }
Please login to merge, or discard this patch.