@@ -58,7 +58,7 @@ |
||
58 | 58 | $count = 0; |
59 | 59 | while ($result = $stmt->fetch()) { |
60 | 60 | $name = $result['column_name']; |
61 | - $count ++; |
|
61 | + $count++; |
|
62 | 62 | } |
63 | 63 | $stmt->closeCursor(); |
64 | 64 |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | */ |
41 | 41 | public function getPrimaryKeyColumn(string $table, \Nkey\Caribu\Orm\Orm $orm): string |
42 | 42 | { |
43 | - $query = "select ccu.column_name as column_name from information_schema.constraint_column_usage ccu " . "inner join information_schema.table_constraints tc on ccu.constraint_name = tc.constraint_name " . "where tc.table_catalog = '{schema}' AND tc.table_name = '{table}'"; |
|
43 | + $query = "select ccu.column_name as column_name from information_schema.constraint_column_usage ccu "."inner join information_schema.table_constraints tc on ccu.constraint_name = tc.constraint_name "."where tc.table_catalog = '{schema}' AND tc.table_name = '{table}'"; |
|
44 | 44 | |
45 | 45 | return $this->getPrimaryColumnViaSql($orm, $table, $query); |
46 | 46 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | protected function getTypeQuery(): string |
91 | 91 | { |
92 | - $query = "select data_type from information_schema.columns where table_catalog = '{schema}' " . "and table_name = '{table}' and column_name = '{column}'"; |
|
92 | + $query = "select data_type from information_schema.columns where table_catalog = '{schema}' "."and table_name = '{table}' and column_name = '{column}'"; |
|
93 | 93 | |
94 | 94 | return $query; |
95 | 95 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | { |
140 | 140 | $sequenceName = null; |
141 | 141 | |
142 | - $query = "select column_default from information_schema.columns where table_catalog = '{schema}' " . "AND table_name = '{table}' and column_name = '{column}'"; |
|
142 | + $query = "select column_default from information_schema.columns where table_catalog = '{schema}' "."AND table_name = '{table}' and column_name = '{column}'"; |
|
143 | 143 | |
144 | 144 | $sql = $this->interp($query, array( |
145 | 145 | 'schema' => $orm->getSchema(), |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function getPrimaryKeyColumn(string $table, \Nkey\Caribu\Orm\Orm $orm): string |
40 | 40 | { |
41 | - $query = "SELECT `COLUMN_NAME` as column_name FROM `information_schema`.`columns` " . // |
|
41 | + $query = "SELECT `COLUMN_NAME` as column_name FROM `information_schema`.`columns` ".// |
|
42 | 42 | "WHERE `TABLE_NAME` = '{table}' AND `TABLE_SCHEMA` = '{schema}' AND `COLUMN_KEY` = 'PRI'"; |
43 | 43 | |
44 | 44 | return $this->getPrimaryColumnViaSql($orm, $table, $query); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | */ |
97 | 97 | protected function getTypeQuery(): string |
98 | 98 | { |
99 | - $query = "SELECT `DATA_TYPE` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = '{schema}' " . "AND `TABLE_NAME` = '{table}' AND `COLUMN_NAME` = '{column}'"; |
|
99 | + $query = "SELECT `DATA_TYPE` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA` = '{schema}' "."AND `TABLE_NAME` = '{table}' AND `COLUMN_NAME` = '{column}'"; |
|
100 | 100 | |
101 | 101 | return $query; |
102 | 102 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | */ |
64 | 64 | public function getDefaultPort(): int |
65 | 65 | { |
66 | - return - 1; |
|
66 | + return -1; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | /** |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $type = self::getAnnotatedPropertyType($toClass, $property->getName(), $namespace); |
153 | 153 | |
154 | - if (null === $type || self::isPrimitive($type) || ! class_exists($type)) { |
|
154 | + if (null === $type || self::isPrimitive($type) || !class_exists($type)) { |
|
155 | 155 | return array( |
156 | 156 | $type, |
157 | 157 | $value |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | foreach ($rfClass->getProperties() as $property) { |
244 | 244 | $docComment = $property->getDocComment(); |
245 | 245 | |
246 | - if (! self::isIdAnnotated($docComment)) { |
|
246 | + if (!self::isIdAnnotated($docComment)) { |
|
247 | 247 | continue; |
248 | 248 | } |
249 | 249 | |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | |
256 | 256 | $primaryKey = $rfMethod->invoke($object); |
257 | 257 | |
258 | - if (! $onlyValue) { |
|
258 | + if (!$onlyValue) { |
|
259 | 259 | $primaryKey = array( |
260 | 260 | $columnName => $primaryKey |
261 | 261 | ); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | private static function getAnnotatedType(string $comment, string $namespace = null): string |
284 | 284 | { |
285 | 285 | $matches = array(); |
286 | - if (! preg_match('/@var ([\w\\\\]+)/', $comment, $matches)) { |
|
286 | + if (!preg_match('/@var ([\w\\\\]+)/', $comment, $matches)) { |
|
287 | 287 | return ""; |
288 | 288 | } |
289 | 289 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | |
296 | 296 | $type = self::fullQualifiedName($namespace, $type); |
297 | 297 | |
298 | - if (! class_exists($type)) { |
|
298 | + if (!class_exists($type)) { |
|
299 | 299 | throw new OrmException("Annotated type {type} could not be found nor loaded", array( |
300 | 300 | 'type' => $matches[1] |
301 | 301 | )); |
@@ -59,7 +59,7 @@ |
||
59 | 59 | try { |
60 | 60 | $rfMethod = new \ReflectionMethod($class, $method); |
61 | 61 | $primaryKey = $rfMethod->invoke($object); |
62 | - if (! $onlyValue) { |
|
62 | + if (!$onlyValue) { |
|
63 | 63 | $primaryKey = array( |
64 | 64 | $pkCol => $primaryKey |
65 | 65 | ); |
@@ -121,15 +121,15 @@ |
||
121 | 121 | private static function persistProperty(\ReflectionProperty $property, string $class, \Nkey\Caribu\Model\AbstractModel $object, string $namespace, bool $persist) |
122 | 122 | { |
123 | 123 | try { |
124 | - if (null !== ($type = self::getAnnotatedType($property->getDocComment(), $namespace)) && ! self::isPrimitive($type)) { |
|
125 | - if (! $persist && self::isCascadeAnnotated($property->getDocComment())) { |
|
124 | + if (null !== ($type = self::getAnnotatedType($property->getDocComment(), $namespace)) && !self::isPrimitive($type)) { |
|
125 | + if (!$persist && self::isCascadeAnnotated($property->getDocComment())) { |
|
126 | 126 | $persist = true; |
127 | 127 | } |
128 | 128 | |
129 | 129 | $rfMethod = new \ReflectionMethod($class, sprintf("get%s", ucfirst($property->getName()))); |
130 | 130 | $entity = $rfMethod->invoke($object); |
131 | 131 | if ($entity instanceof \Nkey\Caribu\Model\AbstractModel) { |
132 | - if (! $persist && count($pk = self::getAnnotatedPrimaryKey($type, $entity, false))) { |
|
132 | + if (!$persist && count($pk = self::getAnnotatedPrimaryKey($type, $entity, false))) { |
|
133 | 133 | list ($pkCol) = $pk; |
134 | 134 | if (is_empty($pk[$pkCol])) { |
135 | 135 | $persist = true; |
@@ -38,15 +38,15 @@ discard block |
||
38 | 38 | try { |
39 | 39 | $date = \DateTime::createFromFormat("Y-m-d", $value); |
40 | 40 | |
41 | - if (! $date) { |
|
41 | + if (!$date) { |
|
42 | 42 | $date = \DateTime::createFromFormat("Y-m-d H:i:s", $value); |
43 | 43 | } |
44 | 44 | |
45 | - if (! $date) { |
|
45 | + if (!$date) { |
|
46 | 46 | $date = \DateTime::createFromFormat(\DateTime::W3C, $value); |
47 | 47 | } |
48 | 48 | |
49 | - if (! $date) { |
|
49 | + if (!$date) { |
|
50 | 50 | $date = \DateTime::createFromFormat(\DateTime::ISO8601, $value); |
51 | 51 | } |
52 | 52 | } catch (\Exception $exception) { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | private static function convertType(string $type, $value) |
72 | 72 | { |
73 | - if (! $type) { |
|
73 | + if (!$type) { |
|
74 | 74 | return $value; |
75 | 75 | } |
76 | 76 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | return strval($value); |
99 | 99 | |
100 | 100 | default: |
101 | - if (! self::isInternalClass($type)) { |
|
101 | + if (!self::isInternalClass($type)) { |
|
102 | 102 | return $value; |
103 | 103 | } |
104 | 104 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | $limits = self::parseLimits($limit, $startFrom); |
47 | 47 | |
48 | - if ($orderBy && ! stristr($orderBy, 'ORDER BY ')) { |
|
48 | + if ($orderBy && !stristr($orderBy, 'ORDER BY ')) { |
|
49 | 49 | $orderBy = sprintf("ORDER BY %s%s%s", $escapeSign, $orderBy, $escapeSign); |
50 | 50 | } |
51 | 51 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } elseif (strtoupper(substr($criteria[$criterion], 0, 7)) == 'BETWEEN') { |
138 | 138 | $start = $end = null; |
139 | 139 | sscanf(strtoupper($criteria[$criterion]), "BETWEEN %s AND %s", $start, $end); |
140 | - if (! $start || ! $end) { |
|
140 | + if (!$start || !$end) { |
|
141 | 141 | throw new OrmException("Invalid range for between"); |
142 | 142 | } |
143 | 143 | $wheres[] = sprintf("%s BETWEEN %s AND %s", self::escapeCriterion($criterion, $escapeSign), $start, $end); |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | if ($conditions) { |
167 | 167 | $and = substr($where, 0, 3) == 'OR ' ? " " : " AND "; |
168 | 168 | } |
169 | - $conditions .= $and . $where; |
|
169 | + $conditions .= $and.$where; |
|
170 | 170 | } |
171 | 171 | $wheres = sprintf("WHERE %s", $conditions); |
172 | 172 | } else { |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | { |
261 | 261 | $class = new \ReflectionClass($className); |
262 | 262 | $simpleCriterion = self::getSimpleCriterionName($criterion); |
263 | - if (! $class->hasProperty($simpleCriterion)) { |
|
263 | + if (!$class->hasProperty($simpleCriterion)) { |
|
264 | 264 | return $criterion; |
265 | 265 | } |
266 | 266 | |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | $propertyClass = ""; |
324 | 324 | // search the type of property value |
325 | 325 | if (null !== ($type = self::getAnnotatedType($rfProperty->getDocComment(), $rf->getNamespaceName()))) { |
326 | - if (! self::isPrimitive($type) && class_exists($type)) { |
|
326 | + if (!self::isPrimitive($type) && class_exists($type)) { |
|
327 | 327 | $propertyClass = $type; |
328 | 328 | } |
329 | 329 | } |