@@ -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,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 | } |