@@ -9,6 +9,9 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | abstract class BaseValidator extends SchemaValidator |
| 11 | 11 | { |
| 12 | + /** |
|
| 13 | + * @param string $basePath |
|
| 14 | + */ |
|
| 12 | 15 | public function __construct($descriptor, $basePath = null) |
| 13 | 16 | { |
| 14 | 17 | $this->basePath = $basePath; |
@@ -122,6 +125,9 @@ discard block |
||
| 122 | 125 | $this->validateSchemaUrl($this->getValidationSchemaUrl()); |
| 123 | 126 | } |
| 124 | 127 | |
| 128 | + /** |
|
| 129 | + * @param string $url |
|
| 130 | + */ |
|
| 125 | 131 | protected function validateSchemaUrl($url) |
| 126 | 132 | { |
| 127 | 133 | $validator = new \JsonSchema\Validator(); |
@@ -141,7 +147,7 @@ discard block |
||
| 141 | 147 | * Add an error to the validator object - errors are aggregated and returned by validate function. |
| 142 | 148 | * |
| 143 | 149 | * @param int $code |
| 144 | - * @param null|mixed $extraDetails |
|
| 150 | + * @param string $extraDetails |
|
| 145 | 151 | */ |
| 146 | 152 | protected function addError($code, $extraDetails = null) |
| 147 | 153 | { |
@@ -70,6 +70,9 @@ |
||
| 70 | 70 | return ResourceValidator::validate($resourceDescriptor, $this->basePath); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | + /** |
|
| 74 | + * @param string $profile |
|
| 75 | + */ |
|
| 73 | 76 | protected function getJsonSchemaFileFromRegistry($profile) |
| 74 | 77 | { |
| 75 | 78 | if ($filename = Registry::getJsonSchemaFile($profile)) { |
@@ -229,6 +229,8 @@ discard block |
||
| 229 | 229 | /** |
| 230 | 230 | * allows extending classes to add custom sources |
| 231 | 231 | * used by unit tests to add a mock http source. |
| 232 | + * @param string $source |
|
| 233 | + * @return string |
|
| 232 | 234 | */ |
| 233 | 235 | protected static function normalizeHttpSource($source) |
| 234 | 236 | { |
@@ -238,6 +240,7 @@ discard block |
||
| 238 | 240 | /** |
| 239 | 241 | * allows extending classes to add custom sources |
| 240 | 242 | * used by unit tests to add a mock http source. |
| 243 | + * @param string $source |
|
| 241 | 244 | */ |
| 242 | 245 | protected static function isHttpSource($source) |
| 243 | 246 | { |
@@ -251,7 +254,7 @@ discard block |
||
| 251 | 254 | * - normalized basePath. |
| 252 | 255 | * |
| 253 | 256 | * @param $source |
| 254 | - * @param $basePath |
|
| 257 | + * @param null|string $basePath |
|
| 255 | 258 | * |
| 256 | 259 | * @return object |
| 257 | 260 | * |
@@ -321,16 +324,25 @@ discard block |
||
| 321 | 324 | return (object) ['descriptor' => $descriptor, 'basePath' => $basePath]; |
| 322 | 325 | } |
| 323 | 326 | |
| 327 | + /** |
|
| 328 | + * @param string $source |
|
| 329 | + */ |
|
| 324 | 330 | protected static function isHttpZipSource($source) |
| 325 | 331 | { |
| 326 | 332 | return strtolower(substr($source, -4)) == '.zip'; |
| 327 | 333 | } |
| 328 | 334 | |
| 335 | + /** |
|
| 336 | + * @param string $source |
|
| 337 | + */ |
|
| 329 | 338 | protected static function isFileZipSource($source) |
| 330 | 339 | { |
| 331 | 340 | return strtolower(substr($source, -4)) == '.zip'; |
| 332 | 341 | } |
| 333 | 342 | |
| 343 | + /** |
|
| 344 | + * @param string $source |
|
| 345 | + */ |
|
| 334 | 346 | protected static function loadHttpZipSource($source) |
| 335 | 347 | { |
| 336 | 348 | $tempfile = tempnam(sys_get_temp_dir(), 'datapackage-php'); |
@@ -342,6 +354,9 @@ discard block |
||
| 342 | 354 | return self::loadFileZipSource($tempfile); |
| 343 | 355 | } |
| 344 | 356 | |
| 357 | + /** |
|
| 358 | + * @param string $source |
|
| 359 | + */ |
|
| 345 | 360 | protected static function loadFileZipSource($source) |
| 346 | 361 | { |
| 347 | 362 | $zippy = Zippy::load(); |