Passed
Push — main ( 9b9a2d...ee3278 )
by Sammy
02:31 queued 36s
created
StorageManager/__DEL__FileManager.class.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  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'))
15
+    if (!is_subclass_of($file_manageable_model, '\HexMakina\Crudites\TightModel'))
16 16
       throw new \Exception("__construct($file_manageable_model) // only Model items are manageable");
17 17
 
18 18
     $this->pmi = $file_manageable_model;
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
   public function download($url)
33 33
   {
34 34
     $filename = $this->build_filename();
35
-    $filename .= '.' . pathinfo($url, PATHINFO_EXTENSION);
35
+    $filename .= '.'.pathinfo($url, PATHINFO_EXTENSION);
36 36
 
37 37
     $filepath = $this->build_path_to_file($filename);
38 38
 
@@ -58,10 +58,10 @@  discard block
 block discarded – undo
58 58
     return $this->pmi->get_id().'/';  
59 59
 
60 60
     $pmi_model_type = get_class($this->pmi)::model_type();
61
-    if(!isset($this->pmi) || is_null($this->get_type()))
61
+    if (!isset($this->pmi) || is_null($this->get_type()))
62 62
       throw new \Exception(__FUNCTION__." // undefined manageable item or picture type");
63 63
 
64
-    if(!isset($settings[$pmi_model_type][$this->get_type()]['import_directory']))
64
+    if (!isset($settings[$pmi_model_type][$this->get_type()]['import_directory']))
65 65
       throw new \Exception(__FUNCTION__." // undefined configuration for '".($pmi_model_type)."'>'".$this->get_type()."'>'import_directory'");
66 66
     
67 67
     // global $settings;
Please login to merge, or discard this 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.
Controllers/Interfaces/CRUDController.class.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,14 +4,14 @@
 block discarded – undo
4 4
 
5 5
 interface CRUDController
6 6
 {
7
-   public function dashboard();
8
-   public function edit();
9
-   public function save();
10
-   public function listing();
7
+    public function dashboard();
8
+    public function edit();
9
+    public function save();
10
+    public function listing();
11 11
 
12
-   public function destroy();
12
+    public function destroy();
13 13
 
14
-   public function errors() : array;
14
+    public function errors() : array;
15 15
 }
16 16
 
17 17
 
Please login to merge, or discard this patch.
Controllers/TradukoController.class.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
     return $this->router()->prehop('traduko');
20 20
   }
21 21
 
22
-  public function update_file($lang='fra')
22
+  public function update_file($lang = 'fra')
23 23
   {
24
-    try{
24
+    try {
25 25
       $locale_path = $this->box('settings.locale.directory_path').'/'.$this->box('settings.locale.file_name');
26 26
       self::create_file($locale_path, $lang);
27 27
 
28 28
       $this->logger()->nice(L('KADRO_SYSTEM_FILE_UPDATED'));
29 29
     }
30
-    catch(\Exception $e)
30
+    catch (\Exception $e)
31 31
     {
32 32
       $this->logger()->notice(L('KADRO_SYSTEM_FILE_UPDATED'));
33 33
     }
@@ -38,11 +38,11 @@  discard block
 block discarded – undo
38 38
   {
39 39
     $res = Traduko::filter(['lang' => $lang]);
40 40
     $assoc = [];
41
-    foreach($res as $id => $trad)
41
+    foreach ($res as $id => $trad)
42 42
     {
43
-      if(!isset($assoc[$trad->kategorio]))
43
+      if (!isset($assoc[$trad->kategorio]))
44 44
         $assoc[$trad->kategorio] = [];
45
-      if(!isset($assoc[$trad->kategorio][$trad->sekcio]))
45
+      if (!isset($assoc[$trad->kategorio][$trad->sekcio]))
46 46
         $assoc[$trad->kategorio][$trad->sekcio] = [];
47 47
 
48 48
       $assoc[$trad->kategorio][$trad->sekcio][$trad->referenco] = $trad->$lang;
@@ -57,8 +57,8 @@  discard block
 block discarded – undo
57 57
   public static function init($locale_path)
58 58
   {
59 59
     $languages = array_keys(array_slice(Traduko::inspect(Traduko::table_name())->columns(), 4));
60
-    foreach($languages as $l)
61
-      self::create_file($locale_path,$l);
60
+    foreach ($languages as $l)
61
+      self::create_file($locale_path, $l);
62 62
 
63 63
     return $languages;
64 64
   }
Please login to merge, or discard this 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 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 namespace HexMakina\kadro\Controllers;
13 13
 
14 14
 use \HexMakina\Crudites\Crudites;
15
-use \HexMakina\kadro\Auth\{Operator,OperatorInterface,ACL,AccessRefusedException};
15
+use \HexMakina\kadro\Auth\{Operator, OperatorInterface, ACL, AccessRefusedException};
16 16
 
17 17
 
18 18
 class OperatorController extends \HexMakina\kadro\Controllers\ORMController
@@ -23,7 +23,7 @@  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())
26
+    if (is_null($this->load_model) || $this->operator()->operator_id() !== $this->load_model->operator_id())
27 27
       $this->authorize('group_admin');
28 28
 
29 29
   }
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 
36 36
   public function save()
37 37
   {
38
-    if($this->operator()->operator_id() !== $this->form_model->operator_id())
38
+    if ($this->operator()->operator_id() !== $this->form_model->operator_id())
39 39
       $this->authorize('group_admin');
40 40
 
41 41
     parent::save();
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
   public function before_save() : array
45 45
   {
46 46
     //------------------------------------------------------------- PASSWORDS
47
-    if($this->form_model->get('password') != $this->form_model->get('password_verification'))
47
+    if ($this->form_model->get('password') != $this->form_model->get('password_verification'))
48 48
     {
49 49
       $this->logger()->warning(L('KADRO_operator_ERR_PASSWORDS_MISMATCH'));
50 50
       return $this->edit();
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
   public function dashboard()
59 59
   {
60 60
     $real_operator_class = get_class($this->operator());
61
-    $this->viewport('users', $real_operator_class::filter([], ['order_by' => [null,'username', 'ASC']]));
61
+    $this->viewport('users', $real_operator_class::filter([], ['order_by' => [null, 'username', 'ASC']]));
62 62
   }
63 63
 
64 64
   public function destroy()
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
     parent::authorize('group_admin');
72 72
 
73 73
     $operator = Operator::one($this->router()->params());
74
-    if($operator->username() == $this->operator()->username())
74
+    if ($operator->username() == $this->operator()->username())
75 75
       throw new AccessRefusedException();
76 76
 
77
-    if(Operator::toggle_boolean(Operator::table_name(), 'active', $operator->operator_id()) === true)
77
+    if (Operator::toggle_boolean(Operator::table_name(), 'active', $operator->operator_id()) === true)
78 78
     {
79 79
       $confirmation_message = $operator->is_active() ? 'KADRO_operator_DISABLED' : 'KADRO_operator_ENABLED';
80 80
       $this->logger()->nice(L($confirmation_message, [$operator->name()]));
@@ -92,14 +92,14 @@  discard block
 block discarded – undo
92 92
     parent::authorize('group_admin');
93 93
 
94 94
     $operator = Operator::one(['username' => $this->router()->params('username')]);
95
-    if($operator->username() == $this->operator()->username())
95
+    if ($operator->username() == $this->operator()->username())
96 96
       throw new AccessRefusedException();
97 97
 
98 98
     $permission_id = $this->router()->params('permission_id');
99 99
 
100 100
     $row_data = ['operator_id' => $operator->operator_id(), 'permission_id' => $permission_id];
101 101
     $row = ACL::table()->restore($row_data);
102
-    if($row->is_new())
102
+    if ($row->is_new())
103 103
     {
104 104
       $row = ACL::table()->produce($row_data);
105 105
       $res = $row->persist();
Please login to merge, or discard this 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/ReceptionController.class.php 2 patches
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.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 
3 3
 namespace HexMakina\kadro\Controllers;
4 4
 
5
-use HexMakina\kadro\Auth\{Operator,Permission,ACL};
6
-use HexMakina\kadro\Auth\{OperatorInterface,AccessRefusedException};
5
+use HexMakina\kadro\Auth\{Operator, Permission, ACL};
6
+use HexMakina\kadro\Auth\{OperatorInterface, AccessRefusedException};
7 7
 
8 8
 class ReceptionController extends KadroController
9 9
 {
@@ -15,19 +15,19 @@  discard block
 block discarded – undo
15 15
   public function welcome(OperatorInterface $operator)
16 16
   {
17 17
 
18
-    if($this->router()->name() === 'identify')
18
+    if ($this->router()->name() === 'identify')
19 19
       $this->identify($operator);
20 20
 
21 21
     $Controller = $this->router()->target_controller();
22 22
     $Controller = $this->box($Controller);
23 23
 
24 24
 
25
-    if($Controller->requires_operator())
25
+    if ($Controller->requires_operator())
26 26
     {
27
-      if(is_null($operator = get_class($operator)::exists($this->box('StateAgent')->operator_id())))
27
+      if (is_null($operator = get_class($operator)::exists($this->box('StateAgent')->operator_id())))
28 28
         $this->router()->hop('checkin');
29 29
 
30
-      if(!$operator->is_active())
30
+      if (!$operator->is_active())
31 31
       {
32 32
         $this->checkout();
33 33
         throw new AccessRefusedException();
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 
60 60
       $operator = get_class($op)::exists(['username' => $username]);
61 61
 
62
-      if(is_null($operator) || !$operator->is_active())
62
+      if (is_null($operator) || !$operator->is_active())
63 63
         throw new \Exception('ERR_DISABLED');
64 64
 
65
-      if(!$operator->password_verify($password))
65
+      if (!$operator->password_verify($password))
66 66
         throw new \Exception('ERR_WRONG_LOGIN_OR_PASSWORD');
67 67
 
68 68
       $this->box('StateAgent')->operator_id($operator->get_id());
Please login to merge, or discard this patch.
common.inc.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
   require APP_BASE.'vendor/autoload.php';
15 15
 
16 16
   require 'PSR4Autoloader.class.php';
17
-  $loader=new PSR4Autoloader;
17
+  $loader = new PSR4Autoloader;
18 18
   $loader->register(); //Register loader with SPL autoloader stack.
19 19
 
20 20
   $loader->addNamespace('HexMakina', APP_BASE.'/lib/');
@@ -39,9 +39,9 @@  discard block
 block discarded – undo
39 39
 
40 40
   //---------------------------------------------------------------     parametroj
41 41
   require_once APP_BASE.'configs/settings.php';
42
-  $box=new Container\LeMarchand($settings);
42
+  $box = new Container\LeMarchand($settings);
43 43
 
44
-  foreach($box->get('settings.app.namespaces') as $namespace => $path)
44
+  foreach ($box->get('settings.app.namespaces') as $namespace => $path)
45 45
   {
46 46
     $loader->addNamespace($namespace, $path);
47 47
   }
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
 
58 58
   //---------------------------------------------------------------        kuketoj
59 59
   setcookie('cookie_test', 'test_value', time()+(365 * 24 * 60 * 60), "/", "");
60
-  $cookies_enabled=isset($_COOKIE['cookie_test']); // houston, do we have cookies ?
60
+  $cookies_enabled = isset($_COOKIE['cookie_test']); // houston, do we have cookies ?
61 61
 
62
-  if($cookies_enabled === false)
62
+  if ($cookies_enabled === false)
63 63
   {
64 64
     ini_set('session.use_cookies', 0);
65 65
     ini_set('session.use_only_cookies', 0);
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
   }
69 69
 
70 70
 //---------------------------------------------------------------        Session Management
71
-  $StateAgent=new StateAgent($box->get('settings.app.session_start_options') ?? []);
71
+  $StateAgent = new StateAgent($box->get('settings.app.session_start_options') ?? []);
72 72
   $StateAgent->add_runtime_filters((array)$box->get('settings.filter'));
73 73
   $StateAgent->add_runtime_filters((array)($_SESSION['filter'] ?? []));
74 74
   $StateAgent->add_runtime_filters((array)($_REQUEST['filter'] ?? []));
@@ -92,24 +92,24 @@  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')))
95
+  if (is_null($box->get('settings.smarty.template_path')) || is_null($box->get('settings.smarty.compiled_path')))
96 96
       throw new \Exception("SMARTY CONFIG ERROR: missing parameters");
97 97
 
98
-  $smarty=new \Smarty();
98
+  $smarty = new \Smarty();
99 99
   $box->register('template_engine', $smarty);
100 100
 
101
-  $smarty->setTemplateDir($box->get('RouterInterface')->file_root() . $box->get('settings.smarty.template_path').'app');
102
-  $smarty->addTemplateDir($box->get('RouterInterface')->file_root() . $box->get('settings.smarty.template_path'));
103
-  $smarty->addTemplateDir(KADRO_BASE . 'Views/');
101
+  $smarty->setTemplateDir($box->get('RouterInterface')->file_root().$box->get('settings.smarty.template_path').'app');
102
+  $smarty->addTemplateDir($box->get('RouterInterface')->file_root().$box->get('settings.smarty.template_path'));
103
+  $smarty->addTemplateDir(KADRO_BASE.'Views/');
104 104
 
105
-  $smarty->setCompileDir(APP_BASE . $box->get('settings.smarty.compiled_path'));
105
+  $smarty->setCompileDir(APP_BASE.$box->get('settings.smarty.compiled_path'));
106 106
   $smarty->setDebugging($box->get('settings.smarty.debug'));
107 107
 
108
-  $smarty->registerClass('Lezer',       '\HexMakina\Lezer\Lezer');
109
-  $smarty->registerClass('Marker',       '\HexMakina\Format\HTML\Marker');
110
-  $smarty->registerClass('Form',         '\HexMakina\Format\HTML\Form');
111
-  $smarty->registerClass('TableToForm',  '\HexMakina\kadro\TableToForm');
112
-  $smarty->registerClass('Dato',         '\HexMakina\Format\Tempo\Dato');
108
+  $smarty->registerClass('Lezer', '\HexMakina\Lezer\Lezer');
109
+  $smarty->registerClass('Marker', '\HexMakina\Format\HTML\Marker');
110
+  $smarty->registerClass('Form', '\HexMakina\Format\HTML\Form');
111
+  $smarty->registerClass('TableToForm', '\HexMakina\kadro\TableToForm');
112
+  $smarty->registerClass('Dato', '\HexMakina\Format\Tempo\Dato');
113 113
 
114 114
   $smarty->assign('APP_NAME', $box->get('settings.app.name'));
115 115
 
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
   $lezer->init();
125 125
 
126 126
   $smarty->assign('language', $language);
127
-  if($cookies_enabled === true)
127
+  if ($cookies_enabled === true)
128 128
     setcookie('lang', $language, time()+(365 * 24 * 60 * 60), "/", "");
129 129
 
130 130
 }
Please login to merge, or discard this 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.
Controllers/ORMController.class.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     foreach(['prepare', "before_$method", $method, "after_$method"] as $step => $chainling)
31 31
     {
32 32
       $this->search_and_execute_trait_methods($chainling);
33
-    	if(method_exists($this, $chainling) && empty($this->errors()))
33
+      if(method_exists($this, $chainling) && empty($this->errors()))
34 34
       {
35 35
         $res = $this->$chainling();
36 36
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
     }
49 49
 
50 50
     if(method_exists($this, 'conclude')) // conclude always executed, even with has_halting_messages
51
-    	$this->conclude();
51
+      $this->conclude();
52 52
 
53 53
     if(method_exists($this, 'display'))
54
-    	$this->display($custom_template); // ret value ignored..
54
+      $this->display($custom_template); // ret value ignored..
55 55
   }
56 56
 
57 57
   public function prepare()
Please login to merge, or discard this patch.
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -27,19 +27,19 @@  discard block
 block discarded – undo
27 27
     $custom_template = null;
28 28
     $method = $this->router()->target_method();
29 29
 
30
-    foreach(['prepare', "before_$method", $method, "after_$method"] as $step => $chainling)
30
+    foreach (['prepare', "before_$method", $method, "after_$method"] as $step => $chainling)
31 31
     {
32 32
       $this->search_and_execute_trait_methods($chainling);
33
-    	if(method_exists($this, $chainling) && empty($this->errors()))
33
+    	if (method_exists($this, $chainling) && empty($this->errors()))
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()) // logger handled a critical error during the chailing execution
38 38
         {
39 39
           break; // dont go on with other
40 40
         }
41 41
 
42
-        if($chainling === $method)
42
+        if ($chainling === $method)
43 43
         {
44 44
 
45 45
           $custom_template = $res;
@@ -47,10 +47,10 @@  discard block
 block discarded – undo
47 47
       }
48 48
     }
49 49
 
50
-    if(method_exists($this, 'conclude')) // conclude always executed, even with has_halting_messages
50
+    if (method_exists($this, 'conclude')) // conclude always executed, even with has_halting_messages
51 51
     	$this->conclude();
52 52
 
53
-    if(method_exists($this, 'display'))
53
+    if (method_exists($this, 'display'))
54 54
     	$this->display($custom_template); // ret value ignored..
55 55
   }
56 56
 
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
   {
59 59
     parent::prepare();
60 60
 
61
-    if(!class_exists($this->model_class_name = $this->class_name()))
61
+    if (!class_exists($this->model_class_name = $this->class_name()))
62 62
       throw new \Exception("!class_exists($this->model_class_name)");
63 63
 
64 64
     $this->model_type = $this->model_class_name::model_type();
@@ -68,22 +68,22 @@  discard block
 block discarded – undo
68 68
 
69 69
     $pk_values = [];
70 70
 
71
-    if($this->router()->submits())
71
+    if ($this->router()->submits())
72 72
     {
73 73
       $this->form_model->import($this->sanitize_post_data($this->router()->submitted()));
74 74
       $pk_values = $this->model_class_name::table()->primary_keys_match($this->router()->submitted());
75 75
 
76 76
       $this->load_model = $this->model_class_name::exists($pk_values);
77 77
     }
78
-    elseif($this->router()->requests())
78
+    elseif ($this->router()->requests())
79 79
     {
80 80
       $pk_values = $this->model_class_name::table()->primary_keys_match($this->router()->params());
81 81
 
82
-      if(!is_null($this->load_model = $this->model_class_name::exists($pk_values)))
82
+      if (!is_null($this->load_model = $this->model_class_name::exists($pk_values)))
83 83
         $this->form_model = clone $this->load_model;
84 84
     }
85 85
 
86
-    if(!is_null($this->load_model) && is_subclass_of($this->load_model, '\HexMakina\Crudites\Interfaces\TraceableInterface') && $this->load_model->traceable())
86
+    if (!is_null($this->load_model) && is_subclass_of($this->load_model, '\HexMakina\Crudites\Interfaces\TraceableInterface') && $this->load_model->traceable())
87 87
     {
88 88
       // $traces = $this->tracer()->traces_by_model($this->load_model);
89 89
       $traces = $this->tracer()->history_by_model($this->load_model);
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
   // ----------- META -----------
100 100
   public function class_name() : string
101 101
   {
102
-    if(is_null($this->model_class_name))
102
+    if (is_null($this->model_class_name))
103 103
     {
104 104
       $this->model_class_name = get_called_class();
105 105
       $this->model_class_name = str_replace('\Controllers\\', '\Models\\', $this->model_class_name);
@@ -112,12 +112,12 @@  discard block
 block discarded – undo
112 112
   public function persist_model($model) : ?ModelInterface
113 113
   {
114 114
     $this->errors = $model->save($this->operator()->operator_id(), $this->tracer()); // returns [errors]
115
-    if(empty($this->errors()))
115
+    if (empty($this->errors()))
116 116
     {
117 117
       $this->logger()->nice(L('CRUDITES_INSTANCE_ALTERED', [L('MODEL_'.get_class($model)::model_type().'_INSTANCE')]));
118 118
       return $model;
119 119
     }
120
-    foreach($this->errors() as $field => $error_msg)
120
+    foreach ($this->errors() as $field => $error_msg)
121 121
       $this->logger()->warning(L($error_msg, [$field]));
122 122
 
123 123
     return null;
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
     return $this->listing(); //default dashboard is a listing
129 129
   }
130 130
 
131
-  public function listing($model=null,$filters=[],$options=[])
131
+  public function listing($model = null, $filters = [], $options = [])
132 132
   {
133 133
     $class_name = is_null($model) ? $this->model_class_name : get_class($model);
134 134
 
135
-    if(!isset($filters['date_start']))  $filters['date_start'] = $this->box('StateAgent')->filters('date_start');
136
-    if(!isset($filters['date_stop']))   $filters['date_stop'] = $this->box('StateAgent')->filters('date_stop');
135
+    if (!isset($filters['date_start']))  $filters['date_start'] = $this->box('StateAgent')->filters('date_start');
136
+    if (!isset($filters['date_stop']))   $filters['date_stop'] = $this->box('StateAgent')->filters('date_stop');
137 137
 
138 138
     // dd($filters);
139 139
     $listing = $class_name::filter($filters);
@@ -144,24 +144,24 @@  discard block
 block discarded – undo
144 144
   public function viewport_listing($class_name, $listing, $listing_template)
145 145
   {
146 146
     $listing_fields = [];
147
-    if(empty($listing))
147
+    if (empty($listing))
148 148
     {
149
-      foreach($class_name::table()->columns() as $column)
149
+      foreach ($class_name::table()->columns() as $column)
150 150
       {
151 151
 
152
-        if(!$column->is_auto_incremented() && !$column->is_hidden())
153
-          $listing_fields[$column->name()]=L(sprintf('MODEL_%s_FIELD_%s', $class_name::model_type(), $column->name()));
152
+        if (!$column->is_auto_incremented() && !$column->is_hidden())
153
+          $listing_fields[$column->name()] = L(sprintf('MODEL_%s_FIELD_%s', $class_name::model_type(), $column->name()));
154 154
       }
155 155
     }
156 156
     else
157 157
     {
158 158
       $current = current($listing);
159
-      if(is_object($current))
159
+      if (is_object($current))
160 160
         $current = get_object_vars($current);
161 161
 
162
-      foreach(array_keys($current) as $field)
162
+      foreach (array_keys($current) as $field)
163 163
       {
164
-        $listing_fields[$field]=L(sprintf('MODEL_%s_FIELD_%s', $class_name::model_type(), $field));
164
+        $listing_fields[$field] = L(sprintf('MODEL_%s_FIELD_%s', $class_name::model_type(), $field));
165 165
       }
166 166
 
167 167
     }
@@ -183,13 +183,13 @@  discard block
 block discarded – undo
183 183
     $this->edit();
184 184
   }
185 185
 
186
-  public function edit(){}
186
+  public function edit() {}
187 187
 
188 188
   public function save()
189 189
   {
190 190
     $model = $this->persist_model($this->form_model);
191 191
 
192
-    if(empty($this->errors()))
192
+    if (empty($this->errors()))
193 193
       $this->route_back($model);
194 194
     else
195 195
     {
@@ -200,21 +200,21 @@  discard block
 block discarded – undo
200 200
 
201 201
   public function before_edit()
202 202
   {
203
-    if(!is_null($this->router()->params('id')) && is_null($this->load_model))
203
+    if (!is_null($this->router()->params('id')) && is_null($this->load_model))
204 204
     {
205 205
       $this->logger()->warning(L('CRUDITES_ERR_INSTANCE_NOT_FOUND', [L('MODEL_'.$this->model_class_name::model_type().'_INSTANCE')]));
206 206
       $this->router()->hop($this->model_class_name::model_type());
207 207
     }
208 208
   }
209 209
 
210
-  public function before_save() : array { return [];}
210
+  public function before_save() : array { return []; }
211 211
 
212 212
   // default: hop to altered object
213
-  public function after_save() {$this->router()->hop($this->route_back());}
213
+  public function after_save() {$this->router()->hop($this->route_back()); }
214 214
 
215 215
   public function destroy_confirm()
216 216
   {
217
-    if(is_null($this->load_model))
217
+    if (is_null($this->load_model))
218 218
     {
219 219
       $this->logger()->warning(L('CRUDITES_ERR_INSTANCE_NOT_FOUND', [L('MODEL_'.$this->model_type.'_INSTANCE')]));
220 220
       $this->router()->hop($this->model_type);
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 
228 228
   public function before_destroy() // default: checks for load_model and immortality, hops back to object on failure
229 229
   {
230
-    if(is_null($this->load_model))
230
+    if (is_null($this->load_model))
231 231
     {
232 232
       $this->logger()->warning(L('CRUDITES_ERR_INSTANCE_NOT_FOUND', [L('MODEL_'.$this->model_type.'_INSTANCE')]));
233 233
       $this->router()->hop($this->model_type);
234 234
     }
235
-    elseif($this->load_model->immortal())
235
+    elseif ($this->load_model->immortal())
236 236
     {
237 237
 
238 238
       $this->logger()->warning(L('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [L('MODEL_'.$this->model_type.'_INSTANCE')]));
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 
243 243
   public function destroy()
244 244
   {
245
-    if(!$this->router()->submits())
245
+    if (!$this->router()->submits())
246 246
       throw new \Exception('KADRO_ROUTER_MUST_SUBMIT');
247 247
 
248
-    if($this->load_model->destroy($this->operator()->operator_id(), $this->tracer()) === false)
248
+    if ($this->load_model->destroy($this->operator()->operator_id(), $this->tracer()) === false)
249 249
     {
250 250
       $this->logger()->info(L('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', [''.$this->load_model]));
251 251
       $this->route_back($this->load_model);
@@ -268,10 +268,10 @@  discard block
 block discarded – undo
268 268
 
269 269
     $this->viewport('form_model_type', $this->model_type);
270 270
 
271
-    if(isset($this->load_model))
271
+    if (isset($this->load_model))
272 272
       $this->viewport('load_model', $this->load_model);
273 273
 
274
-    if(isset($this->form_model))
274
+    if (isset($this->form_model))
275 275
       $this->viewport('form_model', $this->form_model);
276 276
   }
277 277
 
@@ -283,15 +283,15 @@  discard block
 block discarded – undo
283 283
 
284 284
     $header = false;
285 285
 
286
-    foreach($collection as $line)
286
+    foreach ($collection as $line)
287 287
     {
288 288
       $line = get_object_vars($line);
289
-      if($header === false)
289
+      if ($header === false)
290 290
       {
291
-        fputcsv($fp,array_keys($line));
291
+        fputcsv($fp, array_keys($line));
292 292
         $header = true;
293 293
       }
294
-      fputcsv($fp,$line);
294
+      fputcsv($fp, $line);
295 295
     }
296 296
     fclose($fp);
297 297
 
@@ -301,7 +301,7 @@  discard block
 block discarded – undo
301 301
   public function export()
302 302
   {
303 303
     $format = $this->router()->params('format');
304
-    switch($format)
304
+    switch ($format)
305 305
     {
306 306
       case null:
307 307
         $filename = $this->model_type;
@@ -330,33 +330,33 @@  discard block
 block discarded – undo
330 330
     $route_params = [];
331 331
 
332 332
     $route_name = get_class($model)::model_type().'_';
333
-    if($model->is_new())
334
-      $route_name.= 'new';
333
+    if ($model->is_new())
334
+      $route_name .= 'new';
335 335
     else
336 336
     {
337
-      $route_name.= 'default';
337
+      $route_name .= 'default';
338 338
       $route_params = ['id' => $model->get_id()];
339 339
     }
340 340
     $res = $this->router()->prehop($route_name, $route_params);
341 341
     return $res;
342 342
   }
343 343
 
344
-  public function route_factory($route=null, $route_params=[]) : string
344
+  public function route_factory($route = null, $route_params = []) : string
345 345
   {
346
-    if(is_null($route) && $this->router()->submits())
346
+    if (is_null($route) && $this->router()->submits())
347 347
       $route = $this->form_model;
348 348
 
349
-    if(!is_null($route) && is_subclass_of($route, '\HexMakina\Crudites\Interfaces\ModelInterface'))
349
+    if (!is_null($route) && is_subclass_of($route, '\HexMakina\Crudites\Interfaces\ModelInterface'))
350 350
       $route = $this->route_model($route);
351 351
 
352 352
     return parent::route_factory($route, $route_params);
353 353
   }
354 354
 
355
-  private function sanitize_post_data($post_data=[])
355
+  private function sanitize_post_data($post_data = [])
356 356
   {
357
-    foreach($this->model_class_name::table()->columns() as $col)
357
+    foreach ($this->model_class_name::table()->columns() as $col)
358 358
     {
359
-      if($col->type()->is_boolean())
359
+      if ($col->type()->is_boolean())
360 360
       {
361 361
           $post_data[$col->name()] = !empty($post_data[$col->name()]);
362 362
       }
Please login to merge, or discard this patch.
Braces   +58 added lines, -41 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,24 @@  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
-    	$this->display($custom_template); // ret value ignored..
58
+    if(method_exists($this, 'display')) {
59
+        	$this->display($custom_template);
60
+    }
61
+    // ret value ignored..
55 62
   }
56 63
 
57 64
   public function prepare()
58 65
   {
59 66
     parent::prepare();
60 67
 
61
-    if(!class_exists($this->model_class_name = $this->class_name()))
62
-      throw new \Exception("!class_exists($this->model_class_name)");
68
+    if(!class_exists($this->model_class_name = $this->class_name())) {
69
+          throw new \Exception("!class_exists($this->model_class_name)");
70
+    }
63 71
 
64 72
     $this->model_type = $this->model_class_name::model_type();
65 73
 
@@ -74,13 +82,13 @@  discard block
 block discarded – undo
74 82
       $pk_values = $this->model_class_name::table()->primary_keys_match($this->router()->submitted());
75 83
 
76 84
       $this->load_model = $this->model_class_name::exists($pk_values);
77
-    }
78
-    elseif($this->router()->requests())
85
+    } elseif($this->router()->requests())
79 86
     {
80 87
       $pk_values = $this->model_class_name::table()->primary_keys_match($this->router()->params());
81 88
 
82
-      if(!is_null($this->load_model = $this->model_class_name::exists($pk_values)))
83
-        $this->form_model = clone $this->load_model;
89
+      if(!is_null($this->load_model = $this->model_class_name::exists($pk_values))) {
90
+              $this->form_model = clone $this->load_model;
91
+      }
84 92
     }
85 93
 
86 94
     if(!is_null($this->load_model) && is_subclass_of($this->load_model, '\HexMakina\Crudites\Interfaces\TraceableInterface') && $this->load_model->traceable())
@@ -117,8 +125,9 @@  discard block
 block discarded – undo
117 125
       $this->logger()->nice(L('CRUDITES_INSTANCE_ALTERED', [L('MODEL_'.get_class($model)::model_type().'_INSTANCE')]));
118 126
       return $model;
119 127
     }
120
-    foreach($this->errors() as $field => $error_msg)
121
-      $this->logger()->warning(L($error_msg, [$field]));
128
+    foreach($this->errors() as $field => $error_msg) {
129
+          $this->logger()->warning(L($error_msg, [$field]));
130
+    }
122 131
 
123 132
     return null;
124 133
   }
@@ -132,8 +141,12 @@  discard block
 block discarded – undo
132 141
   {
133 142
     $class_name = is_null($model) ? $this->model_class_name : get_class($model);
134 143
 
135
-    if(!isset($filters['date_start']))  $filters['date_start'] = $this->box('StateAgent')->filters('date_start');
136
-    if(!isset($filters['date_stop']))   $filters['date_stop'] = $this->box('StateAgent')->filters('date_stop');
144
+    if(!isset($filters['date_start'])) {
145
+      $filters['date_start'] = $this->box('StateAgent')->filters('date_start');
146
+    }
147
+    if(!isset($filters['date_stop'])) {
148
+      $filters['date_stop'] = $this->box('StateAgent')->filters('date_stop');
149
+    }
137 150
 
138 151
     // dd($filters);
139 152
     $listing = $class_name::filter($filters);
@@ -149,15 +162,16 @@  discard block
 block discarded – undo
149 162
       foreach($class_name::table()->columns() as $column)
150 163
       {
151 164
 
152
-        if(!$column->is_auto_incremented() && !$column->is_hidden())
153
-          $listing_fields[$column->name()]=L(sprintf('MODEL_%s_FIELD_%s', $class_name::model_type(), $column->name()));
165
+        if(!$column->is_auto_incremented() && !$column->is_hidden()) {
166
+                  $listing_fields[$column->name()]=L(sprintf('MODEL_%s_FIELD_%s', $class_name::model_type(), $column->name()));
167
+        }
154 168
       }
155
-    }
156
-    else
169
+    } else
157 170
     {
158 171
       $current = current($listing);
159
-      if(is_object($current))
160
-        $current = get_object_vars($current);
172
+      if(is_object($current)) {
173
+              $current = get_object_vars($current);
174
+      }
161 175
 
162 176
       foreach(array_keys($current) as $field)
163 177
       {
@@ -189,9 +203,9 @@  discard block
 block discarded – undo
189 203
   {
190 204
     $model = $this->persist_model($this->form_model);
191 205
 
192
-    if(empty($this->errors()))
193
-      $this->route_back($model);
194
-    else
206
+    if(empty($this->errors())) {
207
+          $this->route_back($model);
208
+    } else
195 209
     {
196 210
       $this->edit();
197 211
       return 'edit';
@@ -231,8 +245,7 @@  discard block
 block discarded – undo
231 245
     {
232 246
       $this->logger()->warning(L('CRUDITES_ERR_INSTANCE_NOT_FOUND', [L('MODEL_'.$this->model_type.'_INSTANCE')]));
233 247
       $this->router()->hop($this->model_type);
234
-    }
235
-    elseif($this->load_model->immortal())
248
+    } elseif($this->load_model->immortal())
236 249
     {
237 250
 
238 251
       $this->logger()->warning(L('CRUDITES_ERR_INSTANCE_IS_IMMORTAL', [L('MODEL_'.$this->model_type.'_INSTANCE')]));
@@ -242,15 +255,15 @@  discard block
 block discarded – undo
242 255
 
243 256
   public function destroy()
244 257
   {
245
-    if(!$this->router()->submits())
246
-      throw new \Exception('KADRO_ROUTER_MUST_SUBMIT');
258
+    if(!$this->router()->submits()) {
259
+          throw new \Exception('KADRO_ROUTER_MUST_SUBMIT');
260
+    }
247 261
 
248 262
     if($this->load_model->destroy($this->operator()->operator_id(), $this->tracer()) === false)
249 263
     {
250 264
       $this->logger()->info(L('CRUDITES_ERR_INSTANCE_IS_UNDELETABLE', [''.$this->load_model]));
251 265
       $this->route_back($this->load_model);
252
-    }
253
-    else
266
+    } else
254 267
     {
255 268
       $this->logger()->nice(L('CRUDITES_INSTANCE_DESTROYED', [L('MODEL_'.$this->model_type.'_INSTANCE')]));
256 269
       $this->route_back($this->model_type);
@@ -268,11 +281,13 @@  discard block
 block discarded – undo
268 281
 
269 282
     $this->viewport('form_model_type', $this->model_type);
270 283
 
271
-    if(isset($this->load_model))
272
-      $this->viewport('load_model', $this->load_model);
284
+    if(isset($this->load_model)) {
285
+          $this->viewport('load_model', $this->load_model);
286
+    }
273 287
 
274
-    if(isset($this->form_model))
275
-      $this->viewport('form_model', $this->form_model);
288
+    if(isset($this->form_model)) {
289
+          $this->viewport('form_model', $this->form_model);
290
+    }
276 291
   }
277 292
 
278 293
   public function collection_to_csv($collection, $filename)
@@ -330,9 +345,9 @@  discard block
 block discarded – undo
330 345
     $route_params = [];
331 346
 
332 347
     $route_name = get_class($model)::model_type().'_';
333
-    if($model->is_new())
334
-      $route_name.= 'new';
335
-    else
348
+    if($model->is_new()) {
349
+          $route_name.= 'new';
350
+    } else
336 351
     {
337 352
       $route_name.= 'default';
338 353
       $route_params = ['id' => $model->get_id()];
@@ -343,11 +358,13 @@  discard block
 block discarded – undo
343 358
 
344 359
   public function route_factory($route=null, $route_params=[]) : string
345 360
   {
346
-    if(is_null($route) && $this->router()->submits())
347
-      $route = $this->form_model;
361
+    if(is_null($route) && $this->router()->submits()) {
362
+          $route = $this->form_model;
363
+    }
348 364
 
349
-    if(!is_null($route) && is_subclass_of($route, '\HexMakina\Crudites\Interfaces\ModelInterface'))
350
-      $route = $this->route_model($route);
365
+    if(!is_null($route) && is_subclass_of($route, '\HexMakina\Crudites\Interfaces\ModelInterface')) {
366
+          $route = $this->route_model($route);
367
+    }
351 368
 
352 369
     return parent::route_factory($route, $route_params);
353 370
   }
Please login to merge, or discard this patch.
Auth/Operator.class.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -66,10 +66,10 @@  discard block
 block discarded – undo
66 66
     return $this->get('language_code');
67 67
   }
68 68
 
69
-  public static function query_retrieve($filters=[], $options=[]) : Select
69
+  public static function query_retrieve($filters = [], $options = []) : Select
70 70
   {
71 71
     $Query = static::table()->select();
72
-    if(isset($options['eager']) && $options['eager'] === true)
72
+    if (isset($options['eager']) && $options['eager'] === true)
73 73
     {
74 74
       $Query->group_by('id');
75 75
 
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
       $Query->select_also(["GROUP_CONCAT(DISTINCT kadro_permission.id) as permission_ids", "GROUP_CONCAT(DISTINCT kadro_permission.name) as permission_names"]);
79 79
     }
80 80
 
81
-    if(isset($filters['model']) && !empty($filters['model']))
81
+    if (isset($filters['model']) && !empty($filters['model']))
82 82
     {
83
-      $Query->join([static::otm('t'), static::otm('a')],[[static::otm('a'),static::otm('k'), 't_from','id']], 'INNER');
83
+      $Query->join([static::otm('t'), static::otm('a')], [[static::otm('a'), static::otm('k'), 't_from', 'id']], 'INNER');
84 84
       $Query->aw_fields_eq(['model_id' => $filters['model']->get_id(), 'model_type' => get_class($filters['model'])::model_type()], static::otm('a'));
85 85
     }
86 86
 
Please login to merge, or discard this patch.
Router/RouterInterface.class.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,17 +13,17 @@
 block discarded – undo
13 13
   public function match($requestUrl = null, $requestMethod = null);
14 14
 
15 15
   // generates URL for href and location
16
-  public function prehop($route, $route_params=[]);
16
+  public function prehop($route, $route_params = []);
17 17
 
18 18
   // heads to another location
19
-  public function hop($route, $route_params=[]);
19
+  public function hop($route, $route_params = []);
20 20
 
21 21
   // do you GET it ?
22 22
   public function requests() : bool;
23 23
 
24 24
   // have you POSTed it ?
25 25
   public function submits() : bool;
26
-  public function submitted($param_name=null);
26
+  public function submitted($param_name = null);
27 27
 
28 28
   public function send_file($file_path);
29 29
 
Please login to merge, or discard this patch.