@@ -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)) { |
@@ -224,6 +224,9 @@ |
||
| 224 | 224 | return DatapackageValidator::validate($this->descriptor(), $this->basePath); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | + /** |
|
| 228 | + * @param string $profile |
|
| 229 | + */ |
|
| 227 | 230 | protected static function handlesProfile($profile) |
| 228 | 231 | { |
| 229 | 232 | return false; |
@@ -204,7 +204,7 @@ |
||
| 204 | 204 | } |
| 205 | 205 | $packageCopy->saveDescriptor($files['datapackage.json']); |
| 206 | 206 | |
| 207 | - register_shutdown_function(function () use ($base) { |
|
| 207 | + register_shutdown_function(function() use ($base) { |
|
| 208 | 208 | Utils::removeDir($base); |
| 209 | 209 | }); |
| 210 | 210 | if ($zip->open($zip_filename, ZipArchive::CREATE | ZipArchive::OVERWRITE) === true) { |
@@ -251,6 +251,9 @@ |
||
| 251 | 251 | |
| 252 | 252 | abstract protected function getInlineDataStream($data); |
| 253 | 253 | |
| 254 | + /** |
|
| 255 | + * @param string $profile |
|
| 256 | + */ |
|
| 254 | 257 | protected static function handlesProfile($profile) |
| 255 | 258 | { |
| 256 | 259 | return false; |
@@ -44,6 +44,9 @@ discard block |
||
| 44 | 44 | return $this->descriptor->profile; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | + /** |
|
| 48 | + * @param boolean|string $filename |
|
| 49 | + */ |
|
| 47 | 50 | protected function convertValidationSchemaFilenameToUrl($filename) |
| 48 | 51 | { |
| 49 | 52 | $filename = realpath($filename); |
@@ -124,6 +127,9 @@ discard block |
||
| 124 | 127 | $this->validateSchemaUrl($this->getValidationSchemaUrl()); |
| 125 | 128 | } |
| 126 | 129 | |
| 130 | + /** |
|
| 131 | + * @param string $url |
|
| 132 | + */ |
|
| 127 | 133 | protected function validateSchemaUrl($url) |
| 128 | 134 | { |
| 129 | 135 | $validator = new \JsonSchema\Validator(); |
@@ -143,7 +149,7 @@ discard block |
||
| 143 | 149 | * Add an error to the validator object - errors are aggregated and returned by validate function. |
| 144 | 150 | * |
| 145 | 151 | * @param int $code |
| 146 | - * @param null|mixed $extraDetails |
|
| 152 | + * @param string $extraDetails |
|
| 147 | 153 | */ |
| 148 | 154 | protected function addError($code, $extraDetails = null) |
| 149 | 155 | { |
@@ -229,9 +229,9 @@ discard block |
||
| 229 | 229 | * allows extending classes to add custom sources |
| 230 | 230 | * used by unit tests to add a mock http source. |
| 231 | 231 | * |
| 232 | - * @param $source |
|
| 232 | + * @param string $source |
|
| 233 | 233 | * |
| 234 | - * @return mixed |
|
| 234 | + * @return string |
|
| 235 | 235 | */ |
| 236 | 236 | protected static function normalizeHttpSource($source) |
| 237 | 237 | { |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | /** |
| 242 | 242 | * allows extending classes to add custom sources |
| 243 | 243 | * used by unit tests to add a mock http source. |
| 244 | - * @param $source |
|
| 244 | + * @param string $source |
|
| 245 | 245 | * @return bool |
| 246 | 246 | */ |
| 247 | 247 | protected static function isHttpSource($source) |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * - normalized basePath. |
| 257 | 257 | * |
| 258 | 258 | * @param $source |
| 259 | - * @param $basePath |
|
| 259 | + * @param null|string $basePath |
|
| 260 | 260 | * |
| 261 | 261 | * @return object |
| 262 | 262 | * |
@@ -332,18 +332,24 @@ discard block |
||
| 332 | 332 | return (object) ['descriptor' => $descriptor, 'basePath' => $basePath]; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | + /** |
|
| 336 | + * @param string $source |
|
| 337 | + */ |
|
| 335 | 338 | protected static function isHttpZipSource($source) |
| 336 | 339 | { |
| 337 | 340 | return strtolower(substr($source, -4)) == '.zip'; |
| 338 | 341 | } |
| 339 | 342 | |
| 343 | + /** |
|
| 344 | + * @param string $source |
|
| 345 | + */ |
|
| 340 | 346 | protected static function isFileZipSource($source) |
| 341 | 347 | { |
| 342 | 348 | return strtolower(substr($source, -4)) == '.zip'; |
| 343 | 349 | } |
| 344 | 350 | |
| 345 | 351 | /** |
| 346 | - * @param $source |
|
| 352 | + * @param string $source |
|
| 347 | 353 | * |
| 348 | 354 | * @return object |
| 349 | 355 | * @throws \frictionlessdata\datapackage\Exceptions\DatapackageInvalidSourceException |
@@ -364,7 +370,7 @@ discard block |
||
| 364 | 370 | } |
| 365 | 371 | |
| 366 | 372 | /** |
| 367 | - * @param $source |
|
| 373 | + * @param string $source |
|
| 368 | 374 | * |
| 369 | 375 | * @return object |
| 370 | 376 | * @throws \frictionlessdata\datapackage\Exceptions\DatapackageInvalidSourceException |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | unlink($tempfile); |
| 357 | 357 | $tempfile .= '.zip'; |
| 358 | 358 | stream_copy_to_stream(fopen($source, 'r'), fopen($tempfile, 'w')); |
| 359 | - register_shutdown_function(function () use ($tempfile) { |
|
| 359 | + register_shutdown_function(function() use ($tempfile) { |
|
| 360 | 360 | unlink($tempfile); |
| 361 | 361 | }); |
| 362 | 362 | |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | $tempdir = tempnam(sys_get_temp_dir(), 'datapackage-php'); |
| 378 | 378 | unlink($tempdir); |
| 379 | 379 | mkdir($tempdir); |
| 380 | - register_shutdown_function(function () use ($tempdir) { |
|
| 380 | + register_shutdown_function(function() use ($tempdir) { |
|
| 381 | 381 | Utils::removeDir($tempdir); |
| 382 | 382 | }); |
| 383 | 383 | /* @noinspection PhpUnhandledExceptionInspection File existence is checked afterwards anyway */ |