| @@ -170,11 +170,11 @@ | ||
| 170 | 170 |          try { | 
| 171 | 171 | $response = $this->guzzleHttpClient->send($request, ['allow_redirects' => false]); | 
| 172 | 172 | $responseHeader = $response->getHeaders(); | 
| 173 | - $responseBody = json_decode((string) $response->getBody(), true); | |
| 173 | + $responseBody = json_decode((string)$response->getBody(), true); | |
| 174 | 174 | $statusReturned = $response->getStatusCode(); | 
| 175 | 175 |          } catch (BadResponseException $ex) { | 
| 176 | 176 | $responseHeader = $ex->getResponse()->getHeaders(); | 
| 177 | - $responseBody = json_decode((string) $ex->getResponse()->getBody(), true); | |
| 177 | + $responseBody = json_decode((string)$ex->getResponse()->getBody(), true); | |
| 178 | 178 | $statusReturned = $ex->getResponse()->getStatusCode(); | 
| 179 | 179 | } | 
| 180 | 180 | |
| @@ -33,6 +33,9 @@ discard block | ||
| 33 | 33 | $this->guzzleHttpClient = new Client(['headers' => ['User-Agent' => 'Swagger Test']]); | 
| 34 | 34 | } | 
| 35 | 35 | |
| 36 | + /** | |
| 37 | + * @param SwaggerSchema $schema | |
| 38 | + */ | |
| 36 | 39 | public function withSwaggerSchema($schema) | 
| 37 | 40 |      { | 
| 38 | 41 | $this->swaggerSchema = $schema; | 
| @@ -105,6 +108,9 @@ discard block | ||
| 105 | 108 | return $this; | 
| 106 | 109 | } | 
| 107 | 110 | |
| 111 | + /** | |
| 112 | + * @param integer $code | |
| 113 | + */ | |
| 108 | 114 | public function assertResponseCode($code) | 
| 109 | 115 |      { | 
| 110 | 116 | $this->statusExpected = $code; | 
| @@ -8,8 +8,8 @@ discard block | ||
| 8 | 8 | |
| 9 | 9 | abstract class SwaggerBody | 
| 10 | 10 |  { | 
| 11 | - const SWAGGER_PROPERTIES="properties"; | |
| 12 | - const SWAGGER_REQUIRED="required"; | |
| 11 | + const SWAGGER_PROPERTIES = "properties"; | |
| 12 | + const SWAGGER_REQUIRED = "required"; | |
| 13 | 13 | |
| 14 | 14 | /** | 
| 15 | 15 | * @var \ByJG\Swagger\SwaggerSchema | 
| @@ -146,27 +146,27 @@ discard block | ||
| 146 | 146 | $type = $schema['type']; | 
| 147 | 147 | |
| 148 | 148 | $validators = [ | 
| 149 | - function () use ($name, $body, $type) | |
| 149 | + function() use ($name, $body, $type) | |
| 150 | 150 |              { | 
| 151 | 151 | return $this->matchNull($name, $body, $type); | 
| 152 | 152 | }, | 
| 153 | 153 | |
| 154 | - function () use ($name, $schema, $body, $type) | |
| 154 | + function() use ($name, $schema, $body, $type) | |
| 155 | 155 |              { | 
| 156 | 156 | return $this->matchString($name, $schema, $body, $type); | 
| 157 | 157 | }, | 
| 158 | 158 | |
| 159 | - function () use ($name, $body, $type) | |
| 159 | + function() use ($name, $body, $type) | |
| 160 | 160 |              { | 
| 161 | 161 | return $this->matchNumber($name, $body, $type); | 
| 162 | 162 | }, | 
| 163 | 163 | |
| 164 | - function () use ($name, $body, $type) | |
| 164 | + function() use ($name, $body, $type) | |
| 165 | 165 |              { | 
| 166 | 166 | return $this->matchBool($name, $body, $type); | 
| 167 | 167 | }, | 
| 168 | 168 | |
| 169 | - function () use ($name, $schema, $body, $type) | |
| 169 | + function() use ($name, $schema, $body, $type) | |
| 170 | 170 |              { | 
| 171 | 171 | return $this->matchArray($name, $schema, $body, $type); | 
| 172 | 172 | } | 
| @@ -266,7 +266,7 @@ discard block | ||
| 266 | 266 | return true; | 
| 267 | 267 | } | 
| 268 | 268 | |
| 269 | -        if(!isset($schema['$ref']) && isset($schema['content'])) { | |
| 269 | +        if (!isset($schema['$ref']) && isset($schema['content'])) { | |
| 270 | 270 | $schema['$ref'] = $schema['content'][key($schema['content'])]['schema']['$ref']; | 
| 271 | 271 | } | 
| 272 | 272 | |
| @@ -20,14 +20,14 @@ discard block | ||
| 20 | 20 | protected $allowNullValues; | 
| 21 | 21 | protected $specificationVersion; | 
| 22 | 22 | |
| 23 | - const SWAGGER_PATHS="paths"; | |
| 24 | - const SWAGGER_PARAMETERS="parameters"; | |
| 25 | - const SWAGGER_COMPONENTS="components"; | |
| 23 | + const SWAGGER_PATHS = "paths"; | |
| 24 | + const SWAGGER_PARAMETERS = "parameters"; | |
| 25 | + const SWAGGER_COMPONENTS = "components"; | |
| 26 | 26 | |
| 27 | 27 | public function __construct($jsonFile, $allowNullValues = false) | 
| 28 | 28 |      { | 
| 29 | 29 | $this->jsonFile = json_decode($jsonFile, true); | 
| 30 | - $this->allowNullValues = (bool) $allowNullValues; | |
| 30 | + $this->allowNullValues = (bool)$allowNullValues; | |
| 31 | 31 | $this->specificationVersion = isset($this->jsonFile['swagger']) ? '2' : '3'; | 
| 32 | 32 | } | 
| 33 | 33 | |
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 | public function getBasePath() | 
| 59 | 59 |      { | 
| 60 | 60 |          if ($this->getSpecificationVersion() === '3') { | 
| 61 | -            $basePath =isset($this->jsonFile['servers']) ? explode('/', $this->jsonFile['servers'][0]['url']) : ''; | |
| 61 | +            $basePath = isset($this->jsonFile['servers']) ? explode('/', $this->jsonFile['servers'][0]['url']) : ''; | |
| 62 | 62 | return is_array($basePath) ? '/' . end($basePath) : $basePath; | 
| 63 | 63 | } | 
| 64 | 64 | |
| @@ -217,7 +217,7 @@ discard block | ||
| 217 | 217 |      { | 
| 218 | 218 | $structure = $this->getPathDefinition($path, $method); | 
| 219 | 219 | |
| 220 | -        if($this->getSpecificationVersion() === '3') { | |
| 220 | +        if ($this->getSpecificationVersion() === '3') { | |
| 221 | 221 |              if (!isset($structure['requestBody'])) { | 
| 222 | 222 | return new SwaggerRequestBody($this, "$method $path", []); | 
| 223 | 223 | } | 
| @@ -271,6 +271,6 @@ discard block | ||
| 271 | 271 | */ | 
| 272 | 272 | public function setAllowNullValues($value) | 
| 273 | 273 |      { | 
| 274 | - $this->allowNullValues = (bool) $value; | |
| 274 | + $this->allowNullValues = (bool)$value; | |
| 275 | 275 | } | 
| 276 | 276 | } |