Test Failed
Branch master (8beb08)
by Federico
09:24 queued 04:24
created
dist/jate/functions/block.php 1 patch
Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -2,46 +2,46 @@
 block discarded – undo
2 2
   jRequire("../modules/Parser/Parser.php");
3 3
   jRequire("../modules/JException/JException.php");
4 4
   function jBlock() {
5
-    return ob_start();
5
+	return ob_start();
6 6
   }
7 7
 
8 8
   function jBlockClose( $_type = "html", $_parameters = [] ) {
9
-    return jBlockEnd($_type, $_parameters);
9
+	return jBlockEnd($_type, $_parameters);
10 10
   }
11 11
 
12 12
   function jBlockFile( $_path, $_parameters = [] ) {
13
-    try {
14
-      $temp = Parser::parseFile($_path, $_parameters);
15
-    } catch (Exception $e) {
16
-      throw new JException($e->getMessage());
17
-    }
18
-    return $temp;
13
+	try {
14
+	  $temp = Parser::parseFile($_path, $_parameters);
15
+	} catch (Exception $e) {
16
+	  throw new JException($e->getMessage());
17
+	}
18
+	return $temp;
19 19
   }
20 20
 
21 21
   function jBlockFileMan( $_path, $_type, $_parameters = [] ) {
22
-    try {
23
-      $temp = Parser::parseFileMan($_path, $_parameters, $_type);
24
-    } catch (Exception $e) {
25
-      throw new JException($e->getMessage());
26
-    }
27
-    return $temp;
22
+	try {
23
+	  $temp = Parser::parseFileMan($_path, $_parameters, $_type);
24
+	} catch (Exception $e) {
25
+	  throw new JException($e->getMessage());
26
+	}
27
+	return $temp;
28 28
   }
29 29
 
30 30
   function jBlockEnd( $_type = "html", $_parameters = [] ) {
31
-    $text = ob_get_clean();
32
-    try {
33
-      $temp = Parser::parseText($text, $_parameters, $_type);
34
-    } catch (Exception $e) {
35
-      throw new JException($e->getMessage());
36
-    }
37
-    return $temp;
31
+	$text = ob_get_clean();
32
+	try {
33
+	  $temp = Parser::parseText($text, $_parameters, $_type);
34
+	} catch (Exception $e) {
35
+	  throw new JException($e->getMessage());
36
+	}
37
+	return $temp;
38 38
   }
39 39
 
40 40
   function minifyOutput($_buffer) {
41
-    $search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
42
-    $replace = array ( '>', '<', '\\1' );
43
-    if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
44
-      $_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
45
-    return utf8_encode($_buffer);
41
+	$search = array ( '/\>[^\S ]+/s', '/[^\S ]+\</s', '/(\s)+/s' );
42
+	$replace = array ( '>', '<', '\\1' );
43
+	if (preg_match("/\<html/i",$_buffer) == 1 && preg_match("/\<\/html\>/i",$_buffer) == 1)
44
+	  $_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
45
+	return utf8_encode($_buffer);
46 46
   }
47 47
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/array.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,51 +1,51 @@
 block discarded – undo
1 1
 <?php
2 2
   function utf8ize($_array) {
3
-    return travelStringArray($_array,"utf8_encode");
3
+	return travelStringArray($_array,"utf8_encode");
4 4
   }
5 5
   function unutf8ize($_array) {
6
-    return travelStringArray($_array,"utf8_decode");
6
+	return travelStringArray($_array,"utf8_decode");
7 7
   }
8 8
   function arraySlash($_array) {
9
-    return travelStringArray($_array,"addslashes");
9
+	return travelStringArray($_array,"addslashes");
10 10
   }
11 11
   function arrayHtmlParser($_array) {
12
-    return travelStringArray($_array,"htmlParser");
12
+	return travelStringArray($_array,"htmlParser");
13 13
   }
14 14
   function travelStringArray ( $_array, $_function ) {
15
-    if (is_array($_array)) {
16
-      foreach ($_array as $k => $v) {
17
-        $_array[$k] = travelStringArray($v, $_function);
18
-      }
19
-    } else if (is_string ($_array)) {
20
-      return call_user_func($_function,$_array);
21
-    }
22
-    return $_array;
15
+	if (is_array($_array)) {
16
+	  foreach ($_array as $k => $v) {
17
+		$_array[$k] = travelStringArray($v, $_function);
18
+	  }
19
+	} else if (is_string ($_array)) {
20
+	  return call_user_func($_function,$_array);
21
+	}
22
+	return $_array;
23 23
   }
24 24
   function arrayDepth( $_array ) {
25
-    $maxDepth = 1;
26
-    foreach ($_array as $value) {
27
-      if (is_array($value)) {
28
-        $depth = arrayDepth($value) + 1;
29
-        if ($depth > $maxDepth) {
30
-          $maxDepth = $depth;
31
-        }
32
-      }
33
-    }
34
-    return $maxDepth;
25
+	$maxDepth = 1;
26
+	foreach ($_array as $value) {
27
+	  if (is_array($value)) {
28
+		$depth = arrayDepth($value) + 1;
29
+		if ($depth > $maxDepth) {
30
+		  $maxDepth = $depth;
31
+		}
32
+	  }
33
+	}
34
+	return $maxDepth;
35 35
   }
36 36
   function arrayDump( $_array, $_name = "Array", $_tab = "&nbsp;&nbsp;" ) {
37
-    $position = preg_replace('/&nbsp;&nbsp;/', '', $_tab, 1);
38
-    echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>";
39
-    foreach ($_array as $k => $i)
40
-      if(is_array($i))
41
-        arrayDump( $i, $k, "&nbsp;&nbsp;$_tab" );
42
-      else if(is_object($i))
43
-        echo "$_tab<b>object:</b> [Object]<br>";
44
-      else
45
-        echo "$_tab<b>$k:</b> $i<br>";
37
+	$position = preg_replace('/&nbsp;&nbsp;/', '', $_tab, 1);
38
+	echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>";
39
+	foreach ($_array as $k => $i)
40
+	  if(is_array($i))
41
+		arrayDump( $i, $k, "&nbsp;&nbsp;$_tab" );
42
+	  else if(is_object($i))
43
+		echo "$_tab<b>object:</b> [Object]<br>";
44
+	  else
45
+		echo "$_tab<b>$k:</b> $i<br>";
46 46
   }
47 47
 
48 48
   function htmlParser( $_str) {
49
-    return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8");
49
+	return htmlentities($_str, ENT_QUOTES | ENT_IGNORE, "UTF-8");
50 50
   }
51 51
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/errorHandler.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
   function jateErrorHandler($number, $message, $file, $line) {
3
-    if (!(error_reporting() & $number)) {
4
-      return false;
5
-    }
6
-    ob_end_clean();
7
-    $message = JException::decode($message);
8
-    echo "
3
+	if (!(error_reporting() & $number)) {
4
+	  return false;
5
+	}
6
+	ob_end_clean();
7
+	$message = JException::decode($message);
8
+	echo "
9 9
       <div id='error'>
10 10
         <header>
11 11
         JATE ERROR
@@ -51,14 +51,14 @@  discard block
 block discarded – undo
51 51
         }
52 52
       </style>
53 53
     ";
54
-    exit(1);
55
-    return true;
54
+	exit(1);
55
+	return true;
56 56
   }
57 57
   function fatalErrorShutdownHandler() {
58
-    $last_error = error_get_last();
59
-    if ($last_error['type'] === E_ERROR) {
60
-      jateErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
61
-    }
58
+	$last_error = error_get_last();
59
+	if ($last_error['type'] === E_ERROR) {
60
+	  jateErrorHandler(E_ERROR, $last_error['message'], $last_error['file'], $last_error['line']);
61
+	}
62 62
   }
63 63
   set_error_handler('jateErrorHandler');
64 64
   register_shutdown_function('fatalErrorShutdownHandler');
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Connection.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -1,42 +1,42 @@
 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 InvalidArgumentException("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 "memory":
26
-          $this->database = new PdoMemoryAdapter($_srv, $_db, $_usr, $_pass);
27
-        break;
28
-        case "pdo":
29
-        default:
30
-          $this->database = new PdoAdapter($_srv, $_db, $_usr, $_pass);
31
-        break;
32
-      }
33
-    }
34
-    protected function getConnectionType( $_type ) {
35
-      $array = (array)$_type;
36
-      foreach ($array as $key => $value)
37
-        if($value)
38
-          return $key;
39
-      return "pdo";
40
-    }
4
+	public $database;
5
+	public $info;
6
+	public function __construct( $_object ) {
7
+	  if(!is_object($_object))
8
+		throw new InvalidArgumentException("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 "memory":
26
+		  $this->database = new PdoMemoryAdapter($_srv, $_db, $_usr, $_pass);
27
+		break;
28
+		case "pdo":
29
+		default:
30
+		  $this->database = new PdoAdapter($_srv, $_db, $_usr, $_pass);
31
+		break;
32
+	  }
33
+	}
34
+	protected function getConnectionType( $_type ) {
35
+	  $array = (array)$_type;
36
+	  foreach ($array as $key => $value)
37
+		if($value)
38
+		  return $key;
39
+	  return "pdo";
40
+	}
41 41
   }
42 42
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PdoAdapter.php 1 patch
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 PdoAdapter 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.
dist/jate/modules/Connection/Adapters/MysqliAdapter.php 1 patch
Indentation   +40 added lines, -40 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("ConnectionInterface.php");
3 3
   class MysqliAdapter implements ConnectionAdapterInterface {
4
-      public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
-        try {
7
-          $this->connection = new mysqli( $_srv, $_usr, $_pass, $_db );
8
-        } catch( Exception $e ) {
9
-          throw new JException($e->getMessage());
10
-        }
11
-      }
12
-      public function query( $_query ) {
13
-        $this->stdQuery($_query);
14
-        return true;
15
-      }
16
-      public function queryInsert( $_query ) {
17
-        $this->stdQuery($_query);
18
-        return $this->connection->insert_id;
19
-      }
20
-      public function queryFetch( $_query ) {
21
-        $result = $this->stdQuery($_query);
22
-        $rows = [];
23
-        while($row = $result->fetch_assoc())
24
-          $rows[] = $row;
25
-        return $rows;
26
-      }
27
-      public function queryArray( $_query ) {
28
-        $result = $this->stdQuery($_query);
29
-        $rows = [];
30
-        while($row = $result->fetch_array())
31
-          $rows[] = $row;
32
-        return $rows;
33
-      }
34
-      protected function stdQuery( $_query ) {
35
-        $database = $this->connection;
36
-        $result = $database->query($_query);
37
-        if(!$result)
38
-          throw new JException(json_encode([
39
-            "query" => $_query,
40
-            "error" => $database->error
41
-          ]));
42
-        return $result;
43
-      }
4
+	  public $connection;
5
+	  public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
+		try {
7
+		  $this->connection = new mysqli( $_srv, $_usr, $_pass, $_db );
8
+		} catch( Exception $e ) {
9
+		  throw new JException($e->getMessage());
10
+		}
11
+	  }
12
+	  public function query( $_query ) {
13
+		$this->stdQuery($_query);
14
+		return true;
15
+	  }
16
+	  public function queryInsert( $_query ) {
17
+		$this->stdQuery($_query);
18
+		return $this->connection->insert_id;
19
+	  }
20
+	  public function queryFetch( $_query ) {
21
+		$result = $this->stdQuery($_query);
22
+		$rows = [];
23
+		while($row = $result->fetch_assoc())
24
+		  $rows[] = $row;
25
+		return $rows;
26
+	  }
27
+	  public function queryArray( $_query ) {
28
+		$result = $this->stdQuery($_query);
29
+		$rows = [];
30
+		while($row = $result->fetch_array())
31
+		  $rows[] = $row;
32
+		return $rows;
33
+	  }
34
+	  protected function stdQuery( $_query ) {
35
+		$database = $this->connection;
36
+		$result = $database->query($_query);
37
+		if(!$result)
38
+		  throw new JException(json_encode([
39
+			"query" => $_query,
40
+			"error" => $database->error
41
+		  ]));
42
+		return $result;
43
+	  }
44 44
   }
45 45
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PostgresqlAdapter.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("ConnectionInterface.php");
3 3
   class PostgresqlAdapter implements ConnectionAdapterInterface {
4
-      public $connection;
5
-      public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
-        try {
7
-          $this->connection = pg_connect("host=$_srv dbname=$_db user=$_usr password=$_pass")
8
-            or die('Could not connect: '.pg_last_error());
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->stdQuery("SELECT lastval()");
20
-      }
21
-      public function queryFetch( $_query ) {
22
-        $result = $this->stdQuery($_query);
23
-        $rows = [];
24
-        while($row = pg_fetch_assoc($result))
25
-          $rows[] = $row;
26
-        pg_free_result($result);
27
-        return $rows;
28
-      }
29
-      public function queryArray( $_query ) {
30
-        $result = $this->stdQuery($_query);
31
-        $rows = [];
32
-        while($row = pg_fetch_array($result))
33
-          $rows[] = $row;
34
-        pg_free_result($result);
35
-        return $rows;
36
-      }
37
-      protected function stdQuery( $_query ) {
38
-        $database = $this->connection;
39
-        $result = pg_query($database, $_query);
40
-        if(!$result)
41
-          throw new JException(json_encode([
42
-            "query" => $_query,
43
-            "error" => pg_last_error()
44
-          ]));
45
-        return $result;
46
-      }
4
+	  public $connection;
5
+	  public function __construct( $_srv, $_db, $_usr, $_pass ) {
6
+		try {
7
+		  $this->connection = pg_connect("host=$_srv dbname=$_db user=$_usr password=$_pass")
8
+			or die('Could not connect: '.pg_last_error());
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->stdQuery("SELECT lastval()");
20
+	  }
21
+	  public function queryFetch( $_query ) {
22
+		$result = $this->stdQuery($_query);
23
+		$rows = [];
24
+		while($row = pg_fetch_assoc($result))
25
+		  $rows[] = $row;
26
+		pg_free_result($result);
27
+		return $rows;
28
+	  }
29
+	  public function queryArray( $_query ) {
30
+		$result = $this->stdQuery($_query);
31
+		$rows = [];
32
+		while($row = pg_fetch_array($result))
33
+		  $rows[] = $row;
34
+		pg_free_result($result);
35
+		return $rows;
36
+	  }
37
+	  protected function stdQuery( $_query ) {
38
+		$database = $this->connection;
39
+		$result = pg_query($database, $_query);
40
+		if(!$result)
41
+		  throw new JException(json_encode([
42
+			"query" => $_query,
43
+			"error" => pg_last_error()
44
+		  ]));
45
+		return $result;
46
+	  }
47 47
   }
48 48
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/PdoMemoryAdapter.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("PdoAdapter.php");
3 3
   class PdoMemoryAdapter extends PdoAdapter {
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
-      }
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 12
   }
13 13
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Parser/Adapters/PugAdapter.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@
 block discarded – undo
2 2
   use Pug as Pug;
3 3
   jRequire("ParserAbstract.php");
4 4
   class PugAdapter extends ParserAbstract {
5
-    public function draw( $_text, $_parameters = [] ) {
6
-      $pug = new Pug\Pug();
7
-      $page = $pug->render($_text, $_parameters);
8
-      return $page;
9
-    }
5
+	public function draw( $_text, $_parameters = [] ) {
6
+	  $pug = new Pug\Pug();
7
+	  $page = $pug->render($_text, $_parameters);
8
+	  return $page;
9
+	}
10 10
   }
11 11
 ?>
Please login to merge, or discard this patch.