Completed
Push — master ( 3c3b41...d36340 )
by Ori
01:42
created
src/Validators/BaseValidator.php 2 patches
Doc Comments   +7 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,6 +9,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     {
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace frictionlessdata\datapackage\Validators;
4 4
 
5
-use frictionlessdata\datapackage\Registry;
6 5
 use frictionlessdata\datapackage\Utils;
7 6
 use frictionlessdata\tableschema\SchemaValidator;
8 7
 use frictionlessdata\tableschema\SchemaValidationError;
Please login to merge, or discard this patch.
src/Validators/DatapackageValidator.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -70,6 +70,9 @@
 block discarded – undo
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)) {
Please login to merge, or discard this patch.
src/Factory.php 2 patches
Doc Comments   +16 added lines, -1 removed lines patch added patch discarded remove patch
@@ -229,6 +229,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
         unlink($tempfile);
338 338
         $tempfile .= '.zip';
339 339
         stream_copy_to_stream(fopen($source, 'r'), fopen($tempfile, 'w'));
340
-        register_shutdown_function(function () use ($tempfile) {unlink($tempfile); });
340
+        register_shutdown_function(function() use ($tempfile) {unlink($tempfile); });
341 341
 
342 342
         return self::loadFileZipSource($tempfile);
343 343
     }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         $tempdir = tempnam(sys_get_temp_dir(), 'datapackage-php');
349 349
         unlink($tempdir);
350 350
         mkdir($tempdir);
351
-        register_shutdown_function(function () use ($tempdir) {Utils::removeDir($tempdir); });
351
+        register_shutdown_function(function() use ($tempdir) {Utils::removeDir($tempdir); });
352 352
         $zippy->open($source)->extract($tempdir);
353 353
         if (!file_exists($tempdir.'/datapackage.json')) {
354 354
             throw new Exceptions\DatapackageInvalidSourceException('zip file must contain a datappackage.json file');
Please login to merge, or discard this patch.