@@ -310,6 +310,10 @@ discard block |
||
| 310 | 310 | return; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | + /** |
|
| 314 | + * @param SingleRow[] $seq |
|
| 315 | + * @param string $field |
|
| 316 | + */ |
|
| 313 | 317 | protected function quickSortExec($seq, $field) |
| 314 | 318 | { |
| 315 | 319 | if (!count($seq)) { |
@@ -337,7 +341,7 @@ discard block |
||
| 337 | 341 | |
| 338 | 342 | /** |
| 339 | 343 | * @param $document |
| 340 | - * @return array|string |
|
| 344 | + * @return string |
|
| 341 | 345 | */ |
| 342 | 346 | public static function fixUTF8($document) |
| 343 | 347 | { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | foreach ($fields as $field) { |
| 106 | 106 | $attr = $field->attributes->getNamedItem("name"); |
| 107 | 107 | if (is_null($attr)) { |
| 108 | - throw new \InvalidArgumentException('Malformed anydataset file ' . basename($filepath)); |
|
| 108 | + throw new \InvalidArgumentException('Malformed anydataset file '.basename($filepath)); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | $sr->addField($attr->nodeValue, $field->nodeValue); |
@@ -322,7 +322,7 @@ discard block |
||
| 322 | 322 | $left = $right = array(); |
| 323 | 323 | |
| 324 | 324 | $cntSeq = count($seq); |
| 325 | - for ($i = 1; $i < $cntSeq; $i ++) { |
|
| 325 | + for ($i = 1; $i < $cntSeq; $i++) { |
|
| 326 | 326 | if ($seq[$i]->getField($field) <= $key->getField($field)) { |
| 327 | 327 | $left[] = $seq[$i]; |
| 328 | 328 | } else { |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | return array_merge( |
| 334 | 334 | $this->quickSortExec($left, $field), |
| 335 | - [ $key ], |
|
| 335 | + [$key], |
|
| 336 | 336 | $this->quickSortExec($right, $field) |
| 337 | 337 | ); |
| 338 | 338 | } |
@@ -94,6 +94,10 @@ |
||
| 94 | 94 | return null; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | + /** |
|
| 98 | + * @param string $buffer |
|
| 99 | + * @param FixedTextDefinition[] $fieldDefinition |
|
| 100 | + */ |
|
| 97 | 101 | protected function processBuffer($buffer, $fieldDefinition) |
| 98 | 102 | { |
| 99 | 103 | $cntDef = count($fieldDefinition); |
@@ -103,7 +103,7 @@ |
||
| 103 | 103 | $fields[$fieldDef->fieldName] = substr($buffer, $fieldDef->startPos, $fieldDef->length); |
| 104 | 104 | if (!empty($fieldDef->requiredValue) |
| 105 | 105 | && ( |
| 106 | - !preg_match("/^[" . $fieldDef->requiredValue . "]$/", $fields[$fieldDef->fieldName]) |
|
| 106 | + !preg_match("/^[".$fieldDef->requiredValue."]$/", $fields[$fieldDef->fieldName]) |
|
| 107 | 107 | ) |
| 108 | 108 | ) { |
| 109 | 109 | throw new IteratorException( |
@@ -160,6 +160,9 @@ |
||
| 160 | 160 | $this->fieldDeliRight = $right; |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | + /** |
|
| 164 | + * @param string $sql |
|
| 165 | + */ |
|
| 163 | 166 | public static function createSafeSQL($sql, $list) |
| 164 | 167 | { |
| 165 | 168 | return str_replace(array_keys($list), array_values($list), $sql); |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $campos .= ", "; |
| 80 | 80 | $valores .= ", "; |
| 81 | 81 | } |
| 82 | - $campos .= $this->fieldDeliLeft . $fieldname . $this->fieldDeliRight; |
|
| 82 | + $campos .= $this->fieldDeliLeft.$fieldname.$this->fieldDeliRight; |
|
| 83 | 83 | $valores .= $this->getValue($fieldname, $fieldvalue, $param, $decimalpoint); |
| 84 | 84 | } |
| 85 | 85 | $sql = "insert into $table ($campos) values ($valores)"; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | protected function getValue($name, $valores, &$param, $decimalpoint) |
| 105 | 105 | { |
| 106 | - $paramName = "[[" . $name . "]]"; |
|
| 106 | + $paramName = "[[".$name."]]"; |
|
| 107 | 107 | if (!is_array($valores)) { |
| 108 | 108 | $valores = array(SQLFieldType::TEXT, $valores); |
| 109 | 109 | } |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if (strlen($sql) > 4) { |
| 152 | 152 | $sql .= ' and '; |
| 153 | 153 | } |
| 154 | - $sql = " $fieldName " . $relation . " " . $this->getValue($fieldName, $value, $param, '.'); |
|
| 154 | + $sql = " $fieldName ".$relation." ".$this->getValue($fieldName, $value, $param, '.'); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public function setFieldDelimeters($left, $right) |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | 96 | * @param $idDocument |
| 97 | - * @param null $collection |
|
| 97 | + * @param string $collection |
|
| 98 | 98 | * @return \ByJG\AnyDataset\NoSqlDocument|null |
| 99 | 99 | */ |
| 100 | 100 | public function getDocumentById($idDocument, $collection = null) |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | 114 | * @param \ByJG\AnyDataset\Dataset\IteratorFilter $filter |
| 115 | - * @param null $collection |
|
| 115 | + * @param null|string $collection |
|
| 116 | 116 | * @return \ByJG\AnyDataset\NoSqlDocument[]|null |
| 117 | 117 | */ |
| 118 | 118 | public function getDocuments(IteratorFilter $filter, $collection = null) |
@@ -162,37 +162,37 @@ |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | switch ($relation) { |
| 165 | - case Relation::EQUAL: |
|
| 166 | - $result[$name] = $value; |
|
| 167 | - break; |
|
| 165 | + case Relation::EQUAL: |
|
| 166 | + $result[$name] = $value; |
|
| 167 | + break; |
|
| 168 | 168 | |
| 169 | - case Relation::GREATER_THAN: |
|
| 170 | - $result[$name] = [ '$gt' => $value ]; |
|
| 171 | - break; |
|
| 169 | + case Relation::GREATER_THAN: |
|
| 170 | + $result[$name] = [ '$gt' => $value ]; |
|
| 171 | + break; |
|
| 172 | 172 | |
| 173 | - case Relation::LESS_THAN: |
|
| 174 | - $result[$name] = [ '$lt' => $value ]; |
|
| 175 | - break; |
|
| 173 | + case Relation::LESS_THAN: |
|
| 174 | + $result[$name] = [ '$lt' => $value ]; |
|
| 175 | + break; |
|
| 176 | 176 | |
| 177 | - case Relation::GREATER_OR_EQUAL_THAN: |
|
| 178 | - $result[$name] = [ '$gte' => $value ]; |
|
| 179 | - break; |
|
| 177 | + case Relation::GREATER_OR_EQUAL_THAN: |
|
| 178 | + $result[$name] = [ '$gte' => $value ]; |
|
| 179 | + break; |
|
| 180 | 180 | |
| 181 | - case Relation::LESS_OR_EQUAL_THAN: |
|
| 182 | - $result[$name] = [ '$lte' => $value ]; |
|
| 183 | - break; |
|
| 181 | + case Relation::LESS_OR_EQUAL_THAN: |
|
| 182 | + $result[$name] = [ '$lte' => $value ]; |
|
| 183 | + break; |
|
| 184 | 184 | |
| 185 | - case Relation::NOT_EQUAL: |
|
| 186 | - $result[$name] = [ '$ne' => $value ]; |
|
| 187 | - break; |
|
| 185 | + case Relation::NOT_EQUAL: |
|
| 186 | + $result[$name] = [ '$ne' => $value ]; |
|
| 187 | + break; |
|
| 188 | 188 | |
| 189 | - case Relation::STARTS_WITH: |
|
| 190 | - $result[$name] = [ '$regex' => "^$value" ]; |
|
| 191 | - break; |
|
| 189 | + case Relation::STARTS_WITH: |
|
| 190 | + $result[$name] = [ '$regex' => "^$value" ]; |
|
| 191 | + break; |
|
| 192 | 192 | |
| 193 | - case Relation::CONTAINS: |
|
| 194 | - $result[$name] = [ '$regex' => "$value" ]; |
|
| 195 | - break; |
|
| 193 | + case Relation::CONTAINS: |
|
| 194 | + $result[$name] = [ '$regex' => "$value" ]; |
|
| 195 | + break; |
|
| 196 | 196 | |
| 197 | 197 | } |
| 198 | 198 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | $dataCursor = $this->mongoManager->executeQuery( |
| 125 | - $this->database . '.' . $collection, |
|
| 125 | + $this->database.'.'.$collection, |
|
| 126 | 126 | $this->getMongoFilterArray($filter) |
| 127 | 127 | ); |
| 128 | 128 | |
@@ -167,31 +167,31 @@ discard block |
||
| 167 | 167 | break; |
| 168 | 168 | |
| 169 | 169 | case Relation::GREATER_THAN: |
| 170 | - $result[$name] = [ '$gt' => $value ]; |
|
| 170 | + $result[$name] = ['$gt' => $value]; |
|
| 171 | 171 | break; |
| 172 | 172 | |
| 173 | 173 | case Relation::LESS_THAN: |
| 174 | - $result[$name] = [ '$lt' => $value ]; |
|
| 174 | + $result[$name] = ['$lt' => $value]; |
|
| 175 | 175 | break; |
| 176 | 176 | |
| 177 | 177 | case Relation::GREATER_OR_EQUAL_THAN: |
| 178 | - $result[$name] = [ '$gte' => $value ]; |
|
| 178 | + $result[$name] = ['$gte' => $value]; |
|
| 179 | 179 | break; |
| 180 | 180 | |
| 181 | 181 | case Relation::LESS_OR_EQUAL_THAN: |
| 182 | - $result[$name] = [ '$lte' => $value ]; |
|
| 182 | + $result[$name] = ['$lte' => $value]; |
|
| 183 | 183 | break; |
| 184 | 184 | |
| 185 | 185 | case Relation::NOT_EQUAL: |
| 186 | - $result[$name] = [ '$ne' => $value ]; |
|
| 186 | + $result[$name] = ['$ne' => $value]; |
|
| 187 | 187 | break; |
| 188 | 188 | |
| 189 | 189 | case Relation::STARTS_WITH: |
| 190 | - $result[$name] = [ '$regex' => "^$value" ]; |
|
| 190 | + $result[$name] = ['$regex' => "^$value"]; |
|
| 191 | 191 | break; |
| 192 | 192 | |
| 193 | 193 | case Relation::CONTAINS: |
| 194 | - $result[$name] = [ '$regex' => "$value" ]; |
|
| 194 | + $result[$name] = ['$regex' => "$value"]; |
|
| 195 | 195 | break; |
| 196 | 196 | |
| 197 | 197 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | |
| 220 | 220 | $bulkWrite->delete($this->getMongoFilterArray($filter)); |
| 221 | 221 | $this->mongoManager->executeBulkWrite( |
| 222 | - $this->database . '.' . $collection, |
|
| 222 | + $this->database.'.'.$collection, |
|
| 223 | 223 | $bulkWrite, |
| 224 | 224 | $writeConcern |
| 225 | 225 | ); |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | $idDocument = isset($data['_id']) ? $data['_id'] : null; |
| 242 | 242 | } |
| 243 | 243 | |
| 244 | - $data['updated'] = new UTCDateTime((new \DateTime())->getTimestamp()*1000); |
|
| 244 | + $data['updated'] = new UTCDateTime((new \DateTime())->getTimestamp() * 1000); |
|
| 245 | 245 | if (empty($idDocument)) { |
| 246 | 246 | $data['_id'] = $idDocument = new ObjectID(); |
| 247 | - $data['created'] = new UTCDateTime((new \DateTime())->getTimestamp()*1000); |
|
| 247 | + $data['created'] = new UTCDateTime((new \DateTime())->getTimestamp() * 1000); |
|
| 248 | 248 | $bulkWrite->insert($data); |
| 249 | 249 | } else { |
| 250 | 250 | $data['_id'] = $idDocument; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $this->mongoManager->executeBulkWrite( |
| 255 | - $this->database . "." . $document->getCollection(), |
|
| 255 | + $this->database.".".$document->getCollection(), |
|
| 256 | 256 | $bulkWrite, |
| 257 | 257 | $writeConcern |
| 258 | 258 | ); |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | $documentToUpdate = new NoSqlDocument( |
| 101 | 101 | $document[0]->getIdDocument(), |
| 102 | 102 | self::TEST_COLLECTION, |
| 103 | - [ 'price' => 150000 ] |
|
| 103 | + ['price' => 150000] |
|
| 104 | 104 | ); |
| 105 | 105 | sleep(1); // Just to force a new Update DateTime |
| 106 | 106 | $documentSaved = $this->dbDriver->save($documentToUpdate); |
@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | $connectionString, |
| 28 | 28 | array_merge( |
| 29 | 29 | [ |
| 30 | - "sqlrelay" => $prefix . "DbSqlRelayDriver", |
|
| 31 | - "oci8" => $prefix . "DbOci8Driver", |
|
| 32 | - "dblib" => $prefix . "PdoDblib", |
|
| 33 | - "mysql" => $prefix . "PdoMysql", |
|
| 34 | - "pgsql" => $prefix . "PdoPgsql", |
|
| 35 | - "oci" => $prefix . "PdoOci", |
|
| 36 | - "odbc" => $prefix . "PdoOdbc", |
|
| 37 | - "sqlite" => $prefix . "PdoSqlite", |
|
| 30 | + "sqlrelay" => $prefix."DbSqlRelayDriver", |
|
| 31 | + "oci8" => $prefix."DbOci8Driver", |
|
| 32 | + "dblib" => $prefix."PdoDblib", |
|
| 33 | + "mysql" => $prefix."PdoMysql", |
|
| 34 | + "pgsql" => $prefix."PdoPgsql", |
|
| 35 | + "oci" => $prefix."PdoOci", |
|
| 36 | + "odbc" => $prefix."PdoOdbc", |
|
| 37 | + "sqlite" => $prefix."PdoSqlite", |
|
| 38 | 38 | ], |
| 39 | 39 | (array)$schemesAlternative |
| 40 | 40 | ), |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | $connectionString, |
| 58 | 58 | array_merge( |
| 59 | 59 | [ |
| 60 | - "mongodb" => $prefix . "MongoDbDriver", |
|
| 60 | + "mongodb" => $prefix."MongoDbDriver", |
|
| 61 | 61 | ], |
| 62 | 62 | (array)$schemesAlternative |
| 63 | 63 | ), |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $connectionString, |
| 76 | 76 | array_merge( |
| 77 | 77 | [ |
| 78 | - "s3" => $prefix . "AwsS3Driver", |
|
| 78 | + "s3" => $prefix."AwsS3Driver", |
|
| 79 | 79 | ], |
| 80 | 80 | (array)$schemesAlternative |
| 81 | 81 | ), |
@@ -57,8 +57,8 @@ |
||
| 57 | 57 | throw new DatasetException("Socket error: $errstr ($errno)"); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - $out = "GET " . $this->path . " HTTP/1.1\r\n"; |
|
| 61 | - $out .= "Host: " . $this->server . "\r\n"; |
|
| 60 | + $out = "GET ".$this->path." HTTP/1.1\r\n"; |
|
| 61 | + $out .= "Host: ".$this->server."\r\n"; |
|
| 62 | 62 | $out .= "Connection: Close\r\n\r\n"; |
| 63 | 63 | |
| 64 | 64 | fwrite($handle, $out); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | |
| 38 | 38 | if (!preg_match("~^https?://~", $source)) { |
| 39 | 39 | if (!file_exists($this->source)) { |
| 40 | - throw new NotFoundException("The specified file " . $this->source . " does not exists"); |
|
| 40 | + throw new NotFoundException("The specified file ".$this->source." does not exists"); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $this->sourceType = "FILE"; |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | throw new DatasetException("TextFileDataset Socket error: $errstr ($errno)"); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $out = "GET " . $urlParts[4] . " HTTP/1.1\r\n"; |
|
| 84 | - $out .= "Host: " . $urlParts[2] . "\r\n"; |
|
| 83 | + $out = "GET ".$urlParts[4]." HTTP/1.1\r\n"; |
|
| 84 | + $out .= "Host: ".$urlParts[2]."\r\n"; |
|
| 85 | 85 | $out .= "Connection: Close\r\n\r\n"; |
| 86 | 86 | |
| 87 | 87 | fwrite($handle, $out); |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | if (function_exists('dba_open')) { |
| 31 | - $cache = sys_get_temp_dir() . "/caps.db"; |
|
| 31 | + $cache = sys_get_temp_dir()."/caps.db"; |
|
| 32 | 32 | $this->connection->capabilityCache($cache); |
| 33 | 33 | } |
| 34 | 34 | } |