@@ -163,7 +163,8 @@ discard block |
||
| 163 | 163 | /** |
| 164 | 164 | * Register model observers |
| 165 | 165 | */ |
| 166 | - private function registerModelObservers(){ |
|
| 166 | + private function registerModelObservers() |
|
| 167 | + { |
|
| 167 | 168 | $observers = [ |
| 168 | 169 | Observers\CreatedByAndUpdatedByObserver::class => [ |
| 169 | 170 | Model\Right::class, |
@@ -178,8 +179,8 @@ discard block |
||
| 178 | 179 | ] |
| 179 | 180 | ]; |
| 180 | 181 | |
| 181 | - foreach($observers as $observer => $models){ |
|
| 182 | - foreach($models as $model){ |
|
| 182 | + foreach($observers as $observer => $models) { |
|
| 183 | + foreach($models as $model) { |
|
| 183 | 184 | call_user_func($model. '::observe', $observer); |
| 184 | 185 | } |
| 185 | 186 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | return false; |
| 46 | 46 | } |
| 47 | 47 | return true; |
| 48 | - } catch (\Exception $e){ |
|
| 48 | + } catch (\Exception $e) { |
|
| 49 | 49 | return false; |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -34,7 +34,9 @@ |
||
| 34 | 34 | $filter['operator'] = trim(strtolower($filter['operator'])); |
| 35 | 35 | $filter['attribute'] = trim($filter['attribute']); |
| 36 | 36 | |
| 37 | - if (empty($filter['operator']) || empty($filter['attribute']) || empty($filter['value'])) continue; |
|
| 37 | + if (empty($filter['operator']) || empty($filter['attribute']) || empty($filter['value'])) { |
|
| 38 | + continue; |
|
| 39 | + } |
|
| 38 | 40 | |
| 39 | 41 | switch ($filter['operator']) { |
| 40 | 42 | case 'in': |
@@ -51,8 +51,7 @@ |
||
| 51 | 51 | $i = 1; |
| 52 | 52 | $token = ''; |
| 53 | 53 | |
| 54 | - while ($i <= $length) |
|
| 55 | - { |
|
| 54 | + while ($i <= $length) { |
|
| 56 | 55 | $num = rand() % $charsCount; |
| 57 | 56 | $tmp = substr($chars, $num, 1); |
| 58 | 57 | $token .= $tmp; |
@@ -8,12 +8,16 @@ discard block |
||
| 8 | 8 | /** |
| 9 | 9 | * Forbidden to create new instances |
| 10 | 10 | */ |
| 11 | - private function __construct() {} |
|
| 11 | + private function __construct() |
|
| 12 | + { |
|
| 13 | +} |
|
| 12 | 14 | |
| 13 | 15 | /** |
| 14 | 16 | * Forbidden to cloned instances |
| 15 | 17 | */ |
| 16 | - private function __clone() {} |
|
| 18 | + private function __clone() |
|
| 19 | + { |
|
| 20 | +} |
|
| 17 | 21 | |
| 18 | 22 | /** |
| 19 | 23 | * @var User |
@@ -49,7 +53,7 @@ discard block |
||
| 49 | 53 | */ |
| 50 | 54 | public static function getUserId() |
| 51 | 55 | { |
| 52 | - if(self::checkUser()){ |
|
| 56 | + if(self::checkUser()) { |
|
| 53 | 57 | return self::$user->id; |
| 54 | 58 | } else { |
| 55 | 59 | return null; |
@@ -50,10 +50,12 @@ |
||
| 50 | 50 | ob_start(); |
| 51 | 51 | $this->protectedIncludeScope($this->templatePath . $template, $data); |
| 52 | 52 | $output = ob_get_clean(); |
| 53 | - } catch(\Throwable $e) { // PHP 7+ |
|
| 53 | + } catch(\Throwable $e) { |
|
| 54 | +// PHP 7+ |
|
| 54 | 55 | ob_end_clean(); |
| 55 | 56 | throw $e; |
| 56 | - } catch(\Exception $e) { // PHP < 7 |
|
| 57 | + } catch(\Exception $e) { |
|
| 58 | +// PHP < 7 |
|
| 57 | 59 | ob_end_clean(); |
| 58 | 60 | throw $e; |
| 59 | 61 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | public function creating(BaseModel $model) |
| 16 | 16 | { |
| 17 | 17 | $user = Auth::getUser(); |
| 18 | - if(!is_null($user)){ |
|
| 18 | + if(!is_null($user)) { |
|
| 19 | 19 | $model->created_by = $user->id; |
| 20 | 20 | } |
| 21 | 21 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | public function updating(BaseModel $model) |
| 31 | 31 | { |
| 32 | 32 | $user = Auth::getUser(); |
| 33 | - if(!is_null($user)){ |
|
| 33 | + if(!is_null($user)) { |
|
| 34 | 34 | $model->updated_by = $user->id; |
| 35 | 35 | } |
| 36 | 36 | } |