@@ -4,10 +4,10 @@ discard block |
||
4 | 4 | { |
5 | 5 | $schemaUrl = 'http://specs.frictionlessdata.io/schemas/table-schema.json'; |
6 | 6 | $base_filename = realpath(dirname(__FILE__)) |
7 | - .DIRECTORY_SEPARATOR.'src' |
|
8 | - .DIRECTORY_SEPARATOR.'schemas' |
|
7 | + .DIRECTORY_SEPARATOR . 'src' |
|
8 | + .DIRECTORY_SEPARATOR . 'schemas' |
|
9 | 9 | .DIRECTORY_SEPARATOR; |
10 | - $filename = $base_filename.'table-schema.json'; |
|
10 | + $filename = $base_filename . 'table-schema.json'; |
|
11 | 11 | $old_schema = file_exists($filename) ? file_get_contents($filename) : 'FORCE UPDATE'; |
12 | 12 | echo "downloading schema from {$schemaUrl}\n"; |
13 | 13 | $new_schema = file_get_contents($schemaUrl); |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | } else { |
17 | 17 | echo "schema changed - updating local file\n"; |
18 | 18 | file_put_contents($filename, $new_schema); |
19 | - file_put_contents($base_filename.'LAST_UPDATE', date('c')); |
|
19 | + file_put_contents($base_filename . 'LAST_UPDATE', date('c')); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | return 0; |
@@ -10,7 +10,7 @@ |
||
10 | 10 | public function __construct($dataSource, $options = null) |
11 | 11 | { |
12 | 12 | $this->dataSource = $dataSource; |
13 | - $this->options = empty($options) ? (object) [] : $options; |
|
13 | + $this->options = empty($options) ? (object)[] : $options; |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | public function open() |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $this->applyForeignKeysResourceHack($descriptor); |
61 | 61 | $validator->validate( |
62 | 62 | $descriptor, |
63 | - (object) ['$ref' => 'file://'.realpath(dirname(__FILE__)).'/schemas/table-schema.json'] |
|
63 | + (object)['$ref' => 'file://' . realpath(dirname(__FILE__)) . '/schemas/table-schema.json'] |
|
64 | 64 | ); |
65 | 65 | if (!$validator->isValid()) { |
66 | 66 | foreach ($validator->getErrors() as $error) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | protected function validateKeys() |
76 | 76 | { |
77 | - $fieldNames = array_map(function ($field) { |
|
77 | + $fieldNames = array_map(function($field) { |
|
78 | 78 | return $field->name; |
79 | 79 | }, $this->descriptor->fields); |
80 | 80 | if (isset($this->descriptor->primaryKey)) { |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | && isset($foreignKey->reference) && is_object($foreignKey->reference) |
126 | 126 | && isset($foreignKey->reference->resource) && !empty($foreignKey->reference->resource) |
127 | 127 | ) { |
128 | - $foreignKey->reference->resource = 'void://'.$foreignKey->reference->resource; |
|
128 | + $foreignKey->reference->resource = 'void://' . $foreignKey->reference->resource; |
|
129 | 129 | } |
130 | 130 | } |
131 | 131 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | */ |
70 | 70 | public static function getErrorMessages($validationErrors) |
71 | 71 | { |
72 | - return implode(', ', array_map(function ($validationError) { |
|
72 | + return implode(', ', array_map(function($validationError) { |
|
73 | 73 | /* @var SchemaValidationError $validationError */ |
74 | 74 | return $validationError->getMessage(); |
75 | 75 | }, $validationErrors)); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | { |
10 | 10 | public function __construct($descriptor = null) |
11 | 11 | { |
12 | - $this->descriptor = empty($descriptor) ? (object) [] : $descriptor; |
|
12 | + $this->descriptor = empty($descriptor) ? (object)[] : $descriptor; |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | public function descriptor() |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | if (!$this->constraintsDisabled && isset($this->descriptor()->constraints)) { |
42 | 42 | return $this->descriptor()->constraints; |
43 | 43 | } else { |
44 | - return (object) []; |
|
44 | + return (object)[]; |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | |
282 | 282 | protected function checkPatternConstraint($val, $pattern) |
283 | 283 | { |
284 | - return preg_match('/^'.$pattern.'$/', $val) === 1; |
|
284 | + return preg_match('/^' . $pattern . '$/', $val) === 1; |
|
285 | 285 | } |
286 | 286 | |
287 | 287 | protected function checkMinimumConstraint($val, $minConstraint) |
@@ -17,8 +17,8 @@ |
||
17 | 17 | if (!is_numeric($val)) { |
18 | 18 | throw $this->getValidationException('value must be numeric', $val); |
19 | 19 | } else { |
20 | - $intVal = (int) $val; |
|
21 | - if ($intVal != (float) $val) { |
|
20 | + $intVal = (int)$val; |
|
21 | + if ($intVal != (float)$val) { |
|
22 | 22 | throw $this->getValidationException('value must be an integer', $val); |
23 | 23 | } else { |
24 | 24 | return $intVal; |
@@ -94,7 +94,7 @@ |
||
94 | 94 | { |
95 | 95 | $rowFields = []; |
96 | 96 | foreach ($row as $k => $v) { |
97 | - $rowFields[$k] = FieldsFactory::infer($v, (object) ['name' => $k], $this->lenient); |
|
97 | + $rowFields[$k] = FieldsFactory::infer($v, (object)['name' => $k], $this->lenient); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | return $rowFields; |
@@ -17,7 +17,7 @@ |
||
17 | 17 | if (!is_numeric($val)) { |
18 | 18 | throw $this->getValidationException('value must be numeric', $val); |
19 | 19 | } else { |
20 | - return (float) $val; |
|
20 | + return (float)$val; |
|
21 | 21 | } |
22 | 22 | } |
23 | 23 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $inferId = parent::getInferIdentifier(); |
42 | 42 | $format = $this->format(); |
43 | 43 | if (!$lenient && !empty($format)) { |
44 | - $inferId .= ':'.$this->format(); |
|
44 | + $inferId .= ':' . $this->format(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | return $inferId; |