Passed
Push — main ( 2be97f...a6f261 )
by Sammy
01:34
created
Container/LeMarchand.class.php 1 patch
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,11 +34,13 @@  discard block
 block discarded – undo
34 34
   public function get($configuration)
35 35
   {
36 36
     
37
-    if(!is_string($configuration))
38
-      throw new LamentException($configuration);
37
+    if(!is_string($configuration)) {
38
+          throw new LamentException($configuration);
39
+    }
39 40
 
40
-    if($this->has($configuration))
41
-      return $this->configurations[$configuration];
41
+    if($this->has($configuration)) {
42
+          return $this->configurations[$configuration];
43
+    }
42 44
 
43 45
     
44 46
     // fallbacks
@@ -47,17 +49,19 @@  discard block
 block discarded – undo
47 49
       $ret = $this->configurations;
48 50
       foreach(explode('.', $configuration) as $k)
49 51
       {
50
-        if(!isset($ret[$k]))
51
-          throw new ConfigurationException($configuration);
52
+        if(!isset($ret[$k])) {
53
+                  throw new ConfigurationException($configuration);
54
+        }
52 55
         $ret = $ret[$k];
53 56
       }
54 57
 
55 58
       return $ret;
56
-    }
57
-    elseif(class_exists($configuration)) // auto create instances
59
+    } elseif(class_exists($configuration)) {
60
+      // auto create instances
58 61
     {
59 62
       
60 63
       $rc = new \ReflectionClass($configuration);
64
+    }
61 65
 
62 66
       $construction_args = [];
63 67
       $instance = null;
@@ -68,12 +72,13 @@  discard block
 block discarded – undo
68 72
           $construction_args []= $this->get($param->getType().'');
69 73
         }
70 74
         $instance = $rc->newInstanceArgs($construction_args);
75
+      } else {
76
+              $instance = $rc->newInstanceArgs();
71 77
       }
72
-      else 
73
-        $instance = $rc->newInstanceArgs();
74 78
 
75
-      if($rc->hasMethod('set_container'))
76
-        $instance->set_container($this);
79
+      if($rc->hasMethod('set_container')) {
80
+              $instance->set_container($this);
81
+      }
77 82
       
78 83
       return $instance;
79 84
     }
Please login to merge, or discard this patch.
StorageManager/__DEL__FileManager.class.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@  discard block
 block discarded – undo
12 12
   
13 13
   function __construct($file_manageable_model, $filetype)
14 14
   {
15
-    if(!is_subclass_of($file_manageable_model, '\HexMakina\Crudites\TightModel'))
16
-      throw new \Exception("__construct($file_manageable_model) // only Model items are manageable");
15
+    if(!is_subclass_of($file_manageable_model, '\HexMakina\Crudites\TightModel')) {
16
+          throw new \Exception("__construct($file_manageable_model) // only Model items are manageable");
17
+    }
17 18
 
18 19
     $this->pmi = $file_manageable_model;
19 20
     $this->picture_type = $filetype;
@@ -58,11 +59,13 @@  discard block
 block discarded – undo
58 59
     return $this->pmi->get_id().'/';  
59 60
 
60 61
     $pmi_model_type = get_class($this->pmi)::model_type();
61
-    if(!isset($this->pmi) || is_null($this->get_type()))
62
-      throw new \Exception(__FUNCTION__." // undefined manageable item or picture type");
62
+    if(!isset($this->pmi) || is_null($this->get_type())) {
63
+          throw new \Exception(__FUNCTION__." // undefined manageable item or picture type");
64
+    }
63 65
 
64
-    if(!isset($settings[$pmi_model_type][$this->get_type()]['import_directory']))
65
-      throw new \Exception(__FUNCTION__." // undefined configuration for '".($pmi_model_type)."'>'".$this->get_type()."'>'import_directory'");
66
+    if(!isset($settings[$pmi_model_type][$this->get_type()]['import_directory'])) {
67
+          throw new \Exception(__FUNCTION__." // undefined configuration for '".($pmi_model_type)."'>'".$this->get_type()."'>'import_directory'");
68
+    }
66 69
     
67 70
     // global $settings;
68 71
     // return $settings[$pmi_model_type][$this->get_type()]['import_directory'].$this->pmi->get_id().'/';
Please login to merge, or discard this patch.
Router/hopper.class.php 1 patch
Braces   +44 added lines, -31 removed lines patch added patch discarded remove patch
@@ -17,8 +17,9 @@  discard block
 block discarded – undo
17 17
   //----------------------------------------------------------- INITIALISATION
18 18
   public function __construct($settings)
19 19
   {
20
-    if(!isset($settings['route_home']))
21
-      throw new RouterException('ROUTE_HOME_UNDEFINED');
20
+    if(!isset($settings['route_home'])) {
21
+          throw new RouterException('ROUTE_HOME_UNDEFINED');
22
+    }
22 23
 
23 24
     parent::__construct();
24 25
 
@@ -44,28 +45,33 @@  discard block
 block discarded – undo
44 45
   {
45 46
     $this->match = parent::match($requestUrl, $requestMethod);
46 47
 
47
-    if($this->match === false)
48
-      throw new RouterException('ROUTE_MATCH_FALSE');
48
+    if($this->match === false) {
49
+          throw new RouterException('ROUTE_MATCH_FALSE');
50
+    }
49 51
 
50 52
     $res = explode('::', self::target());
51 53
 
52
-    if($res === false || !isset($res[1]) || isset($ret[2]))
53
-      throw new RouterException('INVALID_TARGET');
54
+    if($res === false || !isset($res[1]) || isset($ret[2])) {
55
+          throw new RouterException('INVALID_TARGET');
56
+    }
54 57
 
55
-    if($this->match['name'] === 'akadok_controller_method')
56
-      $res = [ucfirst(self::params('controller')).'Controller', ucfirst(self::params('method'))];
58
+    if($this->match['name'] === 'akadok_controller_method') {
59
+          $res = [ucfirst(self::params('controller')).'Controller', ucfirst(self::params('method'))];
60
+    }
57 61
 
58 62
 
59 63
     $target_controller = $res[0];
60 64
     $target_method = $res[1];
61 65
     $found = false;
62 66
 
63
-    foreach($this->controller_namespaces as $controller_ns)
64
-      if($found = class_exists($controller_class_name = "$controller_ns$target_controller"))
67
+    foreach($this->controller_namespaces as $controller_ns) {
68
+          if($found = class_exists($controller_class_name = "$controller_ns$target_controller"))
65 69
         break;
70
+    }
66 71
 
67
-    if($found === false)
68
-      throw new RouterException('INVALID_CONTROLLER_NAME');
72
+    if($found === false) {
73
+          throw new RouterException('INVALID_CONTROLLER_NAME');
74
+    }
69 75
 
70 76
     $this->match['target_controller'] = $controller_class_name;
71 77
     $this->match['target_method'] = $target_method;
@@ -87,16 +93,19 @@  discard block
 block discarded – undo
87 93
   {
88 94
 
89 95
     // $key is null, returns $dat_ass or empty array
90
-    if(is_null($key))
91
-      return $dat_ass ?? [];
96
+    if(is_null($key)) {
97
+          return $dat_ass ?? [];
98
+    }
92 99
 
93 100
     // $dat_ass[$key] not set, returns null
94
-    if(!isset($dat_ass[$key]))
95
-      return null;
101
+    if(!isset($dat_ass[$key])) {
102
+          return null;
103
+    }
96 104
 
97 105
     // $dat_ass[$key] is a string, returns decoded value
98
-    if(is_string($dat_ass[$key]))
99
-      return urldecode($dat_ass[$key]);
106
+    if(is_string($dat_ass[$key])) {
107
+          return urldecode($dat_ass[$key]);
108
+    }
100 109
 
101 110
     // $dat_ass[$key] is not a string, return match[$key]
102 111
     return $dat_ass[$key];
@@ -146,7 +155,7 @@  discard block
 block discarded – undo
146 155
   {
147 156
     try{
148 157
       $url = $this->generate($route, $route_params);
149
-    }catch(\Exception $e){
158
+    } catch(\Exception $e){
150 159
       $url = $this->prehop(self::ROUTE_HOME_NAME);
151 160
     }
152 161
 
@@ -169,12 +178,13 @@  discard block
 block discarded – undo
169 178
   {
170 179
     $url = null;
171 180
 
172
-    if(is_null($route))
173
-      $url = $this->prehop(self::ROUTE_HOME_NAME, $route_params);
174
-    elseif(is_string($route) && $this->route_exists($route))
175
-      $url = $this->prehop($route, $route_params);
176
-    else
177
-      $url = $route;
181
+    if(is_null($route)) {
182
+          $url = $this->prehop(self::ROUTE_HOME_NAME, $route_params);
183
+    } elseif(is_string($route) && $this->route_exists($route)) {
184
+          $url = $this->prehop($route, $route_params);
185
+    } else {
186
+          $url = $route;
187
+    }
178 188
 
179 189
     $this->hop_url($url);
180 190
   }
@@ -182,8 +192,9 @@  discard block
 block discarded – undo
182 192
   // hops back to previous page (referer()), or home if no referer
183 193
   public function hop_back()
184 194
   {
185
-    if(!is_null($back = $this->referer()))
186
-      $this->hop_url($back);
195
+    if(!is_null($back = $this->referer())) {
196
+          $this->hop_url($back);
197
+    }
187 198
 
188 199
     $this->hop();
189 200
   }
@@ -200,16 +211,18 @@  discard block
 block discarded – undo
200 211
   // returns null if same as current URL (prevents endless redirection loop)
201 212
   public function referer()
202 213
   {
203
-    if(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != $this->web_host() .$_SERVER['REQUEST_URI'])
204
-      return $_SERVER['HTTP_REFERER'];
214
+    if(isset($_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != $this->web_host() .$_SERVER['REQUEST_URI']) {
215
+          return $_SERVER['HTTP_REFERER'];
216
+    }
205 217
 
206 218
     return null;
207 219
   }
208 220
 
209 221
   public function send_file($file_path)
210 222
   {
211
-    if(!file_exists($file_path))
212
-      throw new RouterException('SENDING_NON_EXISTING_FILE');
223
+    if(!file_exists($file_path)) {
224
+          throw new RouterException('SENDING_NON_EXISTING_FILE');
225
+    }
213 226
 
214 227
     $file_name = basename($file_path);
215 228
 
Please login to merge, or discard this patch.
Logger/LogLaddy.class.php 1 patch
Braces   +18 added lines, -15 removed lines patch added patch discarded remove patch
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
     $context['class'] = get_class($throwable);
56 56
     $context['trace'] = $throwable->getTrace();
57 57
 
58
-    if(is_subclass_of($throwable, 'Error') || get_class($throwable) === 'Error')
59
-      (new LogLaddy())->alert(self::INTERNAL_ERROR, $context);
60
-    elseif(is_subclass_of($throwable, 'Exception') || get_class($throwable) === 'Exception')
61
-      (new LogLaddy())->notice(self::USER_EXCEPTION, $context);
62
-    else
58
+    if(is_subclass_of($throwable, 'Error') || get_class($throwable) === 'Error') {
59
+          (new LogLaddy())->alert(self::INTERNAL_ERROR, $context);
60
+    } elseif(is_subclass_of($throwable, 'Exception') || get_class($throwable) === 'Exception') {
61
+          (new LogLaddy())->notice(self::USER_EXCEPTION, $context);
62
+    } else
63 63
     {
64 64
       die('This Throwable is not an Error or an Exception. This is unfortunate.');
65 65
     }
@@ -93,15 +93,15 @@  discard block
 block discarded – undo
93 93
       error_log($display_error);
94 94
       $display_error.= self::format_trace($context['trace'], false);
95 95
       self::HTTP_500($display_error);
96
-    }
97
-    elseif($this->system_halted($level)) // analyses error level
96
+    } elseif($this->system_halted($level)) {
97
+      // analyses error level
98 98
     {
99 99
       $display_error = sprintf(PHP_EOL.'%s in file %s:%d'.PHP_EOL.'%s', $level, self::format_file($context['file']), $context['line'], $message);
100
+    }
100 101
       error_log($display_error);
101 102
       $display_error.= self::format_trace($context['trace'], true);
102 103
       self::HTTP_500($display_error);
103
-    }
104
-    else
104
+    } else
105 105
     {// --- Handles user messages, through SESSION storage
106 106
       $this->report_to_user($level, $message, $context);
107 107
     }
@@ -128,11 +128,13 @@  discard block
 block discarded – undo
128 128
   // ----------------------------------------------------------- User messages:add one
129 129
   public function report_to_user($level, $message, $context = [])
130 130
   {
131
-    if(!isset($_SESSION[self::REPORTING_USER]))
132
-      $_SESSION[self::REPORTING_USER] = [];
131
+    if(!isset($_SESSION[self::REPORTING_USER])) {
132
+          $_SESSION[self::REPORTING_USER] = [];
133
+    }
133 134
 
134
-    if(!isset($_SESSION[self::REPORTING_USER][$level]))
135
-      $_SESSION[self::REPORTING_USER][$level] = [];
135
+    if(!isset($_SESSION[self::REPORTING_USER][$level])) {
136
+          $_SESSION[self::REPORTING_USER][$level] = [];
137
+    }
136 138
 
137 139
     $_SESSION[self::REPORTING_USER][$level][] = [$message, $context];
138 140
   }
@@ -177,8 +179,9 @@  discard block
 block discarded – undo
177 179
     $m[E_STRICT]=$m[E_DEPRECATED]=$m[E_USER_DEPRECATED]=$m[E_ALL]=LogLevel::DEBUG;
178 180
     $m[2048]=$m[8192]=$m[16384]=$m[32767]=LogLevel::DEBUG;
179 181
 
180
-    if(isset($m[$level]))
181
-      return $m[$level];
182
+    if(isset($m[$level])) {
183
+          return $m[$level];
184
+    }
182 185
 
183 186
     throw new \Exception(__FUNCTION__."($level): $level is unknown");
184 187
   }
Please login to merge, or discard this patch.
Controllers/TradukoController.class.php 1 patch
Braces   +10 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,8 +26,7 @@  discard block
 block discarded – undo
26 26
       self::create_file($locale_path, $lang);
27 27
 
28 28
       $this->logger()->nice(L('KADRO_SYSTEM_FILE_UPDATED'));
29
-    }
30
-    catch(\Exception $e)
29
+    } catch(\Exception $e)
31 30
     {
32 31
       $this->logger()->notice(L('KADRO_SYSTEM_FILE_UPDATED'));
33 32
     }
@@ -40,10 +39,12 @@  discard block
 block discarded – undo
40 39
     $assoc = [];
41 40
     foreach($res as $id => $trad)
42 41
     {
43
-      if(!isset($assoc[$trad->kategorio]))
44
-        $assoc[$trad->kategorio] = [];
45
-      if(!isset($assoc[$trad->kategorio][$trad->sekcio]))
46
-        $assoc[$trad->kategorio][$trad->sekcio] = [];
42
+      if(!isset($assoc[$trad->kategorio])) {
43
+              $assoc[$trad->kategorio] = [];
44
+      }
45
+      if(!isset($assoc[$trad->kategorio][$trad->sekcio])) {
46
+              $assoc[$trad->kategorio][$trad->sekcio] = [];
47
+      }
47 48
 
48 49
       $assoc[$trad->kategorio][$trad->sekcio][$trad->referenco] = $trad->$lang;
49 50
     }
@@ -57,8 +58,9 @@  discard block
 block discarded – undo
57 58
   public static function init($locale_path)
58 59
   {
59 60
     $languages = array_keys(array_slice(Traduko::inspect(Traduko::table_name())->columns(), 4));
60
-    foreach($languages as $l)
61
-      self::create_file($locale_path,$l);
61
+    foreach($languages as $l) {
62
+          self::create_file($locale_path,$l);
63
+    }
62 64
 
63 65
     return $languages;
64 66
   }
Please login to merge, or discard this patch.
Controllers/OperatorController.class.php 1 patch
Braces   +14 added lines, -12 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
     parent::edit();
24 24
 
25 25
     // do we create? or do we edit someone else ? must be admin
26
-    if(is_null($this->load_model) || $this->operator()->operator_id() !== $this->load_model->operator_id())
27
-      $this->authorize('group_admin');
26
+    if(is_null($this->load_model) || $this->operator()->operator_id() !== $this->load_model->operator_id()) {
27
+          $this->authorize('group_admin');
28
+    }
28 29
 
29 30
   }
30 31
 
@@ -35,8 +36,9 @@  discard block
 block discarded – undo
35 36
 
36 37
   public function save()
37 38
   {
38
-    if($this->operator()->operator_id() !== $this->form_model->operator_id())
39
-      $this->authorize('group_admin');
39
+    if($this->operator()->operator_id() !== $this->form_model->operator_id()) {
40
+          $this->authorize('group_admin');
41
+    }
40 42
 
41 43
     parent::save();
42 44
   }
@@ -71,15 +73,15 @@  discard block
 block discarded – undo
71 73
     parent::authorize('group_admin');
72 74
 
73 75
     $operator = Operator::one($this->router()->params());
74
-    if($operator->username() == $this->operator()->username())
75
-      throw new AccessRefusedException();
76
+    if($operator->username() == $this->operator()->username()) {
77
+          throw new AccessRefusedException();
78
+    }
76 79
 
77 80
     if(Operator::toggle_boolean(Operator::table_name(), 'active', $operator->operator_id()) === true)
78 81
     {
79 82
       $confirmation_message = $operator->is_active() ? 'KADRO_operator_DISABLED' : 'KADRO_operator_ENABLED';
80 83
       $this->logger()->nice(L($confirmation_message, [$operator->name()]));
81
-    }
82
-    else
84
+    } else
83 85
     {
84 86
       $this->logger()->warning(L('CRUDITES_ERR_QUERY_FAILED'));
85 87
     }
@@ -92,8 +94,9 @@  discard block
 block discarded – undo
92 94
     parent::authorize('group_admin');
93 95
 
94 96
     $operator = Operator::one(['username' => $this->router()->params('username')]);
95
-    if($operator->username() == $this->operator()->username())
96
-      throw new AccessRefusedException();
97
+    if($operator->username() == $this->operator()->username()) {
98
+          throw new AccessRefusedException();
99
+    }
97 100
 
98 101
     $permission_id = $this->router()->params('permission_id');
99 102
 
@@ -103,8 +106,7 @@  discard block
 block discarded – undo
103 106
     {
104 107
       $row = ACL::table()->produce($row_data);
105 108
       $res = $row->persist();
106
-    }
107
-    else
109
+    } else
108 110
     {
109 111
       $row->wipe();
110 112
     }
Please login to merge, or discard this patch.
Controllers/ORMController.class.php 1 patch
Braces   +60 added lines, -43 removed lines patch added patch discarded remove patch
@@ -34,9 +34,12 @@  discard block
 block discarded – undo
34 34
       {
35 35
         $res = $this->$chainling();
36 36
 
37
-        if($this->logger()->has_halting_messages()) // logger handled a critical error during the chailing execution
37
+        if($this->logger()->has_halting_messages()) {
38
+          // logger handled a critical error during the chailing execution
38 39
         {
39
-          break; // dont go on with other
40
+          break;
41
+        }
42
+        // dont go on with other
40 43
         }
41 44
 
42 45
         if($chainling === $method)
@@ -47,19 +50,23 @@  discard block
 block discarded – undo
47 50
       }
48 51
     }
49 52
 
50
-    if(method_exists($this, 'conclude')) // conclude always executed, even with has_halting_messages
53
+    if(method_exists($this, 'conclude')) {
54
+      // conclude always executed, even with has_halting_messages
51 55
     	$this->conclude();
56
+    }
52 57
 
53
-    if(method_exists($this, 'display'))
54
-    	$template = $this->display($custom_template);
58
+    if(method_exists($this, 'display')) {
59
+        	$template = $this->display($custom_template);
60
+    }
55 61
   }
56 62
 
57 63
   public function prepare()
58 64
   {
59 65
     parent::prepare();
60 66
 
61
-    if(!class_exists($this->model_class_name = $this->class_name()))
62
-      throw new \Exception("!class_exists($this->model_class_name)");
67
+    if(!class_exists($this->model_class_name = $this->class_name())) {
68
+          throw new \Exception("!class_exists($this->model_class_name)");
69
+    }
63 70
 
64 71
     $this->model_type = $this->model_class_name::model_type();
65 72
 
@@ -74,17 +81,18 @@  discard block
 block discarded – undo
74 81
       $pk_values = $this->model_class_name::table()->primary_keys_match($this->router()->submitted());
75 82
 
76 83
       $this->load_model = $this->model_class_name::exists($pk_values);
77
-    }
78
-    elseif($this->router()->requests())
84
+    } elseif($this->router()->requests())
79 85
     {
80 86
       $pk_values = $this->model_class_name::table()->primary_keys_match($this->router()->params());
81 87
 
82
-      if(!is_null($this->load_model = $this->model_class_name::exists($pk_values)))
83
-        $this->form_model = clone $this->load_model;
88
+      if(!is_null($this->load_model = $this->model_class_name::exists($pk_values))) {
89
+              $this->form_model = clone $this->load_model;
90
+      }
84 91
     }
85 92
 
86
-    if(!is_null($this->load_model) && is_subclass_of($this->load_model, '\HexMakina\Crudites\Interfaces\TraceableInterface') && $this->load_model->traceable())
87
-      $this->viewport('load_model_history', $this->tracer()->traces_by_model($this->load_model));
93
+    if(!is_null($this->load_model) && is_subclass_of($this->load_model, '\HexMakina\Crudites\Interfaces\TraceableInterface') && $this->load_model->traceable()) {
94
+          $this->viewport('load_model_history', $this->tracer()->traces_by_model($this->load_model));
95
+    }
88 96
   }
89 97
 
90 98
   public function has_load_model()
@@ -112,8 +120,9 @@  discard block
 block discarded – undo
112 120
       $this->logger()->nice(L('CRUDITES_INSTANCE_ALTERED', ['MODEL_'.get_class($model)::model_type().'_INSTANCE']));
113 121
       return $model;
114 122
     }
115
-    foreach($this->errors() as $field => $error_msg)
116
-      $this->logger()->warning(L($error_msg, [$field]));
123
+    foreach($this->errors() as $field => $error_msg) {
124
+          $this->logger()->warning(L($error_msg, [$field]));
125
+    }
117 126
 
118 127
     return null;
119 128
   }
@@ -127,8 +136,12 @@  discard block
 block discarded – undo
127 136
   {
128 137
     $class_name = is_null($model) ? $this->model_class_name : get_class($model);
129 138
 
130
-    if(!isset($filters['date_start']))  $filters['date_start'] = $this->box('StateAgent')->filters('date_start');
131
-    if(!isset($filters['date_stop']))   $filters['date_stop'] = $this->box('StateAgent')->filters('date_stop');
139
+    if(!isset($filters['date_start'])) {
140
+      $filters['date_start'] = $this->box('StateAgent')->filters('date_start');
141
+    }
142
+    if(!isset($filters['date_stop'])) {
143
+      $filters['date_stop'] = $this->box('StateAgent')->filters('date_stop');
144
+    }
132 145
 
133 146
     // dd($filters);
134 147
     $listing = $class_name::filter($filters);
@@ -144,15 +157,16 @@  discard block
 block discarded – undo
144 157
       foreach($class_name::table()->columns() as $column)
145 158
       {
146 159
 
147
-        if(!$column->is_auto_incremented() && !$column->is_hidden())
148
-          $listing_fields[$column->name()]=L(sprintf('MODEL_%s_FIELD_%s', $class_name::model_type(), $column->name()));
160
+        if(!$column->is_auto_incremented() && !$column->is_hidden()) {
161
+                  $listing_fields[$column->name()]=L(sprintf('MODEL_%s_FIELD_%s', $class_name::model_type(), $column->name()));
162
+        }
149 163
       }
150
-    }
151
-    else
164
+    } else
152 165
     {
153 166
       $current = current($listing);
154
-      if(is_object($current))
155
-        $current = get_object_vars($current);
167
+      if(is_object($current)) {
168
+              $current = get_object_vars($current);
169
+      }
156 170
 
157 171
       foreach(array_keys($current) as $field)
158 172
       {
@@ -184,9 +198,9 @@  discard block
 block discarded – undo
184 198
   {
185 199
     $model = $this->persist_model($this->form_model);
186 200
 
187
-    if(empty($this->errors()))
188
-      $this->route_back($model);
189
-    else
201
+    if(empty($this->errors())) {
202
+          $this->route_back($model);
203
+    } else
190 204
     {
191 205
       $this->edit();
192 206
       return 'edit';
@@ -226,8 +240,7 @@  discard block
 block discarded – undo
226 240
     {
227 241
       $this->logger()->warning(L('CRUDITES_ERR_INSTANCE_NOT_FOUND', ['MODEL_'.$this->model_type.'_INSTANCE']));
228 242
       $this->router()->hop($this->model_type);
229
-    }
230
-    elseif($this->load_model->immortal())
243
+    } elseif($this->load_model->immortal())
231 244
     {
232 245
 
233 246
       $this->logger()->warning(L('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', ['MODEL_'.$this->model_type.'_INSTANCE']));
@@ -237,15 +250,15 @@  discard block
 block discarded – undo
237 250
 
238 251
   public function destroy()
239 252
   {
240
-    if(!$this->router()->submits())
241
-      throw new \Exception('KADRO_ROUTER_MUST_SUBMIT');
253
+    if(!$this->router()->submits()) {
254
+          throw new \Exception('KADRO_ROUTER_MUST_SUBMIT');
255
+    }
242 256
 
243 257
     if($this->load_model->destroy($this->operator()->operator_id(), $this->tracer()) === false)
244 258
     {
245 259
       $this->logger()->info(L('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', [''.$this->load_model]));
246 260
       $this->route_back($this->load_model);
247
-    }
248
-    else
261
+    } else
249 262
     {
250 263
       $this->logger()->nice(L('CRUDITES_INSTANCE_DESTROYED', ['MODEL_'.$this->model_type.'_INSTANCE']));
251 264
       $this->route_back($this->model_type);
@@ -263,11 +276,13 @@  discard block
 block discarded – undo
263 276
 
264 277
     $this->viewport('form_model_type', $this->model_type);
265 278
 
266
-    if(isset($this->load_model))
267
-      $this->viewport('load_model', $this->load_model);
279
+    if(isset($this->load_model)) {
280
+          $this->viewport('load_model', $this->load_model);
281
+    }
268 282
 
269
-    if(isset($this->form_model))
270
-      $this->viewport('form_model', $this->form_model);
283
+    if(isset($this->form_model)) {
284
+          $this->viewport('form_model', $this->form_model);
285
+    }
271 286
   }
272 287
 
273 288
   public function collection_to_csv($collection, $filename)
@@ -325,9 +340,9 @@  discard block
 block discarded – undo
325 340
     $route_params = [];
326 341
 
327 342
     $route_name = get_class($model)::model_type().'_';
328
-    if($model->is_new())
329
-      $route_name.= 'new';
330
-    else
343
+    if($model->is_new()) {
344
+          $route_name.= 'new';
345
+    } else
331 346
     {
332 347
       $route_name.= 'default';
333 348
       $route_params = ['id' => $model->get_id()];
@@ -338,11 +353,13 @@  discard block
 block discarded – undo
338 353
 
339 354
   public function route_factory($route=null, $route_params=[]) : string
340 355
   {
341
-    if(is_null($route) && $this->router()->submits())
342
-      $route = $this->form_model;
356
+    if(is_null($route) && $this->router()->submits()) {
357
+          $route = $this->form_model;
358
+    }
343 359
 
344
-    if(!is_null($route) && is_subclass_of($route, '\HexMakina\Crudites\Interfaces\ModelInterface'))
345
-      $route = $this->route_model($route);
360
+    if(!is_null($route) && is_subclass_of($route, '\HexMakina\Crudites\Interfaces\ModelInterface')) {
361
+          $route = $this->route_model($route);
362
+    }
346 363
 
347 364
     return parent::route_factory($route, $route_params);
348 365
   }
Please login to merge, or discard this patch.
Controllers/ReceptionController.class.php 1 patch
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,8 +18,9 @@  discard block
 block discarded – undo
18 18
   public function welcome(OperatorInterface $operator)
19 19
   {
20 20
 
21
-    if($this->router()->name() === 'identify')
22
-      $this->identify($operator);
21
+    if($this->router()->name() === 'identify') {
22
+          $this->identify($operator);
23
+    }
23 24
 
24 25
     $Controller = $this->router()->target_controller();
25 26
     $Controller = $this->box($Controller);
@@ -27,8 +28,9 @@  discard block
 block discarded – undo
27 28
 
28 29
     if($Controller->requires_operator())
29 30
     {
30
-      if(is_null($operator = get_class($operator)::exists($this->box('StateAgent')->operator_id())))
31
-        $this->router()->hop('checkin');
31
+      if(is_null($operator = get_class($operator)::exists($this->box('StateAgent')->operator_id()))) {
32
+              $this->router()->hop('checkin');
33
+      }
32 34
 
33 35
       if(!$operator->is_active())
34 36
       {
@@ -62,11 +64,13 @@  discard block
 block discarded – undo
62 64
 
63 65
       $operator = get_class($op)::exists(['username' => $username]);
64 66
 
65
-      if(is_null($operator) || !$operator->is_active())
66
-        throw new \Exception('ERR_DISABLED');
67
+      if(is_null($operator) || !$operator->is_active()) {
68
+              throw new \Exception('ERR_DISABLED');
69
+      }
67 70
 
68
-      if(!$operator->password_verify($password))
69
-        throw new \Exception('ERR_WRONG_LOGIN_OR_PASSWORD');
71
+      if(!$operator->password_verify($password)) {
72
+              throw new \Exception('ERR_WRONG_LOGIN_OR_PASSWORD');
73
+      }
70 74
 
71 75
       $this->box('StateAgent')->operator_id($operator->get_id());
72 76
       $this->logger()->nice(L('PAGE_CHECKIN_WELCOME', [$operator->name()]));
Please login to merge, or discard this patch.
common.inc.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -92,8 +92,9 @@  discard block
 block discarded – undo
92 92
   //---------------------------------------------------------------     ŝablonoj
93 93
   require_once 'smarty/smarty/libs/Smarty.class.php';
94 94
   // Load smarty template parser
95
-  if(is_null($box->get('settings.smarty.template_path')) || is_null($box->get('settings.smarty.compiled_path')))
96
-      throw new \Exception("SMARTY CONFIG ERROR: missing parameters");
95
+  if(is_null($box->get('settings.smarty.template_path')) || is_null($box->get('settings.smarty.compiled_path'))) {
96
+        throw new \Exception("SMARTY CONFIG ERROR: missing parameters");
97
+  }
97 98
 
98 99
   $smarty=new \Smarty();
99 100
   $box->register('template_engine', $smarty);
@@ -124,7 +125,8 @@  discard block
 block discarded – undo
124 125
   $lezer->init();
125 126
 
126 127
   $smarty->assign('language', $language);
127
-  if($cookies_enabled === true)
128
-    setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", "");
128
+  if($cookies_enabled === true) {
129
+      setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", "");
130
+  }
129 131
 
130 132
 }
Please login to merge, or discard this patch.