@@ -38,7 +38,7 @@ |
||
38 | 38 | if (!is_numeric($val)) { |
39 | 39 | throw $this->getValidationException('value must be numeric', $val); |
40 | 40 | } else { |
41 | - $val = (float) $val; |
|
41 | + $val = (float)$val; |
|
42 | 42 | if ($isPercent) { |
43 | 43 | $val = $val / 100; |
44 | 44 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | protected function validateCastValue($val) |
25 | 25 | { |
26 | 26 | try { |
27 | - $val = (string) $val; |
|
27 | + $val = (string)$val; |
|
28 | 28 | } catch (\Exception $e) { |
29 | 29 | $val = json_encode($val); |
30 | 30 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $inferId = parent::getInferIdentifier(); |
61 | 61 | $format = $this->format(); |
62 | 62 | if (!$lenient && !empty($format)) { |
63 | - $inferId .= ':'.$this->format(); |
|
63 | + $inferId .= ':' . $this->format(); |
|
64 | 64 | } |
65 | 65 | |
66 | 66 | return $inferId; |
@@ -50,7 +50,7 @@ |
||
50 | 50 | { |
51 | 51 | $parts = [$hour, $minute, $second]; |
52 | 52 | foreach ($parts as &$part) { |
53 | - $part = (int) $part; |
|
53 | + $part = (int)$part; |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | return $parts; |
@@ -37,8 +37,8 @@ |
||
37 | 37 | throw $this->getValidationException("couldn't parse date/time according to given strptime format '{$this->format()}''", $val); |
38 | 38 | } else { |
39 | 39 | return Carbon::create( |
40 | - (int) $date['tm_year'] + 1900, (int) $date['tm_mon'] + 1, (int) $date['tm_mday'], |
|
41 | - (int) $date['tm_hour'], (int) $date['tm_min'], (int) $date['tm_sec'] |
|
40 | + (int)$date['tm_year'] + 1900, (int)$date['tm_mon'] + 1, (int)$date['tm_mday'], |
|
41 | + (int)$date['tm_hour'], (int)$date['tm_min'], (int)$date['tm_sec'] |
|
42 | 42 | ); |
43 | 43 | } |
44 | 44 | } |
@@ -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.'CHANGELOG', "\n\n".date('c')."\n* check the git diff and summarize the spec changes here\n* \n\n", FILE_APPEND); |
|
19 | + file_put_contents($base_filename . 'CHANGELOG', "\n\n" . date('c') . "\n* check the git diff and summarize the spec changes here\n* \n\n", FILE_APPEND); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | return 0; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $descriptor = json_decode(json_encode($this->descriptor)); |
60 | 60 | $validator->validate( |
61 | 61 | $descriptor, |
62 | - (object) ['$ref' => 'file://'.realpath(dirname(__FILE__)).'/schemas/table-schema.json'] |
|
62 | + (object)['$ref' => 'file://' . realpath(dirname(__FILE__)) . '/schemas/table-schema.json'] |
|
63 | 63 | ); |
64 | 64 | if (!$validator->isValid()) { |
65 | 65 | foreach ($validator->getErrors() as $error) { |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | |
74 | 74 | protected function validateKeys() |
75 | 75 | { |
76 | - $fieldNames = array_map(function ($field) { |
|
76 | + $fieldNames = array_map(function($field) { |
|
77 | 77 | return $field->name; |
78 | 78 | }, $this->descriptor->fields); |
79 | 79 | if (isset($this->descriptor->primaryKey)) { |
@@ -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 | abstract public function open(); |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | throw new FieldValidationException([ |
67 | 67 | new SchemaValidationError( |
68 | 68 | SchemaValidationError::SCHEMA_VIOLATION, |
69 | - 'Could not find a valid field for descriptor: '.json_encode($descriptor)), |
|
69 | + 'Could not find a valid field for descriptor: ' . json_encode($descriptor)), |
|
70 | 70 | ]); |
71 | 71 | } |
72 | 72 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | throw new FieldValidationException([ |
91 | 91 | new SchemaValidationError( |
92 | 92 | SchemaValidationError::SCHEMA_VIOLATION, |
93 | - 'Could not find a valid field for value: '.json_encode($val)), |
|
93 | + 'Could not find a valid field for value: ' . json_encode($val)), |
|
94 | 94 | ]); |
95 | 95 | } |
96 | 96 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | * @param $val |
76 | 76 | * @param null $descriptor |
77 | 77 | * |
78 | - * @return mixed |
|
78 | + * @return BaseField |
|
79 | 79 | * |
80 | 80 | * @throws FieldValidationException |
81 | 81 | */ |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function __construct($descriptor = null) |
24 | 24 | { |
25 | 25 | if (is_null($descriptor)) { |
26 | - $this->descriptor = (object) ['fields' => []]; |
|
26 | + $this->descriptor = (object)['fields' => []]; |
|
27 | 27 | } else { |
28 | 28 | if (Utils::isJsonString($descriptor)) { |
29 | 29 | // it's a json encoded string |