@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | |
36 | 36 | public function validate($value, Constraint $constraint) |
37 | 37 | { |
38 | - if (!isset($value) || $value === null || !strlen(trim($value))) { |
|
38 | + if (!isset($value) || $value === null || !strlen(trim($value))) { |
|
39 | 39 | return; |
40 | 40 | } |
41 | 41 | if (!self::checkLength($value)) { |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | for ($i = 0; $i < $a; $i++) { |
54 | 54 | if ($postal[$i] != '"') { |
55 | 55 | if (is_numeric($postal[$i])) { |
56 | - $exp .= '[0-'. $postal[$i].']{1}'; |
|
56 | + $exp .= '[0-'.$postal[$i].']{1}'; |
|
57 | 57 | } else if ($postal[$i] == ' ') { |
58 | - $exp .= "\\". $postal[$i]; |
|
58 | + $exp .= "\\".$postal[$i]; |
|
59 | 59 | } else { |
60 | 60 | $exp .= $postal[$i]; |
61 | 61 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function validatedBy() |
17 | 17 | { |
18 | - return get_class($this) . 'Validator'; |
|
18 | + return get_class($this).'Validator'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | } |
@@ -28,10 +28,10 @@ |
||
28 | 28 | |
29 | 29 | public function validate($value, Constraint $constraint) |
30 | 30 | { |
31 | - if (! isset($value) || $value === null || ! strlen(trim($value))) { |
|
31 | + if (!isset($value) || $value === null || !strlen(trim($value))) { |
|
32 | 32 | return; |
33 | 33 | } |
34 | - if (! self::isUsernameValid($value)) { |
|
34 | + if (!self::isUsernameValid($value)) { |
|
35 | 35 | $this->context->addViolation($constraint->message); |
36 | 36 | } |
37 | 37 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public function buildForm(FormBuilderInterface $builder, array $options) |
30 | 30 | { |
31 | 31 | $builder->addEventListener(FormEvents::PRE_SET_DATA, |
32 | - function (FormEvent $event) { |
|
32 | + function(FormEvent $event) { |
|
33 | 33 | $form = $event->getForm()->getParent(); |
34 | 34 | $person = $form->getData(); |
35 | 35 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | $form->add('city', new CitySelectorComboType($person->getState())); |
40 | 40 | }); |
41 | 41 | $builder->addEventListener(FormEvents::PRE_SUBMIT, |
42 | - function (FormEvent $event) { |
|
42 | + function(FormEvent $event) { |
|
43 | 43 | $data = $event->getData(); |
44 | 44 | $form = $event->getForm()->getParent(); |
45 | 45 |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | public function validatedBy() |
17 | 17 | { |
18 | - return get_class($this) . 'Validator'; |
|
18 | + return get_class($this).'Validator'; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | } |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | require 'stuff.php'; |
3 | 3 | require 'vendor/autoload.php'; |
4 | 4 | $config = parse_ini_file($argv[1]); |
5 | -if (! $config) { |
|
5 | +if (!$config) { |
|
6 | 6 | echo "Couldn't parse the config file."; |
7 | 7 | exit(1); |
8 | 8 | } |
9 | 9 | $filename = getTempNam(); |
10 | 10 | $year = date("Y"); |
11 | -if (! file_get_contents_curl("ftp://geoftp.ibge.gov.br/organizacao_territorial/divisao_territorial/".$year."/dtb_".$year.".zip", $filename)) { |
|
11 | +if (!file_get_contents_curl("ftp://geoftp.ibge.gov.br/organizacao_territorial/divisao_territorial/".$year."/dtb_".$year.".zip", $filename)) { |
|
12 | 12 | exit(1); |
13 | 13 | } |
14 | 14 | $filename1 = "DTB_".$year."_Municipio.xls"; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | ', ?, ?)'); |
27 | 27 | $st3 = $pdo->prepare('update city set state_id = COALESCE((select a1.id from state a1 inner join country a2 on a1.country_id = a2.id where a2.iso2 = \'BR\' and a1.stat = left(cast(? as varchar), 2)), state_id)'. |
28 | 28 | ', name = ?, stat = ? where id = ?'); |
29 | -PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp, array( 'memoryCacheSize' => '2GB')); |
|
29 | +PHPExcel_Settings::setCacheStorageMethod(PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp, array('memoryCacheSize' => '2GB')); |
|
30 | 30 | $xls = PHPExcel_IOFactory::load($filename1); |
31 | 31 | $sheet = $xls->getSheet(0); |
32 | 32 | foreach ($sheet->getRowIterator(2) as $row) { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | foreach ($row->getCellIterator() as $idx2 => $cell) { |
35 | 35 | $bdRow[$idx2] = utf8_encode_recursivo($cell->getValue()); |
36 | 36 | } |
37 | - if (! $st1->execute(array( |
|
37 | + if (!$st1->execute(array( |
|
38 | 38 | $bdRow[7] |
39 | 39 | ))) { |
40 | 40 | print_r($bdRow); |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | exit(1); |
43 | 43 | } |
44 | 44 | if ($r = $st1->fetchAll()) { |
45 | - if (! $st3->execute(array(trim2($bdRow[7]), trim2($bdRow[8]), trim2($bdRow[7]), $r[0]['id']))) { |
|
45 | + if (!$st3->execute(array(trim2($bdRow[7]), trim2($bdRow[8]), trim2($bdRow[7]), $r[0]['id']))) { |
|
46 | 46 | print_r($bdRow); |
47 | 47 | print_r($pdo->errorInfo()); |
48 | 48 | exit(1); |
49 | 49 | } |
50 | 50 | } else { |
51 | - if (! $st2->execute(array(trim2($bdRow[7]), trim2($bdRow[7]), trim2($bdRow[8]), trim2($bdRow[7])))) { |
|
51 | + if (!$st2->execute(array(trim2($bdRow[7]), trim2($bdRow[7]), trim2($bdRow[8]), trim2($bdRow[7])))) { |
|
52 | 52 | print_r($bdRow); |
53 | 53 | print_r($pdo->errorInfo()); |
54 | 54 | exit(1); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require 'stuff.php'; |
3 | 3 | $config = parse_ini_file($argv[1]); |
4 | -if (! $config) { |
|
4 | +if (!$config) { |
|
5 | 5 | echo "Couldn't parse the config file."; |
6 | 6 | exit(1); |
7 | 7 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | function getCountryPostal($config) |
10 | 10 | { |
11 | 11 | $filename = getTempNam(); |
12 | - if (! file_get_contents_curl("http://www.geopostcodes.com/inc/download.php?f=Countries&t=9", $filename)) { |
|
12 | + if (!file_get_contents_curl("http://www.geopostcodes.com/inc/download.php?f=Countries&t=9", $filename)) { |
|
13 | 13 | return false; |
14 | 14 | } |
15 | 15 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | unlink($filename); |
21 | 21 | $filename = "GeoPC_Countries.csv"; |
22 | 22 | $f = fopen($filename, 'rb'); |
23 | - if (! $f) { |
|
23 | + if (!$f) { |
|
24 | 24 | return false; |
25 | 25 | } |
26 | 26 | $row = fgetcsv($f, null, ';'); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | $st2 = $pdo->prepare('update country set postal_format = ?, postal_name = ? where id = ?'); |
41 | 41 | $st3 = $pdo->prepare('insert into country (id, name, postal_format, postal_name, iso2) values (nextval(\'country_id_seq\'), ?,?,?,?)'); |
42 | 42 | while ($row = fgetcsv($f, null, ';')) { |
43 | - if (! $st1->execute(array( |
|
43 | + if (!$st1->execute(array( |
|
44 | 44 | $row[0] |
45 | 45 | ))) { |
46 | 46 | return false; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $st2->bindParam(1, trim2($row[3]), PDO::PARAM_STR | PDO::PARAM_NULL); |
50 | 50 | $st2->bindParam(2, trim2($row[4]), PDO::PARAM_STR | PDO::PARAM_NULL); |
51 | 51 | $st2->bindParam(3, $r[0]['id'], PDO::PARAM_INT); |
52 | - if (! $st2->execute()) { |
|
52 | + if (!$st2->execute()) { |
|
53 | 53 | print_r($row); |
54 | 54 | print_r($pdo->errorInfo()); |
55 | 55 | exit(1); |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $st3->bindParam(2, trim2($row[3]), PDO::PARAM_STR | PDO::PARAM_NULL); |
60 | 60 | $st3->bindParam(3, trim2($row[4]), PDO::PARAM_STR | PDO::PARAM_NULL); |
61 | 61 | $st3->bindParam(4, trim($row[0]), PDO::PARAM_STR | PDO::PARAM_NULL); |
62 | - if (! $st3->execute()) { |
|
62 | + if (!$st3->execute()) { |
|
63 | 63 | print_r($row); |
64 | 64 | print_r($pdo->errorInfo()); |
65 | 65 | return false; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | function updateByNsg($config) |
75 | 75 | { |
76 | 76 | $filename = getTempNam(); |
77 | - if (! file_get_contents_curl('https://nsgreg.nga.mil/NSGDOC/files/doc/Document/GENC%20Standard%20Index%20XML%20Ed2.0.zip', $filename, 'https://nsgreg.nga.mil/doc/view?i=2382')) { |
|
77 | + if (!file_get_contents_curl('https://nsgreg.nga.mil/NSGDOC/files/doc/Document/GENC%20Standard%20Index%20XML%20Ed2.0.zip', $filename, 'https://nsgreg.nga.mil/doc/view?i=2382')) { |
|
78 | 78 | return false; |
79 | 79 | } |
80 | 80 | |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | unlink($filename); |
88 | 88 | $filename = realpath("./GENC Standard Index Ed2.0.xml"); |
89 | 89 | $dom = new DOMDocument(); |
90 | - if (! $dom->load($filename)) { |
|
90 | + if (!$dom->load($filename)) { |
|
91 | 91 | return false; |
92 | 92 | } |
93 | 93 | $dom->documentElement->removeAttributeNS('http://api.nsgreg.nga.mil/schema/genc/2.0', 'genc'); |
94 | 94 | $xpath = new DOMXPath($dom); |
95 | 95 | // $nodes = $xpath->query('//GENCStandardBaselineIndex/GeopoliticalEntity[encoding/char3Code][encoding/char2Code][encoding/numericCode][name]'); |
96 | 96 | $nodes = $xpath->query('//GENCStandardBaselineIndex/GeopoliticalEntity'); |
97 | - if (! $nodes || ! $nodes->length) { |
|
97 | + if (!$nodes || !$nodes->length) { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | $pdo = getPDOConnection($config); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $pdo->beginTransaction(); |
107 | 107 | foreach ($nodes as $node) { |
108 | 108 | $char3Code = $node->getElementsByTagName('char3Code')->item(0)->nodeValue; |
109 | - if (! $st1->execute(array( |
|
109 | + if (!$st1->execute(array( |
|
110 | 110 | $char3Code |
111 | 111 | ))) { |
112 | 112 | print_r($char3Code); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | return false; |
115 | 115 | } |
116 | 116 | if ($r = $st1->fetchAll()) { |
117 | - if (! $st2->execute(array( |
|
117 | + if (!$st2->execute(array( |
|
118 | 118 | $node->getElementsByTagName('name') |
119 | 119 | ->item(0)->nodeValue, |
120 | 120 | $r[0]['id'] |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | return false; |
125 | 125 | } |
126 | 126 | } else { |
127 | - if (! $st3->execute(array( |
|
127 | + if (!$st3->execute(array( |
|
128 | 128 | $node->getElementsByTagName('name') |
129 | 129 | ->item(0)->nodeValue, |
130 | 130 | $node->getElementsByTagName('char2Code') |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | $xpath = new DOMXPath($dom); |
155 | 155 | // $nodes = $xpath->query('//GENCStandardBaselineIndex/AdministrativeSubdivision[country][encoding/char6Code][name]'); |
156 | 156 | $nodes = $xpath->query('//GENCStandardBaselineIndex/AdministrativeSubdivision'); |
157 | - if (! $nodes || ! $nodes->length) { |
|
157 | + if (!$nodes || !$nodes->length) { |
|
158 | 158 | return false; |
159 | 159 | } |
160 | 160 | foreach ($nodes as $node) { |
161 | 161 | $char6Code = $node->getElementsByTagName('char6Code')->item(0)->nodeValue; |
162 | - if (! $st1->execute(array( |
|
162 | + if (!$st1->execute(array( |
|
163 | 163 | $char6Code |
164 | 164 | ))) { |
165 | 165 | print_r($char6Code); |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | exit(1); |
168 | 168 | } |
169 | 169 | if ($r = $st1->fetchAll()) { |
170 | - if (! $st3->execute(array( |
|
170 | + if (!$st3->execute(array( |
|
171 | 171 | $char6Code, |
172 | 172 | $node->getElementsByTagName('name') |
173 | 173 | ->item(0)->nodeValue, |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | exit(1); |
181 | 181 | } |
182 | 182 | } else { |
183 | - if (! $st2->execute(array( |
|
183 | + if (!$st2->execute(array( |
|
184 | 184 | $node->getElementsByTagName('country') |
185 | 185 | ->item(0)->nodeValue, |
186 | 186 | $node->getElementsByTagName('name') |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | exit(1); |
192 | 192 | } |
193 | 193 | if ($r = $st2->fetchAll()) { |
194 | - if (! $st3->execute(array( |
|
194 | + if (!$st3->execute(array( |
|
195 | 195 | $char6Code, |
196 | 196 | $node->getElementsByTagName('name') |
197 | 197 | ->item(0)->nodeValue, |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | exit(1); |
205 | 205 | } |
206 | 206 | } else { |
207 | - if (! $st4->execute(array( |
|
207 | + if (!$st4->execute(array( |
|
208 | 208 | $node->getElementsByTagName('country') |
209 | 209 | ->item(0)->nodeValue, |
210 | 210 | $char6Code, |
@@ -2,7 +2,7 @@ |
||
2 | 2 | require 'stuff.php'; |
3 | 3 | ini_set('memory_limit', -1); |
4 | 4 | $config = parse_ini_file($argv[1]); |
5 | -if (! $config) { |
|
5 | +if (!$config) { |
|
6 | 6 | echo "Couldn't parse the config file."; |
7 | 7 | exit(1); |
8 | 8 | } |
@@ -1,12 +1,12 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | require 'stuff.php'; |
3 | 3 | $config = parse_ini_file($argv[1]); |
4 | -if (! $config) { |
|
4 | +if (!$config) { |
|
5 | 5 | echo "Couldn't parse the config file."; |
6 | 6 | exit(1); |
7 | 7 | } |
8 | 8 | $filename = getTempNam(); |
9 | -if (! file_get_contents_curl("http://www.geopostcodes.com/inc/download.php?f=ISO3166-2&t=9", $filename)) { |
|
9 | +if (!file_get_contents_curl("http://www.geopostcodes.com/inc/download.php?f=ISO3166-2&t=9", $filename)) { |
|
10 | 10 | exit(1); |
11 | 11 | } |
12 | 12 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | unlink($filename); |
18 | 18 | $filename = "GeoPC_ISO3166-2.csv"; |
19 | 19 | $f = fopen($filename, 'rb'); |
20 | -if (! $f) { |
|
20 | +if (!$f) { |
|
21 | 21 | exit(1); |
22 | 22 | } |
23 | 23 | $row = fgetcsv($f, null, ';'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $st3 = $pdo->prepare('update state set iso = ?, name = ?, country_id = (select id from country where iso = ?) where id = ?'); |
38 | 38 | $st4 = $pdo->prepare('insert into state (id, country_id, iso, name) values (nextval(\'state_id_seq\'), (select id from country where iso = ?), ?, ?)'); |
39 | 39 | while ($row = fgetcsv($f, null, ';')) { |
40 | - if (! $st1->execute(array( |
|
40 | + if (!$st1->execute(array( |
|
41 | 41 | $row[2] |
42 | 42 | ))) { |
43 | 43 | print_r($row); |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | exit(1); |
46 | 46 | } |
47 | 47 | if ($r = $st1->fetchAll()) { |
48 | - if (! $st3->execute(array(trim2($row[2]), trim2($row[3]), trim2($row[5]), trim2($row[0]), $r[0]['id']))) { |
|
48 | + if (!$st3->execute(array(trim2($row[2]), trim2($row[3]), trim2($row[5]), trim2($row[0]), $r[0]['id']))) { |
|
49 | 49 | print_r($row); |
50 | 50 | print_r($pdo->errorInfo()); |
51 | 51 | exit(1); |
52 | 52 | } |
53 | 53 | } else { |
54 | - if (! $st2->execute(array( |
|
54 | + if (!$st2->execute(array( |
|
55 | 55 | $row[0], |
56 | 56 | $row[3] |
57 | 57 | ))) { |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | exit(1); |
61 | 61 | } |
62 | 62 | if ($r = $st2->fetchAll()) { |
63 | - if (! $st3->execute(array(trim2($row[2]), trim2($row[3]), trim2($row[0]), $r[0]['id']))) { |
|
63 | + if (!$st3->execute(array(trim2($row[2]), trim2($row[3]), trim2($row[0]), $r[0]['id']))) { |
|
64 | 64 | print_r($row); |
65 | 65 | print_r($pdo->errorInfo()); |
66 | 66 | exit(1); |
67 | 67 | } |
68 | 68 | } else { |
69 | 69 | |
70 | - if (true || ! $st4->execute(array(trim2($row[0]), trim2($row[2]), trim2($row[3])) )) { |
|
70 | + if (true || !$st4->execute(array(trim2($row[0]), trim2($row[2]), trim2($row[3])))) { |
|
71 | 71 | print_r($row); |
72 | 72 | print_r($pdo->errorInfo()); |
73 | 73 | exit(1); |