@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | public function import($assoc_data): self |
| 65 | 65 | { |
| 66 | 66 | if (!is_array($assoc_data)) { |
| 67 | - throw new \Exception(__FUNCTION__ . '(assoc_data) parm is not an array'); |
|
| 67 | + throw new \Exception(__FUNCTION__.'(assoc_data) parm is not an array'); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // shove it all up in model, god will sort them out |
@@ -99,17 +99,17 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | if ($table_name === false) { |
| 101 | 101 | $shortName = $reflectionClass->getShortName(); |
| 102 | - $table_name = defined($const_name = 'TABLE_' . strtoupper($shortName)) ? constant($const_name) : strtolower($shortName); |
|
| 102 | + $table_name = defined($const_name = 'TABLE_'.strtoupper($shortName)) ? constant($const_name) : strtolower($shortName); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | return $table_name; |
| 106 | 106 | $table_name = $called_class->getConstant('TABLE_NAME'); |
| 107 | - if($table_name !== false) |
|
| 107 | + if ($table_name !== false) |
|
| 108 | 108 | return $table_name; |
| 109 | 109 | |
| 110 | 110 | $class_name = $called_class->getShortName(); |
| 111 | 111 | |
| 112 | - if (defined($const_name = 'TABLE_' . strtoupper($class_name))) |
|
| 112 | + if (defined($const_name = 'TABLE_'.strtoupper($class_name))) |
|
| 113 | 113 | return constant($const_name); |
| 114 | 114 | |
| 115 | 115 | return strtolower($class_name); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $table = get_called_class()::table(); |
| 168 | 168 | |
| 169 | 169 | // case 3 |
| 170 | - if(is_array($arg1) && !empty($arg1)) |
|
| 170 | + if (is_array($arg1) && !empty($arg1)) |
|
| 171 | 171 | { |
| 172 | 172 | $unique_identifiers = $arg1; |
| 173 | 173 | } |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | - public static function any($field_exact_values=[], $options = []) |
|
| 253 | + public static function any($field_exact_values = [], $options = []) |
|
| 254 | 254 | { |
| 255 | 255 | $select = static::filter($field_exact_values, $options); |
| 256 | 256 | return static::retrieve($select); |
@@ -104,13 +104,15 @@ discard block |
||
| 104 | 104 | |
| 105 | 105 | return $table_name; |
| 106 | 106 | $table_name = $called_class->getConstant('TABLE_NAME'); |
| 107 | - if($table_name !== false) |
|
| 108 | - return $table_name; |
|
| 107 | + if($table_name !== false) { |
|
| 108 | + return $table_name; |
|
| 109 | + } |
|
| 109 | 110 | |
| 110 | 111 | $class_name = $called_class->getShortName(); |
| 111 | 112 | |
| 112 | - if (defined($const_name = 'TABLE_' . strtoupper($class_name))) |
|
| 113 | - return constant($const_name); |
|
| 113 | + if (defined($const_name = 'TABLE_' . strtoupper($class_name))) { |
|
| 114 | + return constant($const_name); |
|
| 115 | + } |
|
| 114 | 116 | |
| 115 | 117 | return strtolower($class_name); |
| 116 | 118 | } |
@@ -183,9 +185,9 @@ discard block |
||
| 183 | 185 | { |
| 184 | 186 | $pk = current($table->primaryKeys())->name(); |
| 185 | 187 | $unique_identifiers = [$pk => $arg1]; |
| 186 | - } |
|
| 187 | - else |
|
| 188 | - throw new CruditesException('ARGUMENTS_ARE_NOT_ACTIONNABLE'); |
|
| 188 | + } else { |
|
| 189 | + throw new CruditesException('ARGUMENTS_ARE_NOT_ACTIONNABLE'); |
|
| 190 | + } |
|
| 189 | 191 | |
| 190 | 192 | |
| 191 | 193 | // Find the unique identifier(s) in the database. |
@@ -244,8 +246,7 @@ discard block |
||
| 244 | 246 | { |
| 245 | 247 | try { |
| 246 | 248 | return self::one($arg1, $arg2); |
| 247 | - } |
|
| 248 | - catch (CruditesException $e) { |
|
| 249 | + } catch (CruditesException $e) { |
|
| 249 | 250 | return null; |
| 250 | 251 | } |
| 251 | 252 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function __construct(string $class) |
| 15 | 15 | { |
| 16 | - if(class_exists($class) === false) |
|
| 16 | + if (class_exists($class) === false) |
|
| 17 | 17 | throw new \Exception('CLASS_NOT_FOUND'); |
| 18 | 18 | |
| 19 | 19 | $this->class = $class; |
@@ -13,8 +13,9 @@ |
||
| 13 | 13 | |
| 14 | 14 | public function __construct(string $class) |
| 15 | 15 | { |
| 16 | - if(class_exists($class) === false) |
|
| 17 | - throw new \Exception('CLASS_NOT_FOUND'); |
|
| 16 | + if(class_exists($class) === false) { |
|
| 17 | + throw new \Exception('CLASS_NOT_FOUND'); |
|
| 18 | + } |
|
| 18 | 19 | |
| 19 | 20 | $this->class = $class; |
| 20 | 21 | $this->table = $this->class::table(); |
@@ -51,10 +51,10 @@ |
||
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | if (isset($options['limit'])) { |
| 54 | - if(is_array($options['limit'])){ |
|
| 54 | + if (is_array($options['limit'])) { |
|
| 55 | 55 | $this->statement()->limit($options['limit'][0], $options['limit'][1]); |
| 56 | 56 | } |
| 57 | - elseif(is_numeric($options['limit'])){ |
|
| 57 | + elseif (is_numeric($options['limit'])) { |
|
| 58 | 58 | $this->statement()->limit($options['limit']); |
| 59 | 59 | } |
| 60 | 60 | } |
@@ -53,8 +53,7 @@ |
||
| 53 | 53 | if (isset($options['limit'])) { |
| 54 | 54 | if(is_array($options['limit'])){ |
| 55 | 55 | $this->statement()->limit($options['limit'][0], $options['limit'][1]); |
| 56 | - } |
|
| 57 | - elseif(is_numeric($options['limit'])){ |
|
| 56 | + } elseif(is_numeric($options['limit'])){ |
|
| 58 | 57 | $this->statement()->limit($options['limit']); |
| 59 | 58 | } |
| 60 | 59 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function __toString() |
| 14 | 14 | { |
| 15 | - return static::class_short_name() . ' #' . $this->id(); |
|
| 15 | + return static::class_short_name().' #'.$this->id(); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | public function nid(): string |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function urn(): string |
| 24 | 24 | { |
| 25 | - return $this->nid() . ':' . $this->id(); |
|
| 25 | + return $this->nid().':'.$this->id(); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function immortal(): bool |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public static function tableAlias(): string |
| 162 | 162 | { |
| 163 | - if (defined(get_called_class() . '::TABLE_ALIAS')) { |
|
| 163 | + if (defined(get_called_class().'::TABLE_ALIAS')) { |
|
| 164 | 164 | return get_called_class()::TABLE_ALIAS; |
| 165 | 165 | } |
| 166 | 166 | |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | |
| 170 | 170 | public static function model_type(): string |
| 171 | 171 | { |
| 172 | - if (defined(get_called_class() . '::MODEL_TYPE')) { |
|
| 172 | + if (defined(get_called_class().'::MODEL_TYPE')) { |
|
| 173 | 173 | return get_called_class()::MODEL_TYPE; |
| 174 | 174 | } |
| 175 | 175 | |