@@ -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(); |
@@ -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 | } |
@@ -92,13 +92,15 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | return $table_name; |
| 94 | 94 | $table_name = $called_class->getConstant('TABLE_NAME'); |
| 95 | - if($table_name !== false) |
|
| 96 | - return $table_name; |
|
| 95 | + if($table_name !== false) { |
|
| 96 | + return $table_name; |
|
| 97 | + } |
|
| 97 | 98 | |
| 98 | 99 | $class_name = $called_class->getShortName(); |
| 99 | 100 | |
| 100 | - if (defined($const_name = 'TABLE_' . strtoupper($class_name))) |
|
| 101 | - return constant($const_name); |
|
| 101 | + if (defined($const_name = 'TABLE_' . strtoupper($class_name))) { |
|
| 102 | + return constant($const_name); |
|
| 103 | + } |
|
| 102 | 104 | |
| 103 | 105 | return strtolower($class_name); |
| 104 | 106 | } |
@@ -114,8 +116,7 @@ discard block |
||
| 114 | 116 | if($this->isNew()){ |
| 115 | 117 | // $table_row = new Row($this, $model_data); |
| 116 | 118 | $table_row = new Row($this->schema, static::table(), $model_data); |
| 117 | - } |
|
| 118 | - else{ |
|
| 119 | + } else{ |
|
| 119 | 120 | $table_row = new Row($this->schema); |
| 120 | 121 | $table_row->load($model_data); |
| 121 | 122 | } |
@@ -177,9 +178,9 @@ discard block |
||
| 177 | 178 | { |
| 178 | 179 | $pk = current($table->primaryKeys())->name(); |
| 179 | 180 | $unique_identifiers = [$pk => $arg1]; |
| 180 | - } |
|
| 181 | - else |
|
| 182 | - throw new CruditesException('ARGUMENTS_ARE_NOT_ACTIONNABLE'); |
|
| 181 | + } else { |
|
| 182 | + throw new CruditesException('ARGUMENTS_ARE_NOT_ACTIONNABLE'); |
|
| 183 | + } |
|
| 183 | 184 | |
| 184 | 185 | |
| 185 | 186 | // Find the unique identifier(s) in the database. |
@@ -238,8 +239,7 @@ discard block |
||
| 238 | 239 | { |
| 239 | 240 | try { |
| 240 | 241 | return self::one($arg1, $arg2); |
| 241 | - } |
|
| 242 | - catch (CruditesException $e) { |
|
| 242 | + } catch (CruditesException $e) { |
|
| 243 | 243 | return null; |
| 244 | 244 | } |
| 245 | 245 | } |