Test Failed
Push — master ( 53306a...8beb08 )
by Federico
07:33
created
dist/jate/modules/Query/Query.php 1 patch
Braces   +27 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,8 +10,9 @@  discard block
 block discarded – undo
10 10
       $this->currentConnection = null;
11 11
     }
12 12
     public function addConnection( $_path, $_name = "default" ) {
13
-      if(!is_string($_path))
14
-        throw new JException("Parameter must be a string.", 1);
13
+      if(!is_string($_path)) {
14
+              throw new JException("Parameter must be a string.", 1);
15
+      }
15 16
       try {
16 17
         $jConfig = new JConfig($_path);
17 18
         if($jConfig->enable) {
@@ -23,28 +24,33 @@  discard block
 block discarded – undo
23 24
       }
24 25
     }
25 26
     public function addConnectionMan( $_connection, $_name = "default") {
26
-      if(!is_object($_connection) || !is_a($_connection, "Connection"))
27
-        throw new JException("Parameter must be a Connection object.", 1);
27
+      if(!is_object($_connection) || !is_a($_connection, "Connection")) {
28
+              throw new JException("Parameter must be a Connection object.", 1);
29
+      }
28 30
       try {
29 31
         $this->connection["$_name"] = $_connection;
30 32
         $this->currentConnection = $_connection;
31
-        foreach ($this->modules as &$module)
32
-          if(isset($this->currentConnection))
33
+        foreach ($this->modules as &$module) {
34
+                  if(isset($this->currentConnection))
33 35
             $module->addConnectionMan($this->currentConnection, $_name);
36
+        }
34 37
       } catch (Exception $e) {
35 38
         throw new JException($e->getMessage(), 1);
36 39
       }
37 40
     }
38 41
     public function setConnection( $_name = "default" ) {
39
-      if(!is_string($_name))
40
-        throw new JException("Parameter must be a string.", 1);
41
-      if(!isset($this->connection["$_name"]))
42
-        throw new JException("This connection name does not exist.", 1);
42
+      if(!is_string($_name)) {
43
+              throw new JException("Parameter must be a string.", 1);
44
+      }
45
+      if(!isset($this->connection["$_name"])) {
46
+              throw new JException("This connection name does not exist.", 1);
47
+      }
43 48
       $this->currentConnection = $this->connection["$_name"];
44 49
     }
45 50
     public function query( $_query ) {
46
-      if(!is_string($_query))
47
-        throw new JException("Parameter must be a string.", 1);
51
+      if(!is_string($_query)) {
52
+              throw new JException("Parameter must be a string.", 1);
53
+      }
48 54
       try {
49 55
         $temp = $this->currentConnection->database->query($_query);
50 56
       } catch (Exception $e) {
@@ -53,8 +59,9 @@  discard block
 block discarded – undo
53 59
       return $temp;
54 60
     }
55 61
     public function queryInsert( $_query ) {
56
-      if(!is_string($_query))
57
-        throw new JException("Parameter must be a string.", 1);
62
+      if(!is_string($_query)) {
63
+              throw new JException("Parameter must be a string.", 1);
64
+      }
58 65
       try {
59 66
         $temp = $this->currentConnection->database->queryInsert($_query);
60 67
       } catch (Exception $e) {
@@ -63,8 +70,9 @@  discard block
 block discarded – undo
63 70
       return $temp;
64 71
     }
65 72
     public function queryFetch( $_query ) {
66
-      if(!is_string($_query))
67
-        throw new JException("Parameter must be a string.", 1);
73
+      if(!is_string($_query)) {
74
+              throw new JException("Parameter must be a string.", 1);
75
+      }
68 76
       try {
69 77
         $temp = $this->currentConnection->database->queryFetch($_query);
70 78
       } catch (Exception $e) {
@@ -73,8 +81,9 @@  discard block
 block discarded – undo
73 81
       return $temp;
74 82
     }
75 83
     public function queryArray( $_query ) {
76
-      if(!is_string($_query))
77
-        throw new JException("Parameter must be a string.", 1);
84
+      if(!is_string($_query)) {
85
+              throw new JException("Parameter must be a string.", 1);
86
+      }
78 87
       try {
79 88
         $temp = $this->currentConnection->database->queryArray($_query);
80 89
       } catch (Exception $e) {
Please login to merge, or discard this patch.
dist/jate/modules/Router/Router.php 1 patch
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  discard block
 block discarded – undo
6 6
     protected $defaultPage;
7 7
     protected $urlCaseSensitive;
8 8
     public function __construct( $_path, $_urlCaseSensitive = false ) {
9
-      if(!is_string($_path))
10
-        throw new JException("Parameter must be a string.");
9
+      if(!is_string($_path)) {
10
+              throw new JException("Parameter must be a string.");
11
+      }
11 12
       $jConfig   = new JConfig($_path);
12 13
       $server    = new ServerVars();
13 14
       $request   = $server->server["REQUEST_URI"];
@@ -24,8 +25,9 @@  discard block
 block discarded – undo
24 25
       foreach ($this->pages as $page) {
25 26
         $urlParameters = $this->pathSeeker(explode("/", $page[0]), $this->url);
26 27
         if(is_array($urlParameters)) {
27
-          if(isset($page[2]) && is_array($page[2]))
28
-            $urlParameters = array_merge($urlParameters, $page[2]);
28
+          if(isset($page[2]) && is_array($page[2])) {
29
+                      $urlParameters = array_merge($urlParameters, $page[2]);
30
+          }
29 31
           $pageSelected = [
30 32
             $page[1],
31 33
             $urlParameters
@@ -33,10 +35,11 @@  discard block
 block discarded – undo
33 35
           break;
34 36
         }
35 37
       }
36
-      if( $pageSelected !== null )
37
-        return $pageSelected;
38
-      else
39
-        return $this->defaultPage;
38
+      if( $pageSelected !== null ) {
39
+              return $pageSelected;
40
+      } else {
41
+              return $this->defaultPage;
42
+      }
40 43
     }
41 44
     protected function pathSeeker( $_path, $_url ) {
42 45
       $urlLength = count($_url);
@@ -47,15 +50,18 @@  discard block
 block discarded – undo
47 50
         while($cont < $urlLength) {
48 51
           if(
49 52
             ($this->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
50
-            (!$this->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
51
-            $cont++;
52
-          else if( strpos($_path[$cont], "\$") !== false ) {
53
+            (!$this->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) ) {
54
+                      $cont++;
55
+          } else if( strpos($_path[$cont], "\$") !== false ) {
53 56
             $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
54 57
             $cont++;
55
-          } else break;
58
+          } else {
59
+          	break;
60
+          }
61
+        }
62
+        if($cont == $urlLength) {
63
+                  return $variables;
56 64
         }
57
-        if($cont == $urlLength)
58
-          return $variables;
59 65
       }
60 66
       return null;
61 67
     }
Please login to merge, or discard this patch.
dist/jate/modules/Html/Html.php 1 patch
Braces   +33 added lines, -22 removed lines patch added patch discarded remove patch
@@ -27,8 +27,9 @@  discard block
 block discarded – undo
27 27
     }
28 28
     abstract public function init();
29 29
     public function draw() {
30
-      if($this->template == "")
31
-        throw new JException("The variable \$this->template must be set in class $this->name function init().");
30
+      if($this->template == "") {
31
+              throw new JException("The variable \$this->template must be set in class $this->name function init().");
32
+      }
32 33
       $server = new ServerVars();
33 34
       $this->addDipendences();
34 35
       $this->tags["css"]  = array_unique($this->tags["css"]);
@@ -47,34 +48,41 @@  discard block
 block discarded – undo
47 48
       return $this->jsVars;
48 49
     }
49 50
     public function addJsVar( $_name, $_value ) {
50
-      if(!is_string($_name))
51
-        throw new InvalidArgumentException("Parameter name must be a string.");
52
-      if(!is_string($_value))
53
-        throw new InvalidArgumentException("Parameter value must be a string.");
51
+      if(!is_string($_name)) {
52
+              throw new InvalidArgumentException("Parameter name must be a string.");
53
+      }
54
+      if(!is_string($_value)) {
55
+              throw new InvalidArgumentException("Parameter value must be a string.");
56
+      }
54 57
       $this->jsVars[] = [$_name, $_value];
55 58
     }
56 59
     public function addJsVars( $_array ) {
57
-      if(!is_array($_array))
58
-        throw new InvalidArgumentException("Parameter must be an array.");
59
-      foreach ($_array as $value)
60
-        $this->addJsVar($value[0], $value[1]);
60
+      if(!is_array($_array)) {
61
+              throw new InvalidArgumentException("Parameter must be an array.");
62
+      }
63
+      foreach ($_array as $value) {
64
+              $this->addJsVar($value[0], $value[1]);
65
+      }
61 66
     }
62 67
     protected function stringifyDipendences() {
63 68
       $tempStr = "";
64 69
       $timeParameter = "?t=".time();
65 70
       $time = ($this->app->cache->css == true) ? "" : $timeParameter;
66
-      foreach ($this->tags["css"] as $i)
67
-      $tempStr .= "<link rel='stylesheet' href='$i$time'>";
71
+      foreach ($this->tags["css"] as $i) {
72
+            $tempStr .= "<link rel='stylesheet' href='$i$time'>";
73
+      }
68 74
       $this->tags["css"] = $tempStr;
69 75
       $tempStr = "";
70 76
       $time = ($this->app->cache->js == true) ? "" : $timeParameter;
71
-      foreach ($this->tags["js"] as $i)
72
-      $tempStr .= "<script src='$i$time'></script>";
77
+      foreach ($this->tags["js"] as $i) {
78
+            $tempStr .= "<script src='$i$time'></script>";
79
+      }
73 80
       $this->tags["js"] = $tempStr;
74 81
       $tempStr = "";
75 82
       $tempStr .= "<script type='text/javascript'>";
76
-      foreach ($this->tags["jsVar"] as $i)
77
-      $tempStr .= " $i[0] = $i[1];\n";
83
+      foreach ($this->tags["jsVar"] as $i) {
84
+            $tempStr .= " $i[0] = $i[1];\n";
85
+      }
78 86
       $tempStr .= "</script>";
79 87
       $this->tags["jsVar"] = $tempStr;
80 88
     }
@@ -87,14 +95,17 @@  discard block
 block discarded – undo
87 95
       $temp = [];
88 96
       $filesRequired = $this->getFilesRequired();
89 97
       $files         = $this->getFiles();
90
-      foreach ($filesRequired as $i)
91
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
98
+      foreach ($filesRequired as $i) {
99
+              if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92 100
           $temp[] = $i;
93
-      foreach ($this->modules as $i)
94
-        $temp = array_merge( $temp, $i->$_function() );
95
-      foreach ($files as $i)
96
-        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 ($files as $i) {
106
+              if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
97 107
           $temp[] = $i;
108
+      }
98 109
       return $temp;
99 110
     }
100 111
   }
Please login to merge, or discard this patch.
dist/jate/modules/Module/Module.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -17,19 +17,24 @@
 block discarded – undo
17 17
       $this->__fileConstruct();
18 18
     }
19 19
     public function addModules( $_modules ) {
20
-      if(!is_array($_modules))
21
-        throw new JException("Parameter must be an array.");
22
-      foreach ($_modules as $value)
23
-        $this->addModule($value);
20
+      if(!is_array($_modules)) {
21
+              throw new JException("Parameter must be an array.");
22
+      }
23
+      foreach ($_modules as $value) {
24
+              $this->addModule($value);
25
+      }
24 26
     }
25 27
     public function addModule( $_module ) {
26
-      if(!is_object($_module))
27
-        throw new JException("Parameter must be a object.");
28
-      if(! is_subclass_of ($_module, "Module"))
29
-        throw new JException("Parameter must be a object inherited from Module object.");
28
+      if(!is_object($_module)) {
29
+              throw new JException("Parameter must be a object.");
30
+      }
31
+      if(! is_subclass_of ($_module, "Module")) {
32
+              throw new JException("Parameter must be a object inherited from Module object.");
33
+      }
30 34
       $this->modules[$_module->name] = $_module;
31
-      if($this->currentConnection)
32
-        $this->modules[$_module->name]->addConnectionMan($this->currentConnection);
35
+      if($this->currentConnection) {
36
+              $this->modules[$_module->name]->addConnectionMan($this->currentConnection);
37
+      }
33 38
     }
34 39
   }
35 40
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/JConfig/JConfig.php 1 patch
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,19 +1,24 @@
 block discarded – undo
1 1
 <?php
2 2
   class JConfig {
3 3
     public function __construct( $_path ) {
4
-      if(!is_string($_path))
5
-        throw new JException("Path must be a string.");
6
-      if(!file_exists($_path))
7
-        throw new JException("File [$_path] not found.");
4
+      if(!is_string($_path)) {
5
+              throw new JException("Path must be a string.");
6
+      }
7
+      if(!file_exists($_path)) {
8
+              throw new JException("File [$_path] not found.");
9
+      }
8 10
       $data = file_get_contents($_path);
9 11
       $data = json_decode($data);
10
-      if($data === NULL)
11
-        throw new JException("Invalid file data. [$_path]");
12
-      if(is_object($data))
13
-        foreach (get_object_vars($data) as $key => $value)
12
+      if($data === NULL) {
13
+              throw new JException("Invalid file data. [$_path]");
14
+      }
15
+      if(is_object($data)) {
16
+              foreach (get_object_vars($data) as $key => $value)
14 17
           $this->$key = $value;
15
-      if(is_array($data))
16
-        $this->data = $data;
18
+      }
19
+      if(is_array($data)) {
20
+              $this->data = $data;
21
+      }
17 22
     }
18 23
   }
19 24
 ?>
Please login to merge, or discard this patch.