Test Failed
Push — master ( ae6d9a...f6b071 )
by Federico
02:22
created
dist/jate/modules/Connection/Connection.php 1 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.
dist/jate/modules/Module/Module.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -2,44 +2,44 @@
 block discarded – undo
2 2
   jRequire("../Query/Query.php");
3 3
   jRequire("../File/File.php");
4 4
   class Module {
5
-    use Query {
6
-      Query::__construct as private __queryConstruct;
7
-    }
8
-    use File {
9
-      File::__construct as private __fileConstruct;
10
-    }
11
-    public $name;
12
-    public $modules;
13
-    public function __construct() {
14
-      $this->name    = get_class($this);
15
-      $this->modules = [];
16
-      $this->__queryConstruct();
17
-      $this->__fileConstruct();
18
-    }
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);
24
-    }
25
-    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.");
30
-      $this->modules[$_module->name] = $_module;
31
-      if($this->currentConnection)
32
-        $this->modules[$_module->name]->addConnectionMan($this->currentConnection);
33
-    }
34
-    public function addConnectionMan( $_connection, $_name = "default") {
35
-      try {
36
-        parent::addConnectionMan($_connection, $_name);
37
-        foreach ($this->modules as &$module)
38
-          if(isset($this->currentConnection))
39
-            $module->addConnectionMan($this->currentConnection, $_name);
40
-      } catch (Exception $e) {
41
-        throw new JException($e->getMessage(), 1);
42
-      }
43
-    }
5
+	use Query {
6
+	  Query::__construct as private __queryConstruct;
7
+	}
8
+	use File {
9
+	  File::__construct as private __fileConstruct;
10
+	}
11
+	public $name;
12
+	public $modules;
13
+	public function __construct() {
14
+	  $this->name    = get_class($this);
15
+	  $this->modules = [];
16
+	  $this->__queryConstruct();
17
+	  $this->__fileConstruct();
18
+	}
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);
24
+	}
25
+	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.");
30
+	  $this->modules[$_module->name] = $_module;
31
+	  if($this->currentConnection)
32
+		$this->modules[$_module->name]->addConnectionMan($this->currentConnection);
33
+	}
34
+	public function addConnectionMan( $_connection, $_name = "default") {
35
+	  try {
36
+		parent::addConnectionMan($_connection, $_name);
37
+		foreach ($this->modules as &$module)
38
+		  if(isset($this->currentConnection))
39
+			$module->addConnectionMan($this->currentConnection, $_name);
40
+	  } catch (Exception $e) {
41
+		throw new JException($e->getMessage(), 1);
42
+	  }
43
+	}
44 44
   }
45 45
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Query/Query.php 1 patch
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.