Test Failed
Push — master ( febff5...847b4d )
by Federico
03:16
created
dist/jate/modules/WebApp/WebApp.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@
 block discarded – undo
2 2
   jRequire("../Router/Router.php");
3 3
   jRequire("../JConfig/JConfig.php");
4 4
   class WebApp {
5
-    private $router;
6
-    private $misc;
7
-    public function __construct() {
8
-      $configPath   = "config";
9
-      $this->misc   = new JConfig("$configPath/app.json");
10
-      $this->router = new Router("$configPath/router.json", $this->misc->urlCaseSensitive);
11
-    }
12
-    public function draw() {
13
-      $pageSelected = $this->router->getPage();
14
-      $currentPage = new $pageSelected[0]();
15
-      $currentPage->setParameters(["app" => $this->misc, "page" => $pageSelected[1]]);
16
-      $currentPage->init();
17
-      echo minifyOutput($currentPage->draw());
18
-    }
5
+	private $router;
6
+	private $misc;
7
+	public function __construct() {
8
+	  $configPath   = "config";
9
+	  $this->misc   = new JConfig("$configPath/app.json");
10
+	  $this->router = new Router("$configPath/router.json", $this->misc->urlCaseSensitive);
11
+	}
12
+	public function draw() {
13
+	  $pageSelected = $this->router->getPage();
14
+	  $currentPage = new $pageSelected[0]();
15
+	  $currentPage->setParameters(["app" => $this->misc, "page" => $pageSelected[1]]);
16
+	  $currentPage->init();
17
+	  echo minifyOutput($currentPage->draw());
18
+	}
19 19
   }
20 20
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Router/Router.php 3 patches
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -1,63 +1,63 @@
 block discarded – undo
1 1
 <?php
2 2
   requireComponent("../ServerVars/ServerVars.php");
3 3
   class Router {
4
-    protected $url;
5
-    protected $pages;
6
-    protected $defaultPage;
7
-    protected $urlCaseSensitive;
8
-    public function __construct( $_path, $_urlCaseSensitive = false ) {
9
-      if(!is_string($_path))
10
-        throw new JException("Parameter must be a string.");
11
-      $jConfig   = new JConfig($_path);
12
-      $server    = new ServerVars();
13
-      $request   = $server->server["REQUEST_URI"];
14
-      $base      = $server->server["RELATIVE"];
15
-      $url       = str_replace($base, "", $request);
16
-      $this->url = explode("/", $url);
17
-      $this->pages       = $jConfig->pages;
18
-      $this->defaultPage = $jConfig->defaultPage;
19
-      $this->urlCaseSensitive = $_urlCaseSensitive;
20
-    }
21
-    public function getPage() {
22
-      $parameters = [];
23
-      $pageSelected = null;
24
-      foreach ($this->pages as $page) {
25
-        $urlParameters = $this->pathSeeker(explode("/", $page[0]), $this->url);
26
-        if(is_array($urlParameters)) {
27
-          if(isset($page[2]) && is_array($page[2]))
28
-            $urlParameters = array_merge($urlParameters, $page[2]);
29
-          $pageSelected = [
30
-            $page[1],
31
-            $urlParameters
32
-          ];
33
-          break;
34
-        }
35
-      }
36
-      if( $pageSelected !== null )
37
-        return $pageSelected;
38
-      else
39
-        return $this->defaultPage;
40
-    }
41
-    protected function pathSeeker( $_path, $_url ) {
42
-      $urlLength = count($_url);
43
-      $cont = 0;
44
-      $variables = [];
45
-      $pathLength = count($_path);
46
-      if($urlLength == $pathLength) {
47
-        while($cont < $urlLength) {
48
-          if(
49
-            ($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
-            $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
54
-            $cont++;
55
-          } else break;
56
-        }
57
-        if($cont == $urlLength)
58
-          return $variables;
59
-      }
60
-      return null;
61
-    }
4
+	protected $url;
5
+	protected $pages;
6
+	protected $defaultPage;
7
+	protected $urlCaseSensitive;
8
+	public function __construct( $_path, $_urlCaseSensitive = false ) {
9
+	  if(!is_string($_path))
10
+		throw new JException("Parameter must be a string.");
11
+	  $jConfig   = new JConfig($_path);
12
+	  $server    = new ServerVars();
13
+	  $request   = $server->server["REQUEST_URI"];
14
+	  $base      = $server->server["RELATIVE"];
15
+	  $url       = str_replace($base, "", $request);
16
+	  $this->url = explode("/", $url);
17
+	  $this->pages       = $jConfig->pages;
18
+	  $this->defaultPage = $jConfig->defaultPage;
19
+	  $this->urlCaseSensitive = $_urlCaseSensitive;
20
+	}
21
+	public function getPage() {
22
+	  $parameters = [];
23
+	  $pageSelected = null;
24
+	  foreach ($this->pages as $page) {
25
+		$urlParameters = $this->pathSeeker(explode("/", $page[0]), $this->url);
26
+		if(is_array($urlParameters)) {
27
+		  if(isset($page[2]) && is_array($page[2]))
28
+			$urlParameters = array_merge($urlParameters, $page[2]);
29
+		  $pageSelected = [
30
+			$page[1],
31
+			$urlParameters
32
+		  ];
33
+		  break;
34
+		}
35
+	  }
36
+	  if( $pageSelected !== null )
37
+		return $pageSelected;
38
+	  else
39
+		return $this->defaultPage;
40
+	}
41
+	protected function pathSeeker( $_path, $_url ) {
42
+	  $urlLength = count($_url);
43
+	  $cont = 0;
44
+	  $variables = [];
45
+	  $pathLength = count($_path);
46
+	  if($urlLength == $pathLength) {
47
+		while($cont < $urlLength) {
48
+		  if(
49
+			($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
+			$variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
54
+			$cont++;
55
+		  } else break;
56
+		}
57
+		if($cont == $urlLength)
58
+		  return $variables;
59
+	  }
60
+	  return null;
61
+	}
62 62
   }
63 63
 ?>
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
     protected $pages;
6 6
     protected $defaultPage;
7 7
     protected $urlCaseSensitive;
8
-    public function __construct( $_path, $_urlCaseSensitive = false ) {
9
-      if(!is_string($_path))
8
+    public function __construct($_path, $_urlCaseSensitive = false) {
9
+      if (!is_string($_path))
10 10
         throw new JException("Parameter must be a string.");
11 11
       $jConfig   = new JConfig($_path);
12 12
       $server    = new ServerVars();
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
       $pageSelected = null;
24 24
       foreach ($this->pages as $page) {
25 25
         $urlParameters = $this->pathSeeker(explode("/", $page[0]), $this->url);
26
-        if(is_array($urlParameters)) {
27
-          if(isset($page[2]) && is_array($page[2]))
26
+        if (is_array($urlParameters)) {
27
+          if (isset($page[2]) && is_array($page[2]))
28 28
             $urlParameters = array_merge($urlParameters, $page[2]);
29 29
           $pageSelected = [
30 30
             $page[1],
@@ -33,28 +33,28 @@  discard block
 block discarded – undo
33 33
           break;
34 34
         }
35 35
       }
36
-      if( $pageSelected !== null )
36
+      if ($pageSelected !== null)
37 37
         return $pageSelected;
38 38
       else
39 39
         return $this->defaultPage;
40 40
     }
41
-    protected function pathSeeker( $_path, $_url ) {
41
+    protected function pathSeeker($_path, $_url) {
42 42
       $urlLength = count($_url);
43 43
       $cont = 0;
44 44
       $variables = [];
45 45
       $pathLength = count($_path);
46
-      if($urlLength == $pathLength) {
47
-        while($cont < $urlLength) {
48
-          if(
46
+      if ($urlLength == $pathLength) {
47
+        while ($cont < $urlLength) {
48
+          if (
49 49
             ($this->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
50 50
             (!$this->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
51 51
             $cont++;
52
-          else if( strpos($_path[$cont], "\$") !== false ) {
52
+          else if (strpos($_path[$cont], "\$") !== false) {
53 53
             $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
54 54
             $cont++;
55 55
           } else break;
56 56
         }
57
-        if($cont == $urlLength)
57
+        if ($cont == $urlLength)
58 58
           return $variables;
59 59
       }
60 60
       return null;
Please login to merge, or discard this 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/JConfig/JConfig.php 3 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
   class JConfig {
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.");
8
-      $data = file_get_contents($_path);
9
-      $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)
14
-          $this->$key = $value;
15
-      if(is_array($data))
16
-        $this->data = $data;
17
-    }
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.");
8
+	  $data = file_get_contents($_path);
9
+	  $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)
14
+		  $this->$key = $value;
15
+	  if(is_array($data))
16
+		$this->data = $data;
17
+	}
18 18
   }
19 19
 ?>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,18 +1,18 @@
 block discarded – undo
1 1
 <?php
2 2
   class JConfig {
3
-    public function __construct( $_path ) {
4
-      if(!is_string($_path))
3
+    public function __construct($_path) {
4
+      if (!is_string($_path))
5 5
         throw new JException("Path must be a string.");
6
-      if(!file_exists($_path))
6
+      if (!file_exists($_path))
7 7
         throw new JException("File [$_path] not found.");
8 8
       $data = file_get_contents($_path);
9 9
       $data = json_decode($data);
10
-      if($data === NULL)
10
+      if ($data === NULL)
11 11
         throw new JException("Invalid file data. [$_path]");
12
-      if(is_object($data))
12
+      if (is_object($data))
13 13
         foreach (get_object_vars($data) as $key => $value)
14 14
           $this->$key = $value;
15
-      if(is_array($data))
15
+      if (is_array($data))
16 16
         $this->data = $data;
17 17
     }
18 18
   }
Please login to merge, or discard this 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.
dist/jate/modules/Angular/Angular.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
   requireComponent("../Html/Html.php");
3 3
   class Angular extends Html {
4
-    public function init() {
5
-      header("Access-Control-Allow-Origin: *");
6
-      header("Content-Type: application/json; charset=UTF-8");
7
-    }
8
-    public function draw() {}
4
+	public function init() {
5
+	  header("Access-Control-Allow-Origin: *");
6
+	  header("Content-Type: application/json; charset=UTF-8");
7
+	}
8
+	public function draw() {}
9 9
   }
10 10
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Connection.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -3,6 +3,10 @@
 block discarded – undo
3 3
   class Connection {
4 4
     public $database;
5 5
     public $info;
6
+
7
+    /**
8
+     * @param JConfig $_object
9
+     */
6 10
     public function __construct( $_object ) {
7 11
       if(!is_object($_object))
8 12
         throw new JException("Parameter must be an object.");
Please login to merge, or discard this patch.
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,52 +1,52 @@
 block discarded – undo
1 1
 <?php
2 2
   requireComponents("Adapters");
3 3
   class Connection {
4
-    public $database;
5
-    public $info;
6
-    public function __construct( $_object ) {
7
-      if(!is_object($_object))
8
-        throw new JException("Parameter must be an object.");
9
-      $this->setConnection(
10
-        $_object->server,
11
-        $_object->database,
12
-        $_object->user,
13
-        $_object->password,
14
-        $this->getConnectionType($_object->engine)
15
-      );
16
-    }
17
-    protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) {
18
-      switch ($_type) {
19
-        case "mysqli":
20
-          $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass);
21
-        break;
22
-        case "postgresql":
23
-          $this->database = new PostgresqlAdapter($_srv, $_db, $_usr, $_pass);
24
-        break;
25
-        case "pdo-sqlite-memory":
26
-          $this->database = new PdoAdapterSqLiteMemory($_srv, $_db, $_usr, $_pass);
27
-        break;
28
-        case "pdo-sqlite-file":
29
-          $this->database = new PdoAdapterSqLiteFile($_srv, $_db, $_usr, $_pass);
30
-        break;
31
-        case "pdo-mysql":
32
-        default:
33
-          $this->database = new PdoAdapterMysql($_srv, $_db, $_usr, $_pass);
34
-        break;
35
-      }
36
-      $this->info = [
37
-        "srv"  => $_srv,
38
-        "db"   => $_db,
39
-        "usr"  => $_usr,
40
-        "pass" => $_pass,
41
-        "type" => $_type
42
-      ];
43
-    }
44
-    protected function getConnectionType( $_type ) {
45
-      $array = (array)$_type;
46
-      foreach ($array as $key => $value)
47
-        if($value)
48
-          return $key;
49
-      return "default";
50
-    }
4
+	public $database;
5
+	public $info;
6
+	public function __construct( $_object ) {
7
+	  if(!is_object($_object))
8
+		throw new JException("Parameter must be an object.");
9
+	  $this->setConnection(
10
+		$_object->server,
11
+		$_object->database,
12
+		$_object->user,
13
+		$_object->password,
14
+		$this->getConnectionType($_object->engine)
15
+	  );
16
+	}
17
+	protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) {
18
+	  switch ($_type) {
19
+		case "mysqli":
20
+		  $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass);
21
+		break;
22
+		case "postgresql":
23
+		  $this->database = new PostgresqlAdapter($_srv, $_db, $_usr, $_pass);
24
+		break;
25
+		case "pdo-sqlite-memory":
26
+		  $this->database = new PdoAdapterSqLiteMemory($_srv, $_db, $_usr, $_pass);
27
+		break;
28
+		case "pdo-sqlite-file":
29
+		  $this->database = new PdoAdapterSqLiteFile($_srv, $_db, $_usr, $_pass);
30
+		break;
31
+		case "pdo-mysql":
32
+		default:
33
+		  $this->database = new PdoAdapterMysql($_srv, $_db, $_usr, $_pass);
34
+		break;
35
+	  }
36
+	  $this->info = [
37
+		"srv"  => $_srv,
38
+		"db"   => $_db,
39
+		"usr"  => $_usr,
40
+		"pass" => $_pass,
41
+		"type" => $_type
42
+	  ];
43
+	}
44
+	protected function getConnectionType( $_type ) {
45
+	  $array = (array)$_type;
46
+	  foreach ($array as $key => $value)
47
+		if($value)
48
+		  return $key;
49
+	  return "default";
50
+	}
51 51
   }
52 52
 ?>
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
   class Connection {
4 4
     public $database;
5 5
     public $info;
6
-    public function __construct( $_object ) {
7
-      if(!is_object($_object))
6
+    public function __construct($_object) {
7
+      if (!is_object($_object))
8 8
         throw new JException("Parameter must be an object.");
9 9
       $this->setConnection(
10 10
         $_object->server,
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
         $this->getConnectionType($_object->engine)
15 15
       );
16 16
     }
17
-    protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) {
17
+    protected function setConnection($_srv, $_db, $_usr, $_pass, $_type) {
18 18
       switch ($_type) {
19 19
         case "mysqli":
20 20
           $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
         "type" => $_type
42 42
       ];
43 43
     }
44
-    protected function getConnectionType( $_type ) {
45
-      $array = (array)$_type;
44
+    protected function getConnectionType($_type) {
45
+      $array = (array) $_type;
46 46
       foreach ($array as $key => $value)
47
-        if($value)
47
+        if ($value)
48 48
           return $key;
49 49
       return "default";
50 50
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,8 +4,9 @@  discard block
 block discarded – undo
4 4
     public $database;
5 5
     public $info;
6 6
     public function __construct( $_object ) {
7
-      if(!is_object($_object))
8
-        throw new JException("Parameter must be an object.");
7
+      if(!is_object($_object)) {
8
+              throw new JException("Parameter must be an object.");
9
+      }
9 10
       $this->setConnection(
10 11
         $_object->server,
11 12
         $_object->database,
@@ -43,9 +44,10 @@  discard block
 block discarded – undo
43 44
     }
44 45
     protected function getConnectionType( $_type ) {
45 46
       $array = (array)$_type;
46
-      foreach ($array as $key => $value)
47
-        if($value)
47
+      foreach ($array as $key => $value) {
48
+              if($value)
48 49
           return $key;
50
+      }
49 51
       return "default";
50 52
     }
51 53
   }
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PdoAdapterSqLiteMemory.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("PdoAdapterMysql.php");
3 3
   class PdoAdapterSqLiteMemory extends PdoAdapterMysql {
4
-      public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
-        try {
7
-          $this->connection = new PDO("sqlite::memory:");
8
-        } catch( Exception $e ) {
9
-          throw new JException($e->getMessage());
10
-        }
11
-      }
12
-      public function newTable( $_sql ) {
13
-        try {
14
-          $temp = $this->connection->exec($_sql);
15
-        } catch (Exception $e) {
16
-          throw new JException($e->getMessage());
17
-        }
18
-        return $temp;
19
-      }
4
+	  public $connection;
5
+	  public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
+		try {
7
+		  $this->connection = new PDO("sqlite::memory:");
8
+		} catch( Exception $e ) {
9
+		  throw new JException($e->getMessage());
10
+		}
11
+	  }
12
+	  public function newTable( $_sql ) {
13
+		try {
14
+		  $temp = $this->connection->exec($_sql);
15
+		} catch (Exception $e) {
16
+		  throw new JException($e->getMessage());
17
+		}
18
+		return $temp;
19
+	  }
20 20
   }
21 21
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
   jRequire("PdoAdapterMysql.php");
3 3
   class PdoAdapterSqLiteMemory extends PdoAdapterMysql {
4 4
       public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
5
+      public function __construct($_srv, $_db, $_usr, $_pass) {
6 6
         try {
7 7
           $this->connection = new PDO("sqlite::memory:");
8
-        } catch( Exception $e ) {
8
+        } catch (Exception $e) {
9 9
           throw new JException($e->getMessage());
10 10
         }
11 11
       }
12
-      public function newTable( $_sql ) {
12
+      public function newTable($_sql) {
13 13
         try {
14 14
           $temp = $this->connection->exec($_sql);
15 15
         } catch (Exception $e) {
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PdoAdapterMysql.php 3 patches
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -1,44 +1,44 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("ConnectionInterface.php");
3 3
   class PdoAdapterMysql implements ConnectionAdapterInterface {
4
-      public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
-        try {
7
-          $connection = "mysql:host=$_srv;dbname=$_db";
8
-          $this->connection = new PDO( $connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"] );
9
-        } catch( Exception $e ) {
10
-          throw new JException($e->getMessage());
11
-        }
12
-      }
13
-      public function query( $_query ) {
14
-        $this->stdQuery($_query);
15
-        return true;
16
-      }
17
-      public function queryInsert( $_query ) {
18
-        $this->stdQuery($_query);
19
-        return $this->connection->lastInsertId();
20
-      }
21
-      public function queryFetch( $_query ) {
22
-        $temp = $this->stdQuery($_query);
23
-        return $temp->fetchAll(PDO::FETCH_ASSOC);
24
-      }
25
-      public function queryArray( $_query ) {
26
-        $temp = $this->stdQuery($_query);
27
-        return $temp->fetchAll(PDO::FETCH_COLUMN, 0);
28
-      }
29
-      protected function stdQuery( $_query ) {
30
-        $database = $this->connection;
31
-        $query = $database->prepare($_query);
32
-        $result = $query->execute();
33
-        if(!$result)
34
-          throw new JException(json_encode([
35
-            "query" => $_query,
36
-            "error" => [
37
-              $query->errorInfo(),
38
-              $database->errorInfo()
39
-            ]
40
-          ]));
41
-        return $query;
42
-      }
4
+	  public $connection;
5
+	  public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
+		try {
7
+		  $connection = "mysql:host=$_srv;dbname=$_db";
8
+		  $this->connection = new PDO( $connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"] );
9
+		} catch( Exception $e ) {
10
+		  throw new JException($e->getMessage());
11
+		}
12
+	  }
13
+	  public function query( $_query ) {
14
+		$this->stdQuery($_query);
15
+		return true;
16
+	  }
17
+	  public function queryInsert( $_query ) {
18
+		$this->stdQuery($_query);
19
+		return $this->connection->lastInsertId();
20
+	  }
21
+	  public function queryFetch( $_query ) {
22
+		$temp = $this->stdQuery($_query);
23
+		return $temp->fetchAll(PDO::FETCH_ASSOC);
24
+	  }
25
+	  public function queryArray( $_query ) {
26
+		$temp = $this->stdQuery($_query);
27
+		return $temp->fetchAll(PDO::FETCH_COLUMN, 0);
28
+	  }
29
+	  protected function stdQuery( $_query ) {
30
+		$database = $this->connection;
31
+		$query = $database->prepare($_query);
32
+		$result = $query->execute();
33
+		if(!$result)
34
+		  throw new JException(json_encode([
35
+			"query" => $_query,
36
+			"error" => [
37
+			  $query->errorInfo(),
38
+			  $database->errorInfo()
39
+			]
40
+		  ]));
41
+		return $query;
42
+	  }
43 43
   }
44 44
 ?>
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,35 +2,35 @@
 block discarded – undo
2 2
   jRequire("ConnectionInterface.php");
3 3
   class PdoAdapterMysql implements ConnectionAdapterInterface {
4 4
       public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
5
+      public function __construct($_srv, $_db, $_usr, $_pass) {
6 6
         try {
7 7
           $connection = "mysql:host=$_srv;dbname=$_db";
8
-          $this->connection = new PDO( $connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"] );
9
-        } catch( Exception $e ) {
8
+          $this->connection = new PDO($connection, $_usr, $_pass, [PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'utf8'"]);
9
+        } catch (Exception $e) {
10 10
           throw new JException($e->getMessage());
11 11
         }
12 12
       }
13
-      public function query( $_query ) {
13
+      public function query($_query) {
14 14
         $this->stdQuery($_query);
15 15
         return true;
16 16
       }
17
-      public function queryInsert( $_query ) {
17
+      public function queryInsert($_query) {
18 18
         $this->stdQuery($_query);
19 19
         return $this->connection->lastInsertId();
20 20
       }
21
-      public function queryFetch( $_query ) {
21
+      public function queryFetch($_query) {
22 22
         $temp = $this->stdQuery($_query);
23 23
         return $temp->fetchAll(PDO::FETCH_ASSOC);
24 24
       }
25
-      public function queryArray( $_query ) {
25
+      public function queryArray($_query) {
26 26
         $temp = $this->stdQuery($_query);
27 27
         return $temp->fetchAll(PDO::FETCH_COLUMN, 0);
28 28
       }
29
-      protected function stdQuery( $_query ) {
29
+      protected function stdQuery($_query) {
30 30
         $database = $this->connection;
31 31
         $query = $database->prepare($_query);
32 32
         $result = $query->execute();
33
-        if(!$result)
33
+        if (!$result)
34 34
           throw new JException(json_encode([
35 35
             "query" => $_query,
36 36
             "error" => [
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -30,14 +30,15 @@
 block discarded – undo
30 30
         $database = $this->connection;
31 31
         $query = $database->prepare($_query);
32 32
         $result = $query->execute();
33
-        if(!$result)
34
-          throw new JException(json_encode([
33
+        if(!$result) {
34
+                  throw new JException(json_encode([
35 35
             "query" => $_query,
36 36
             "error" => [
37 37
               $query->errorInfo(),
38 38
               $database->errorInfo()
39 39
             ]
40 40
           ]));
41
+        }
41 42
         return $query;
42 43
       }
43 44
   }
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PdoAdapterSqLiteFile.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -1,21 +1,21 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("PdoAdapterMysql.php");
3 3
   class PdoAdapterSqLiteFile extends PdoAdapterMysql {
4
-      public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
-        try {
7
-          $this->connection = new PDO("sqlite:$_srv");
8
-        } catch( Exception $e ) {
9
-          throw new JException($e->getMessage());
10
-        }
11
-      }
12
-      public function newTable( $_sql ) {
13
-        try {
14
-          $temp = $this->connection->exec($_sql);
15
-        } catch (Exception $e) {
16
-          throw new JException($e->getMessage());
17
-        }
18
-        return $temp;
19
-      }
4
+	  public $connection;
5
+	  public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
+		try {
7
+		  $this->connection = new PDO("sqlite:$_srv");
8
+		} catch( Exception $e ) {
9
+		  throw new JException($e->getMessage());
10
+		}
11
+	  }
12
+	  public function newTable( $_sql ) {
13
+		try {
14
+		  $temp = $this->connection->exec($_sql);
15
+		} catch (Exception $e) {
16
+		  throw new JException($e->getMessage());
17
+		}
18
+		return $temp;
19
+	  }
20 20
   }
21 21
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
   jRequire("PdoAdapterMysql.php");
3 3
   class PdoAdapterSqLiteFile extends PdoAdapterMysql {
4 4
       public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
5
+      public function __construct($_srv, $_db, $_usr, $_pass) {
6 6
         try {
7 7
           $this->connection = new PDO("sqlite:$_srv");
8
-        } catch( Exception $e ) {
8
+        } catch (Exception $e) {
9 9
           throw new JException($e->getMessage());
10 10
         }
11 11
       }
12
-      public function newTable( $_sql ) {
12
+      public function newTable($_sql) {
13 13
         try {
14 14
           $temp = $this->connection->exec($_sql);
15 15
         } catch (Exception $e) {
Please login to merge, or discard this patch.
dist/jate/modules/Query/Query.php 3 patches
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -3,101 +3,101 @@
 block discarded – undo
3 3
   jRequire("../JConfig/JConfig.php");
4 4
   jRequire("../Connection/Connection.php");
5 5
   trait Query {
6
-    public $connection;
7
-    public $currentConnection;
8
-    public function __construct() {
9
-      $this->connection = [];
10
-      $this->currentConnection = null;
11
-    }
12
-    public function addConnection( $_path, $_name = "default" ) {
13
-      if(!is_string($_path))
14
-        throw new JException("Parameter must be a string.", 1);
15
-      try {
16
-        $jConfig = new JConfig($_path);
17
-        if($jConfig->enable) {
18
-          $connection = new Connection($jConfig);
19
-          $this->addConnectionMan($connection, $_name);
20
-        }
21
-      } catch (Exception $e) {
22
-        throw new JException($e->getMessage(), 1);
23
-      }
24
-    }
25
-    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);
28
-      try {
29
-        $this->connection["$_name"] = $_connection;
30
-        $this->currentConnection = $_connection;
31
-      } catch (Exception $e) {
32
-        throw new JException($e->getMessage(), 1);
33
-      }
34
-    }
35
-    public function setConnection( $_name = "default" ) {
36
-      if(!is_string($_name))
37
-        throw new JException("Parameter must be a string.", 1);
38
-      if(!isset($this->connection["$_name"]))
39
-        throw new JException("This connection name does not exist.", 1);
40
-      $this->currentConnection = $this->connection["$_name"];
41
-    }
42
-    public function query( $_query ) {
43
-      if(!is_string($_query))
44
-        throw new JException("Parameter must be a string.", 1);
45
-      if($this->currentConnection == null)
46
-        throw new JException("No connection selected.", 1);
47
-      try {
48
-        $temp = $this->currentConnection->database->query($_query);
49
-      } catch (Exception $e) {
50
-        throw new JException($e->getMessage(), 1);
51
-      }
52
-      return $temp;
53
-    }
54
-    public function queryInsert( $_query ) {
55
-      if(!is_string($_query))
56
-        throw new JException("Parameter must be a string.", 1);
57
-      if($this->currentConnection == null)
58
-        throw new JException("No connection selected.", 1);
59
-      try {
60
-        $temp = $this->currentConnection->database->queryInsert($_query);
61
-      } catch (Exception $e) {
62
-        throw new JException($e->getMessage(), 1);
63
-      }
64
-      return $temp;
65
-    }
66
-    public function queryFetch( $_query ) {
67
-      if(!is_string($_query))
68
-        throw new JException("Parameter must be a string.", 1);
69
-      if($this->currentConnection == null)
70
-        throw new JException("No connection selected.", 1);
71
-      try {
72
-        $temp = $this->currentConnection->database->queryFetch($_query);
73
-      } catch (Exception $e) {
74
-        throw new JException($e->getMessage(), 1);
75
-      }
76
-      return $temp;
77
-    }
78
-    public function queryArray( $_query ) {
79
-      if(!is_string($_query))
80
-        throw new JException("Parameter must be a string.", 1);
81
-      if($this->currentConnection == null)
82
-        throw new JException("No connection selected.", 1);
83
-      try {
84
-        $temp = $this->currentConnection->database->queryArray($_query);
85
-      } catch (Exception $e) {
86
-        throw new JException($e->getMessage(), 1);
87
-      }
88
-      return $temp;
89
-    }
90
-    public function newTable( $_query ) {
91
-      if(!is_string($_query))
92
-        throw new JException("Parameter must be a string.", 1);
93
-      if($this->currentConnection == null)
94
-        throw new JException("No connection selected.", 1);
95
-      try {
96
-        $temp = $this->currentConnection->database->newTable($_query);
97
-      } catch (Exception $e) {
98
-        throw new JException($e->getMessage(), 1);
99
-      }
100
-      return $temp;
101
-    }
6
+	public $connection;
7
+	public $currentConnection;
8
+	public function __construct() {
9
+	  $this->connection = [];
10
+	  $this->currentConnection = null;
11
+	}
12
+	public function addConnection( $_path, $_name = "default" ) {
13
+	  if(!is_string($_path))
14
+		throw new JException("Parameter must be a string.", 1);
15
+	  try {
16
+		$jConfig = new JConfig($_path);
17
+		if($jConfig->enable) {
18
+		  $connection = new Connection($jConfig);
19
+		  $this->addConnectionMan($connection, $_name);
20
+		}
21
+	  } catch (Exception $e) {
22
+		throw new JException($e->getMessage(), 1);
23
+	  }
24
+	}
25
+	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);
28
+	  try {
29
+		$this->connection["$_name"] = $_connection;
30
+		$this->currentConnection = $_connection;
31
+	  } catch (Exception $e) {
32
+		throw new JException($e->getMessage(), 1);
33
+	  }
34
+	}
35
+	public function setConnection( $_name = "default" ) {
36
+	  if(!is_string($_name))
37
+		throw new JException("Parameter must be a string.", 1);
38
+	  if(!isset($this->connection["$_name"]))
39
+		throw new JException("This connection name does not exist.", 1);
40
+	  $this->currentConnection = $this->connection["$_name"];
41
+	}
42
+	public function query( $_query ) {
43
+	  if(!is_string($_query))
44
+		throw new JException("Parameter must be a string.", 1);
45
+	  if($this->currentConnection == null)
46
+		throw new JException("No connection selected.", 1);
47
+	  try {
48
+		$temp = $this->currentConnection->database->query($_query);
49
+	  } catch (Exception $e) {
50
+		throw new JException($e->getMessage(), 1);
51
+	  }
52
+	  return $temp;
53
+	}
54
+	public function queryInsert( $_query ) {
55
+	  if(!is_string($_query))
56
+		throw new JException("Parameter must be a string.", 1);
57
+	  if($this->currentConnection == null)
58
+		throw new JException("No connection selected.", 1);
59
+	  try {
60
+		$temp = $this->currentConnection->database->queryInsert($_query);
61
+	  } catch (Exception $e) {
62
+		throw new JException($e->getMessage(), 1);
63
+	  }
64
+	  return $temp;
65
+	}
66
+	public function queryFetch( $_query ) {
67
+	  if(!is_string($_query))
68
+		throw new JException("Parameter must be a string.", 1);
69
+	  if($this->currentConnection == null)
70
+		throw new JException("No connection selected.", 1);
71
+	  try {
72
+		$temp = $this->currentConnection->database->queryFetch($_query);
73
+	  } catch (Exception $e) {
74
+		throw new JException($e->getMessage(), 1);
75
+	  }
76
+	  return $temp;
77
+	}
78
+	public function queryArray( $_query ) {
79
+	  if(!is_string($_query))
80
+		throw new JException("Parameter must be a string.", 1);
81
+	  if($this->currentConnection == null)
82
+		throw new JException("No connection selected.", 1);
83
+	  try {
84
+		$temp = $this->currentConnection->database->queryArray($_query);
85
+	  } catch (Exception $e) {
86
+		throw new JException($e->getMessage(), 1);
87
+	  }
88
+	  return $temp;
89
+	}
90
+	public function newTable( $_query ) {
91
+	  if(!is_string($_query))
92
+		throw new JException("Parameter must be a string.", 1);
93
+	  if($this->currentConnection == null)
94
+		throw new JException("No connection selected.", 1);
95
+	  try {
96
+		$temp = $this->currentConnection->database->newTable($_query);
97
+	  } catch (Exception $e) {
98
+		throw new JException($e->getMessage(), 1);
99
+	  }
100
+	  return $temp;
101
+	}
102 102
   }
103 103
 ?>
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,12 +9,12 @@  discard block
 block discarded – undo
9 9
       $this->connection = [];
10 10
       $this->currentConnection = null;
11 11
     }
12
-    public function addConnection( $_path, $_name = "default" ) {
13
-      if(!is_string($_path))
12
+    public function addConnection($_path, $_name = "default") {
13
+      if (!is_string($_path))
14 14
         throw new JException("Parameter must be a string.", 1);
15 15
       try {
16 16
         $jConfig = new JConfig($_path);
17
-        if($jConfig->enable) {
17
+        if ($jConfig->enable) {
18 18
           $connection = new Connection($jConfig);
19 19
           $this->addConnectionMan($connection, $_name);
20 20
         }
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
         throw new JException($e->getMessage(), 1);
23 23
       }
24 24
     }
25
-    public function addConnectionMan( $_connection, $_name = "default") {
26
-      if(!is_object($_connection) || !is_a($_connection, "Connection"))
25
+    public function addConnectionMan($_connection, $_name = "default") {
26
+      if (!is_object($_connection) || !is_a($_connection, "Connection"))
27 27
         throw new JException("Parameter must be a Connection object.", 1);
28 28
       try {
29 29
         $this->connection["$_name"] = $_connection;
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
         throw new JException($e->getMessage(), 1);
33 33
       }
34 34
     }
35
-    public function setConnection( $_name = "default" ) {
36
-      if(!is_string($_name))
35
+    public function setConnection($_name = "default") {
36
+      if (!is_string($_name))
37 37
         throw new JException("Parameter must be a string.", 1);
38
-      if(!isset($this->connection["$_name"]))
38
+      if (!isset($this->connection["$_name"]))
39 39
         throw new JException("This connection name does not exist.", 1);
40 40
       $this->currentConnection = $this->connection["$_name"];
41 41
     }
42
-    public function query( $_query ) {
43
-      if(!is_string($_query))
42
+    public function query($_query) {
43
+      if (!is_string($_query))
44 44
         throw new JException("Parameter must be a string.", 1);
45
-      if($this->currentConnection == null)
45
+      if ($this->currentConnection == null)
46 46
         throw new JException("No connection selected.", 1);
47 47
       try {
48 48
         $temp = $this->currentConnection->database->query($_query);
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
       }
52 52
       return $temp;
53 53
     }
54
-    public function queryInsert( $_query ) {
55
-      if(!is_string($_query))
54
+    public function queryInsert($_query) {
55
+      if (!is_string($_query))
56 56
         throw new JException("Parameter must be a string.", 1);
57
-      if($this->currentConnection == null)
57
+      if ($this->currentConnection == null)
58 58
         throw new JException("No connection selected.", 1);
59 59
       try {
60 60
         $temp = $this->currentConnection->database->queryInsert($_query);
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
       }
64 64
       return $temp;
65 65
     }
66
-    public function queryFetch( $_query ) {
67
-      if(!is_string($_query))
66
+    public function queryFetch($_query) {
67
+      if (!is_string($_query))
68 68
         throw new JException("Parameter must be a string.", 1);
69
-      if($this->currentConnection == null)
69
+      if ($this->currentConnection == null)
70 70
         throw new JException("No connection selected.", 1);
71 71
       try {
72 72
         $temp = $this->currentConnection->database->queryFetch($_query);
@@ -75,10 +75,10 @@  discard block
 block discarded – undo
75 75
       }
76 76
       return $temp;
77 77
     }
78
-    public function queryArray( $_query ) {
79
-      if(!is_string($_query))
78
+    public function queryArray($_query) {
79
+      if (!is_string($_query))
80 80
         throw new JException("Parameter must be a string.", 1);
81
-      if($this->currentConnection == null)
81
+      if ($this->currentConnection == null)
82 82
         throw new JException("No connection selected.", 1);
83 83
       try {
84 84
         $temp = $this->currentConnection->database->queryArray($_query);
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
       }
88 88
       return $temp;
89 89
     }
90
-    public function newTable( $_query ) {
91
-      if(!is_string($_query))
90
+    public function newTable($_query) {
91
+      if (!is_string($_query))
92 92
         throw new JException("Parameter must be a string.", 1);
93
-      if($this->currentConnection == null)
93
+      if ($this->currentConnection == null)
94 94
         throw new JException("No connection selected.", 1);
95 95
       try {
96 96
         $temp = $this->currentConnection->database->newTable($_query);
Please login to merge, or discard this patch.
Braces   +42 added lines, -28 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,8 +24,9 @@  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;
@@ -33,17 +35,21 @@  discard block
 block discarded – undo
33 35
       }
34 36
     }
35 37
     public function setConnection( $_name = "default" ) {
36
-      if(!is_string($_name))
37
-        throw new JException("Parameter must be a string.", 1);
38
-      if(!isset($this->connection["$_name"]))
39
-        throw new JException("This connection name does not exist.", 1);
38
+      if(!is_string($_name)) {
39
+              throw new JException("Parameter must be a string.", 1);
40
+      }
41
+      if(!isset($this->connection["$_name"])) {
42
+              throw new JException("This connection name does not exist.", 1);
43
+      }
40 44
       $this->currentConnection = $this->connection["$_name"];
41 45
     }
42 46
     public function query( $_query ) {
43
-      if(!is_string($_query))
44
-        throw new JException("Parameter must be a string.", 1);
45
-      if($this->currentConnection == null)
46
-        throw new JException("No connection selected.", 1);
47
+      if(!is_string($_query)) {
48
+              throw new JException("Parameter must be a string.", 1);
49
+      }
50
+      if($this->currentConnection == null) {
51
+              throw new JException("No connection selected.", 1);
52
+      }
47 53
       try {
48 54
         $temp = $this->currentConnection->database->query($_query);
49 55
       } catch (Exception $e) {
@@ -52,10 +58,12 @@  discard block
 block discarded – undo
52 58
       return $temp;
53 59
     }
54 60
     public function queryInsert( $_query ) {
55
-      if(!is_string($_query))
56
-        throw new JException("Parameter must be a string.", 1);
57
-      if($this->currentConnection == null)
58
-        throw new JException("No connection selected.", 1);
61
+      if(!is_string($_query)) {
62
+              throw new JException("Parameter must be a string.", 1);
63
+      }
64
+      if($this->currentConnection == null) {
65
+              throw new JException("No connection selected.", 1);
66
+      }
59 67
       try {
60 68
         $temp = $this->currentConnection->database->queryInsert($_query);
61 69
       } catch (Exception $e) {
@@ -64,10 +72,12 @@  discard block
 block discarded – undo
64 72
       return $temp;
65 73
     }
66 74
     public function queryFetch( $_query ) {
67
-      if(!is_string($_query))
68
-        throw new JException("Parameter must be a string.", 1);
69
-      if($this->currentConnection == null)
70
-        throw new JException("No connection selected.", 1);
75
+      if(!is_string($_query)) {
76
+              throw new JException("Parameter must be a string.", 1);
77
+      }
78
+      if($this->currentConnection == null) {
79
+              throw new JException("No connection selected.", 1);
80
+      }
71 81
       try {
72 82
         $temp = $this->currentConnection->database->queryFetch($_query);
73 83
       } catch (Exception $e) {
@@ -76,10 +86,12 @@  discard block
 block discarded – undo
76 86
       return $temp;
77 87
     }
78 88
     public function queryArray( $_query ) {
79
-      if(!is_string($_query))
80
-        throw new JException("Parameter must be a string.", 1);
81
-      if($this->currentConnection == null)
82
-        throw new JException("No connection selected.", 1);
89
+      if(!is_string($_query)) {
90
+              throw new JException("Parameter must be a string.", 1);
91
+      }
92
+      if($this->currentConnection == null) {
93
+              throw new JException("No connection selected.", 1);
94
+      }
83 95
       try {
84 96
         $temp = $this->currentConnection->database->queryArray($_query);
85 97
       } catch (Exception $e) {
@@ -88,10 +100,12 @@  discard block
 block discarded – undo
88 100
       return $temp;
89 101
     }
90 102
     public function newTable( $_query ) {
91
-      if(!is_string($_query))
92
-        throw new JException("Parameter must be a string.", 1);
93
-      if($this->currentConnection == null)
94
-        throw new JException("No connection selected.", 1);
103
+      if(!is_string($_query)) {
104
+              throw new JException("Parameter must be a string.", 1);
105
+      }
106
+      if($this->currentConnection == null) {
107
+              throw new JException("No connection selected.", 1);
108
+      }
95 109
       try {
96 110
         $temp = $this->currentConnection->database->newTable($_query);
97 111
       } catch (Exception $e) {
Please login to merge, or discard this patch.