Test Failed
Push — master ( c57064...01ffe9 )
by Federico
02:07
created
dist/jate/modules/WebApp/WebApp.php 1 patch
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,15 +19,17 @@  discard block
 block discarded – undo
19 19
       if(is_array($_page)) {
20 20
         $path  = $_page[0];
21 21
         $class = $_page[1];
22
-        if(isset($_page[2]))
23
-          $param = $_page[2];
22
+        if(isset($_page[2])) {
23
+                  $param = $_page[2];
24
+        }
24 25
       }
25 26
       $this->pages[$path] = [$class, $param];
26 27
       return $this->pages[$path];
27 28
     }
28 29
     public function addPages( $_pages ) {
29
-      foreach ($_pages as $i)
30
-        $this->addPage($i);
30
+      foreach ($_pages as $i) {
31
+              $this->addPage($i);
32
+      }
31 33
     }
32 34
     public function fetchPage() {
33 35
       $router = new Router();
@@ -43,10 +45,11 @@  discard block
 block discarded – undo
43 45
           break;
44 46
         }
45 47
       }
46
-      if( isset($temp[1]) && is_array($temp[1]) )
47
-        $temp[1] = array_merge($temp[1], $parameters);
48
-      else
49
-        $temp[1] = $parameters;
48
+      if( isset($temp[1]) && is_array($temp[1]) ) {
49
+              $temp[1] = array_merge($temp[1], $parameters);
50
+      } else {
51
+              $temp[1] = $parameters;
52
+      }
50 53
       $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
51 54
       return $this->currentPage;
52 55
     }
@@ -68,15 +71,18 @@  discard block
 block discarded – undo
68 71
         while($cont < $urlLength) {
69 72
           if(
70 73
             ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
71
-            (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
72
-            $cont++;
73
-          else if( strpos($_path[$cont], "\$") !== false ) {
74
+            (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) ) {
75
+                      $cont++;
76
+          } else if( strpos($_path[$cont], "\$") !== false ) {
74 77
             $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
75 78
             $cont++;
76
-          } else break;
79
+          } else {
80
+          	break;
81
+          }
82
+        }
83
+        if($cont == $urlLength) {
84
+                  return $variables;
77 85
         }
78
-        if($cont == $urlLength)
79
-          return $variables;
80 86
       }
81 87
       return null;
82 88
     }
Please login to merge, or discard this patch.
dist/jate/modules/Module/Module.php 1 patch
Braces   +48 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,50 +29,63 @@  discard block
 block discarded – undo
29 29
     }
30 30
     public function getJsVariables() {
31 31
       $temp = [];
32
-      foreach ($this->required as $i)
33
-        if (is_array($i))
32
+      foreach ($this->required as $i) {
33
+              if (is_array($i))
34 34
           array_push($temp,$i);
35
-      foreach ($this->modules as $i)
36
-        $temp = array_merge( $temp, $i->getJsVariables() );
37
-      foreach ($this->files as $i)
38
-        if (is_array($i))
35
+      }
36
+      foreach ($this->modules as $i) {
37
+              $temp = array_merge( $temp, $i->getJsVariables() );
38
+      }
39
+      foreach ($this->files as $i) {
40
+              if (is_array($i))
39 41
           array_push($temp,$i);
42
+      }
40 43
       return $temp;
41 44
     }
42 45
     public function addModules( $_mods ) {
43
-      if(!is_array($_mods))
44
-        throw new InvalidArgumentException("Parameter must be an array.");
45
-      foreach ($_mods as $value)
46
-        $this->addModule($value);
46
+      if(!is_array($_mods)) {
47
+              throw new InvalidArgumentException("Parameter must be an array.");
48
+      }
49
+      foreach ($_mods as $value) {
50
+              $this->addModule($value);
51
+      }
47 52
     }
48 53
     public function addModule( $_mod ) {
49
-      if(!is_object($_mod))
50
-        throw new InvalidArgumentException("Parameter must be a class.");
51
-      if(! is_subclass_of ($_mod, "Module"))
52
-        throw new InvalidArgumentException("Parameter must be a class.");
54
+      if(!is_object($_mod)) {
55
+              throw new InvalidArgumentException("Parameter must be a class.");
56
+      }
57
+      if(! is_subclass_of ($_mod, "Module")) {
58
+              throw new InvalidArgumentException("Parameter must be a class.");
59
+      }
53 60
       $this->modules[$_mod->name] = $_mod;
54 61
       $this->modules[$_mod->name]->parameters = &$this->parameters;
55 62
     }
56 63
     public function addFiles( $_files ) {
57
-      if(!is_array($_files))
58
-        throw new InvalidArgumentException("Parameter must be an array.");
59
-      foreach ($_files as $value)
60
-        $this->addFile($value);
64
+      if(!is_array($_files)) {
65
+              throw new InvalidArgumentException("Parameter must be an array.");
66
+      }
67
+      foreach ($_files as $value) {
68
+              $this->addFile($value);
69
+      }
61 70
     }
62 71
     public function addFile( $_file ) {
63
-      if(!(is_string($_file) || is_array($_file)))
64
-        throw new InvalidArgumentException("Parameter must be a string or an array.");
72
+      if(!(is_string($_file) || is_array($_file))) {
73
+              throw new InvalidArgumentException("Parameter must be a string or an array.");
74
+      }
65 75
       array_push($this->files, $_file);
66 76
     }
67 77
     public function addFilesRequired( $_files ) {
68
-      if(!is_array($_files))
69
-        throw new InvalidArgumentException("Parameter must be an array.");
70
-      foreach ($_files as $value)
71
-        $this->addFileRequired($value);
78
+      if(!is_array($_files)) {
79
+              throw new InvalidArgumentException("Parameter must be an array.");
80
+      }
81
+      foreach ($_files as $value) {
82
+              $this->addFileRequired($value);
83
+      }
72 84
     }
73 85
     public function addFileRequired( $_file ) {
74
-      if(!is_string($_file))
75
-        throw new InvalidArgumentException("Parameter must be a string.");
86
+      if(!is_string($_file)) {
87
+              throw new InvalidArgumentException("Parameter must be a string.");
88
+      }
76 89
       array_push($this->required, $_file);
77 90
     }
78 91
     protected function addDipendences() {
@@ -82,14 +95,17 @@  discard block
 block discarded – undo
82 95
     }
83 96
     protected function getRequire( $_function, $_extenction) {
84 97
       $temp = [];
85
-      foreach ($this->required as $i)
86
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
98
+      foreach ($this->required as $i) {
99
+              if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
87 100
           array_push($temp,$i);
88
-      foreach ($this->modules as $i)
89
-        $temp = array_merge( $temp, $i->$_function() );
90
-      foreach ($this->files as $i)
91
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
101
+      }
102
+      foreach ($this->modules as $i) {
103
+              $temp = array_merge( $temp, $i->$_function() );
104
+      }
105
+      foreach ($this->files as $i) {
106
+              if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92 107
           array_push($temp,$i);
108
+      }
93 109
       return $temp;
94 110
     }
95 111
   }
Please login to merge, or discard this patch.
dist/jate/modules/GUI/GUI.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,9 +18,10 @@
 block discarded – undo
18 18
       echo minifyOutput($render);
19 19
     }
20 20
     protected function overlayTag( $_page ) {
21
-      foreach($this->tags as $key => $value)
22
-        if(!is_array($value))
21
+      foreach($this->tags as $key => $value) {
22
+              if(!is_array($value))
23 23
           $_page = str_replace("<_${key}_>", "$value", $_page);
24
+      }
24 25
       return $_page;
25 26
     }
26 27
     protected function parsingFile( $_file, $_type = "html" ) {
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/ConnectionMysqliAdapter.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,15 +16,17 @@
 block discarded – undo
16 16
       public function queryFetch( $_query ) {
17 17
         $result = $this->stdQuery($_query);
18 18
         $rows = [];
19
-        while($row = $result->fetch_assoc())
20
-          $rows[] = $row;
19
+        while($row = $result->fetch_assoc()) {
20
+                  $rows[] = $row;
21
+        }
21 22
         return $rows;
22 23
       }
23 24
       public function queryArray( $_query ) {
24 25
         $result = $this->stdQuery($_query);
25 26
         $rows = [];
26
-        while($row = $result->fetch_array())
27
-          $rows[] = $row;
27
+        while($row = $result->fetch_array()) {
28
+                  $rows[] = $row;
29
+        }
28 30
         return $rows;
29 31
       }
30 32
       protected function stdQuery( $_query ) {
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Connection.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@  discard block
 block discarded – undo
8 8
       parent::__construct();
9 9
       $args = func_get_args();
10 10
       $count = func_num_args();
11
-      if (method_exists($this,$func='__construct'.$count))
12
-        call_user_func_array(array($this,$func),$args);
11
+      if (method_exists($this,$func='__construct'.$count)) {
12
+              call_user_func_array(array($this,$func),$args);
13
+      }
13 14
     }
14 15
     public function __construct0() {
15 16
       $this->database = null;
@@ -33,9 +34,10 @@  discard block
 block discarded – undo
33 34
       $this->setConnectionParameters( $_srv, $_db, $_usr, $_pass);
34 35
     }
35 36
     protected function getConnectionType( $_type ) {
36
-      foreach ($_type as $key => $value)
37
-        if($value)
37
+      foreach ($_type as $key => $value) {
38
+              if($value)
38 39
           return $key;
40
+      }
39 41
       return "pdo";
40 42
     }
41 43
     protected function setConnectionParameters( $_srv, $_db, $_usr, $_pass) {
Please login to merge, or discard this patch.
dist/jate/modules/JConfig/JConfig.php 1 patch
Braces   +8 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,10 +23,11 @@  discard block
 block discarded – undo
23 23
     public function import( $_path, $_type = "misc" ) {
24 24
       $data = file_get_contents($_path);
25 25
       $data = json_decode($data);
26
-      if( $_type == "connection" )
27
-        $this->overlayConnection($data);
28
-      else
29
-        $this->overlayMisc($data);
26
+      if( $_type == "connection" ) {
27
+              $this->overlayConnection($data);
28
+      } else {
29
+              $this->overlayMisc($data);
30
+      }
30 31
     }
31 32
     protected function overlayConnection( $_data ) {
32 33
       $this->connection = $this->obj2array($_data);
@@ -46,8 +47,9 @@  discard block
 block discarded – undo
46 47
       return $return;
47 48
     }
48 49
     protected function importObject( $_object ) {
49
-      foreach (get_object_vars($_object) as $key => $value)
50
-        $this->$key = $value;
50
+      foreach (get_object_vars($_object) as $key => $value) {
51
+              $this->$key = $value;
52
+      }
51 53
     }
52 54
   }
53 55
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Html/Html.php 1 patch
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,18 +30,21 @@
 block discarded – undo
30 30
       $tempStr = "";
31 31
       $timeParameter = "?t=".time();
32 32
       $time = ($this->parameters["app"]->cache->css == true) ? "" : $timeParameter;
33
-      foreach ($this->tags["css"] as $i)
34
-        $tempStr .= "<link rel='stylesheet' href='$i$time'>";
33
+      foreach ($this->tags["css"] as $i) {
34
+              $tempStr .= "<link rel='stylesheet' href='$i$time'>";
35
+      }
35 36
       $this->tags["css"] = $tempStr;
36 37
       $tempStr = "";
37 38
       $time = ($this->parameters["app"]->cache->js == true) ? "" : $timeParameter;
38
-      foreach ($this->tags["js"] as $i)
39
-        $tempStr .= "<script src='$i$time'></script>";
39
+      foreach ($this->tags["js"] as $i) {
40
+              $tempStr .= "<script src='$i$time'></script>";
41
+      }
40 42
       $this->tags["js"] = $tempStr;
41 43
       $tempStr = "";
42 44
       $tempStr .= "<script type='text/javascript'>";
43
-      foreach ($this->tags["jsVariables"] as $i)
44
-        $tempStr .= " $i[0] = $i[1];\n";
45
+      foreach ($this->tags["jsVariables"] as $i) {
46
+              $tempStr .= " $i[0] = $i[1];\n";
47
+      }
45 48
       $tempStr .= "</script>";
46 49
       $this->tags["jsVariables"] = $tempStr;
47 50
     }
Please login to merge, or discard this patch.
dist/jate/modules/Menu/Menu.php 1 patch
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -12,9 +12,10 @@  discard block
 block discarded – undo
12 12
           $pk_menu = $i["pk_menu"];
13 13
           array_push($temp, array("label" => $i["label"], "link" => $i["link"], "submenu" => [], "relative" => false));
14 14
           $submenu = $this->queryFetch("SELECT * FROM menu WHERE fk_menu = $pk_menu ORDER BY `order`");
15
-          if($submenu)
16
-          foreach ($submenu as $j)
15
+          if($submenu) {
16
+                    foreach ($submenu as $j)
17 17
             array_push( $temp[count($temp)-1]["submenu"], array("label" => $j["label"], "link" => $j["link"], "submenu" => [], "relative" => false) );
18
+          }
18 19
         }
19 20
       }
20 21
       $this->tags["menu"] = $temp;
@@ -28,12 +29,13 @@  discard block
 block discarded – undo
28 29
       $relative    = $this->parameters["app"]->server["RELATIVE"];
29 30
       foreach ($this->tags["menu"] as $i) {
30 31
         $prePath = "";
31
-        if($i["relative"])
32
-          $prePath = $relative;
32
+        if($i["relative"]) {
33
+                  $prePath = $relative;
34
+        }
33 35
         $active = $this->isSubString($actualLink, array_merge(array_column($i["submenu"], 'link'), array($i["link"]))) ? "active" : "";
34
-        if( is_array($i["submenu"]) && count($i["submenu"])<1)
35
-            $temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>";
36
-        else {
36
+        if( is_array($i["submenu"]) && count($i["submenu"])<1) {
37
+                    $temp .= "<li class='$active'><a href='$prePath$i[link]'>$i[label]</a></li>";
38
+        } else {
37 39
           $temp .= "<li class='dropdown $active'>";
38 40
           $temp .=
39 41
             '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.
@@ -43,8 +45,9 @@  discard block
 block discarded – undo
43 45
             '<ul class="dropdown-menu">';
44 46
           foreach ($i["submenu"] as $j) {
45 47
             $prePath = "";
46
-            if($j["relative"])
47
-              $prePath = $relative;
48
+            if($j["relative"]) {
49
+                          $prePath = $relative;
50
+            }
48 51
             $temp .= "<li><a href='$prePath$j[link]'>$j[label]</a></li>";
49 52
           }
50 53
           $temp .= "</ul></li>";
@@ -54,16 +57,18 @@  discard block
 block discarded – undo
54 57
     }
55 58
     protected function isSubString( $_string, $_list) {
56 59
       $success = false;
57
-      foreach ($_list as $i)
58
-        if(strpos($_string,$i) !== false)
60
+      foreach ($_list as $i) {
61
+              if(strpos($_string,$i) !== false)
59 62
           $success = true;
63
+      }
60 64
       return $success;
61 65
     }
62 66
     public function loginWithUser() {
63 67
       $this->init();
64 68
       $temp = [];
65
-      if(!isset($_SESSION["username"]))
66
-        $_SESSION["username"] ="guest";
69
+      if(!isset($_SESSION["username"])) {
70
+              $_SESSION["username"] ="guest";
71
+      }
67 72
       $user = $_SESSION["username"];
68 73
       $blackList = $this->queryFetch(
69 74
         "SELECT user.*,user_section.*
@@ -77,11 +82,13 @@  discard block
 block discarded – undo
77 82
       foreach ($this->tags["menu"] as $i) {
78 83
         $success = true;
79 84
         $k = $i["label"];
80
-        foreach ($blackList as $j)
81
-          if( $j["section"] == $k)
85
+        foreach ($blackList as $j) {
86
+                  if( $j["section"] == $k)
82 87
             $success = false;
83
-        if($success)
84
-          array_push($temp,$i);
88
+        }
89
+        if($success) {
90
+                  array_push($temp,$i);
91
+        }
85 92
       }
86 93
       $this->tags["menu"] = $temp;
87 94
     }
Please login to merge, or discard this patch.
dist/jate/modules/Query/Query.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,10 @@
 block discarded – undo
12 12
       $this->connection["$_name"] = $_connection;
13 13
       $this->currentConnection = $_connection;
14 14
 
15
-      foreach ($this->modules as &$module)
16
-        if(isset($module->currentConnection))
15
+      foreach ($this->modules as &$module) {
16
+              if(isset($module->currentConnection))
17 17
           $module->addConnection($_name, $_connection);
18
+      }
18 19
     }
19 20
     public function setConnection( $_name ) {
20 21
       $this->currentConnection = $this->connection["$_name"];
Please login to merge, or discard this patch.