@@ -50,7 +50,7 @@ |
||
50 | 50 | */ |
51 | 51 | private static function fullQualifiedName($ns, $class) |
52 | 52 | { |
53 | - if (! class_exists($class)) { |
|
53 | + if (!class_exists($class)) { |
|
54 | 54 | $class = sprintf("\\%s\\%s", $ns, $class); |
55 | 55 | } |
56 | 56 | return $class; |
@@ -38,8 +38,8 @@ |
||
38 | 38 | */ |
39 | 39 | private static function boolval($value) |
40 | 40 | { |
41 | - if (! function_exists('boolval')) { |
|
42 | - return (bool) $value; |
|
41 | + if (!function_exists('boolval')) { |
|
42 | + return (bool)$value; |
|
43 | 43 | } |
44 | 44 | return boolval($value); |
45 | 45 | } |
@@ -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; |