@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace LoginCidadao\OAuthBundle\Entity; |
| 3 | 3 | |
| 4 | 4 | use Doctrine\ORM\Mapping as ORM; |
| 5 | -use Symfony\Component\Validator\Constraints as Assert; |
|
| 6 | 5 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
| 7 | 6 | |
| 8 | 7 | /** |
@@ -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); |
@@ -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=NGA&t=9", $filename)) { |
|
| 9 | +if (!file_get_contents_curl("http://www.geopostcodes.com/inc/download.php?f=NGA&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_NGA.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, ';'); |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $st3 = $pdo->prepare('update state set fips = ?, name = ?, class = ?, country_id = (select id from country where iso = ?) where id = ?'); |
| 39 | 39 | $st4 = $pdo->prepare('insert into state (id, country_id, fips, name, class) values (nextval(\'state_id_seq\'), (select id from country where iso = ?), ?, ?, ?)'); |
| 40 | 40 | while ($row = fgetcsv($f, null, ';')) { |
| 41 | - if (! $st1->execute(array( |
|
| 41 | + if (!$st1->execute(array( |
|
| 42 | 42 | $row[3] |
| 43 | 43 | ))) { |
| 44 | 44 | print_r($row); |
@@ -46,13 +46,13 @@ discard block |
||
| 46 | 46 | exit(1); |
| 47 | 47 | } |
| 48 | 48 | if ($r = $st1->fetchAll()) { |
| 49 | - if (! $st3->execute(array(trim2($row[3]), trim2($row[4]), trim2($row[5]), trim2($row[0]), $r[0]['id']))) { |
|
| 49 | + if (!$st3->execute(array(trim2($row[3]), trim2($row[4]), trim2($row[5]), trim2($row[0]), $r[0]['id']))) { |
|
| 50 | 50 | print_r($row); |
| 51 | 51 | print_r($pdo->errorInfo()); |
| 52 | 52 | exit(1); |
| 53 | 53 | } |
| 54 | 54 | } else { |
| 55 | - if (! $st2->execute(array( |
|
| 55 | + if (!$st2->execute(array( |
|
| 56 | 56 | $row[0], |
| 57 | 57 | $row[4] |
| 58 | 58 | ))) { |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | exit(1); |
| 62 | 62 | } |
| 63 | 63 | if ($r = $st2->fetchAll()) { |
| 64 | - if (! $st3->execute(array(trim2($row[3]), trim2($row[4]), trim2($row[5]), trim2($row[0]), $r[0]['id']))) { |
|
| 64 | + if (!$st3->execute(array(trim2($row[3]), trim2($row[4]), trim2($row[5]), trim2($row[0]), $r[0]['id']))) { |
|
| 65 | 65 | print_r($row); |
| 66 | 66 | print_r($pdo->errorInfo()); |
| 67 | 67 | exit(1); |
| 68 | 68 | } |
| 69 | 69 | } else { |
| 70 | - if (! $st4->execute(array(trim2($row[0]), trim2($row[3]), trim2($row[4]), trim2($row[5])) )) { |
|
| 70 | + if (!$st4->execute(array(trim2($row[0]), trim2($row[3]), trim2($row[4]), trim2($row[5])))) { |
|
| 71 | 71 | print_r($row); |
| 72 | 72 | print_r($pdo->errorInfo()); |
| 73 | 73 | 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 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | if ($ceps) { |
| 24 | 24 | if (is_numeric($ceps['codigoMunIBGE'])) { |
| 25 | 25 | if ($ceps['codigoMunIBGE'] === 0) { |
| 26 | - if (!$stm3->execute(array('BR-'.$ceps['state'],$ceps['infoAdicional']))) { |
|
| 26 | + if (!$stm3->execute(array('BR-'.$ceps['state'], $ceps['infoAdicional']))) { |
|
| 27 | 27 | print_r($pdo->errorInfo()); |
| 28 | 28 | return false; |
| 29 | 29 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | print_r('dunno'); |
| 50 | 50 | return false; |
| 51 | 51 | } |
| 52 | - } elseif (is_numeric($person['city_id']) && $person['city_id'] == 0) { |
|
| 52 | + } elseif (is_numeric($person['city_id']) && $person['city_id'] == 0) { |
|
| 53 | 53 | if (!$stm1->execute(array(null, null, null, null, $person['id']))) { |
| 54 | 54 | print_r($pdo->errorInfo()); |
| 55 | 55 | return false; |
@@ -12,27 +12,27 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | $this->createDir($directory); |
| 14 | 14 | |
| 15 | - $copySource = 'zip://' . $this->filename . '#'; |
|
| 16 | - for ($i = 0; $i < $this->numFiles; $i ++) { |
|
| 15 | + $copySource = 'zip://'.$this->filename.'#'; |
|
| 16 | + for ($i = 0; $i < $this->numFiles; $i++) { |
|
| 17 | 17 | $entry = $this->getNameIndex($i); |
| 18 | 18 | $filename = basename($entry); |
| 19 | 19 | |
| 20 | 20 | if ($this->matchFileToFilter($filename, $filters)) { |
| 21 | 21 | $base = dirname($entry); |
| 22 | - $newPath = $directory . DIRECTORY_SEPARATOR . $base . DIRECTORY_SEPARATOR; |
|
| 22 | + $newPath = $directory.DIRECTORY_SEPARATOR.$base.DIRECTORY_SEPARATOR; |
|
| 23 | 23 | $this->createDir($newPath); |
| 24 | 24 | |
| 25 | 25 | // extract file |
| 26 | - copy($copySource . $entry, $newPath . $filename); |
|
| 26 | + copy($copySource.$entry, $newPath.$filename); |
|
| 27 | 27 | } |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | protected function createDir($path) |
| 32 | 32 | { |
| 33 | - if (! is_dir($path)) { |
|
| 34 | - if (! mkdir($path, self::CHMOD, true)) { |
|
| 35 | - throw new Exception('unable to create path ' . $path); |
|
| 33 | + if (!is_dir($path)) { |
|
| 34 | + if (!mkdir($path, self::CHMOD, true)) { |
|
| 35 | + throw new Exception('unable to create path '.$path); |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | foreach ($filters as $i => $filter) { |
| 49 | 49 | |
| 50 | - if (! ctype_alnum($filter[0]) && preg_match($filter, $filename)) { |
|
| 50 | + if (!ctype_alnum($filter[0]) && preg_match($filter, $filename)) { |
|
| 51 | 51 | return true; |
| 52 | 52 | } |
| 53 | 53 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $ch = curl_init(); |
| 72 | 72 | // curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 73 | 73 | $f = fopen($file, 'wb'); |
| 74 | - if (! $f) { |
|
| 74 | + if (!$f) { |
|
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | curl_setopt($ch, CURLOPT_FILE, $f); |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | $result = curl_exec($ch); |
| 86 | 86 | if (!$result) { |
| 87 | - echo curl_error ($ch ); |
|
| 87 | + echo curl_error($ch); |
|
| 88 | 88 | } |
| 89 | 89 | curl_close($ch); |
| 90 | 90 | fclose($f); |
@@ -119,9 +119,9 @@ discard block |
||
| 119 | 119 | foreach ($in as $key => $value) { |
| 120 | 120 | $out[utf8_encode_recursivo($key)] = utf8_encode_recursivo($value); |
| 121 | 121 | } |
| 122 | - } elseif(is_string($in)) { |
|
| 123 | - if(!mb_check_encoding($in, 'UTF-8') |
|
| 124 | - OR !($in === mb_convert_encoding(mb_convert_encoding($in, 'UTF-32', 'UTF-8' ), 'UTF-8', 'UTF-32'))) { |
|
| 122 | + } elseif (is_string($in)) { |
|
| 123 | + if (!mb_check_encoding($in, 'UTF-8') |
|
| 124 | + OR !($in === mb_convert_encoding(mb_convert_encoding($in, 'UTF-32', 'UTF-8'), 'UTF-8', 'UTF-32'))) { |
|
| 125 | 125 | $in = mb_convert_encoding($in, 'UTF-8'); |
| 126 | 126 | } |
| 127 | 127 | return $in; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | ); |
| 182 | 182 | $headApp = array_merge($headApp, $header); |
| 183 | 183 | curl_setopt($this->ch, CURLOPT_HTTPHEADER, $headApp); |
| 184 | - if (! $this->cookie) { |
|
| 184 | + if (!$this->cookie) { |
|
| 185 | 185 | $tmp = getenv('TMPDIR'); |
| 186 | 186 | if ($tmp && @is_writable($tmp)) { |
| 187 | 187 | $tmpDir = $tmp; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | 'key' => $this->key, |
| 203 | 203 | 'cep' => $var |
| 204 | 204 | )); |
| 205 | - $url = $this->url . '?' . $data; |
|
| 205 | + $url = $this->url.'?'.$data; |
|
| 206 | 206 | curl_setopt($this->ch, CURLOPT_URL, $url); |
| 207 | 207 | $result = curl_exec($this->ch); |
| 208 | 208 | curl_close($this->ch); |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | 'action' => 'pesquisa', |
| 223 | 223 | 'key' => $this->key |
| 224 | 224 | )); |
| 225 | - curl_setopt($this->ch, CURLOPT_URL, $this->url . '?' . $dataGet); |
|
| 225 | + curl_setopt($this->ch, CURLOPT_URL, $this->url.'?'.$dataGet); |
|
| 226 | 226 | curl_setopt($this->ch, CURLOPT_POST, 1); |
| 227 | 227 | curl_setopt($this->ch, CURLOPT_POSTFIELDS, $data); |
| 228 | 228 | $result = curl_exec($this->ch); |
@@ -235,11 +235,11 @@ discard block |
||
| 235 | 235 | return false; |
| 236 | 236 | } |
| 237 | 237 | $dom = new \DOMDocument(); |
| 238 | - if (! @$dom->loadXML($result)) { |
|
| 238 | + if (!@$dom->loadXML($result)) { |
|
| 239 | 239 | return false; |
| 240 | 240 | } |
| 241 | 241 | $node = $dom->getElementsByTagName('valor'); |
| 242 | - if (! $node) { |
|
| 242 | + if (!$node) { |
|
| 243 | 243 | return false; |
| 244 | 244 | } |
| 245 | 245 | return json_decode($node->item(0)->nodeValue, true); |
@@ -2,7 +2,6 @@ |
||
| 2 | 2 | namespace LoginCidadao\OAuthBundle\Entity; |
| 3 | 3 | |
| 4 | 4 | use Doctrine\ORM\Mapping as ORM; |
| 5 | -use Symfony\Component\Validator\Constraints as Assert; |
|
| 6 | 5 | use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; |
| 7 | 6 | |
| 8 | 7 | /** |