Test Failed
Push — master ( a33193...53306a )
by Federico
02:00
created
dist/jate/functions/array.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -11,6 +11,10 @@
 block discarded – undo
11 11
   function arrayHtmlParser($_array) {
12 12
     return travelStringArray($_array,"htmlParser");
13 13
   }
14
+
15
+  /**
16
+   * @param string $_function
17
+   */
14 18
   function travelStringArray ( $_array, $_function ) {
15 19
     if (is_array($_array)) {
16 20
       foreach ($_array as $k => $v) {
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 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
43
-          echo "$_tab<b>$k:</b> $i<br>";
44
-    }
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
43
+		  echo "$_tab<b>$k:</b> $i<br>";
44
+	}
45 45
 ?>
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@  discard block
 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
-  function travelStringArray ( $_array, $_function ) {
14
+  function travelStringArray($_array, $_function) {
15 15
     if (is_array($_array)) {
16 16
       foreach ($_array as $k => $v) {
17 17
         $_array[$k] = travelStringArray($v, $_function);
18 18
       }
19
-    } else if (is_string ($_array)) {
20
-      return call_user_func($_function,$_array);
19
+    } else if (is_string($_array)) {
20
+      return call_user_func($_function, $_array);
21 21
     }
22 22
     return $_array;
23 23
   }
24
-  function arrayDepth( $_array ) {
24
+  function arrayDepth($_array) {
25 25
     $maxDepth = 1;
26 26
     foreach ($_array as $value) {
27 27
       if (is_array($value)) {
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
33 33
     }
34 34
     return $maxDepth;
35 35
   }
36
-  function arrayDump( $_array, $_name = "Array", $_tab = "&nbsp;&nbsp;" ) {
36
+  function arrayDump($_array, $_name = "Array", $_tab = "&nbsp;&nbsp;") {
37 37
       $position = preg_replace('/&nbsp;&nbsp;/', '', $_tab, 1);
38 38
       echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>";
39 39
       foreach ($_array as $k => $i)
40
-        if(is_array($i))
41
-          arrayDump( $i, $k, "&nbsp;&nbsp;$_tab" );
40
+        if (is_array($i))
41
+          arrayDump($i, $k, "&nbsp;&nbsp;$_tab");
42 42
         else
43 43
           echo "$_tab<b>$k:</b> $i<br>";
44 44
     }
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -36,10 +36,12 @@
 block discarded – undo
36 36
   function arrayDump( $_array, $_name = "Array", $_tab = "&nbsp;&nbsp;" ) {
37 37
       $position = preg_replace('/&nbsp;&nbsp;/', '', $_tab, 1);
38 38
       echo "$position<span style=\"color:rgb(230,0,0)\">$_name:</span><br>";
39
-      foreach ($_array as $k => $i)
40
-        if(is_array($i))
39
+      foreach ($_array as $k => $i) {
40
+              if(is_array($i))
41 41
           arrayDump( $i, $k, "&nbsp;&nbsp;$_tab" );
42
-        else
43
-          echo "$_tab<b>$k:</b> $i<br>";
42
+      }
43
+        else {
44
+                  echo "$_tab<b>$k:</b> $i<br>";
45
+        }
44 46
     }
45 47
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/folder.php 4 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -17,6 +17,10 @@
 block discarded – undo
17 17
     });
18 18
     return $temp;
19 19
   }
20
+
21
+  /**
22
+   * @param Closure $_function
23
+   */
20 24
   function fetchInSubFolder( $_dir = "./", $_function) {
21 25
     $temp = [];
22 26
     if (is_dir($_dir)) {
Please login to merge, or discard this patch.
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -1,45 +1,45 @@
 block discarded – undo
1 1
 <?php
2 2
   function subFolder( $_dir = "./" ) {
3
-    $temp = fetchInSubFolder($_dir, function() {
4
-      return true;
5
-    });
6
-    return $temp;
3
+	$temp = fetchInSubFolder($_dir, function() {
4
+	  return true;
5
+	});
6
+	return $temp;
7 7
   }
8 8
   function subFolderFile( $_dir = "./" ) {
9
-    $temp = fetchInSubFolder($_dir, function( $_file ) {
10
-      return !is_dir($_file);
11
-    });
12
-    return $temp;
9
+	$temp = fetchInSubFolder($_dir, function( $_file ) {
10
+	  return !is_dir($_file);
11
+	});
12
+	return $temp;
13 13
   }
14 14
   function subFolderDir( $_dir = "./" ) {
15
-    $temp = fetchInSubFolder($_dir, function( $_file ) {
16
-      return !is_file($_file);
17
-    });
18
-    return $temp;
15
+	$temp = fetchInSubFolder($_dir, function( $_file ) {
16
+	  return !is_file($_file);
17
+	});
18
+	return $temp;
19 19
   }
20 20
   function fetchInSubFolder( $_dir = "./", $_function) {
21
-    $temp = [];
22
-    if (is_dir($_dir)) {
23
-        if ($dirOpened = opendir($_dir)) {
24
-            while (($file = readdir($dirOpened)) !== false)
25
-                if( ($file !='.')&&($file !='..') )
26
-                  if($_function($file))
27
-                    array_push($temp,$file);
28
-            closedir($dirOpened);
29
-        }
30
-    }
31
-    return $temp;
21
+	$temp = [];
22
+	if (is_dir($_dir)) {
23
+		if ($dirOpened = opendir($_dir)) {
24
+			while (($file = readdir($dirOpened)) !== false)
25
+				if( ($file !='.')&&($file !='..') )
26
+				  if($_function($file))
27
+					array_push($temp,$file);
28
+			closedir($dirOpened);
29
+		}
30
+	}
31
+	return $temp;
32 32
   }
33 33
   function requireSubfolder( $_dir = "./" ) {
34
-    $temp = subFolderFile($_dir);
35
-    foreach ($temp as $i)
36
-      jRequire($_dir."/".$i);
34
+	$temp = subFolderFile($_dir);
35
+	foreach ($temp as $i)
36
+	  jRequire($_dir."/".$i);
37 37
   }
38 38
   function require_js( $_dir = "./" ) {
39
-    $tempArray = [];
40
-    $temp = subFolderFile($_dir);
41
-    foreach ($temp as $i)
42
-      array_push($tempArray, $_dir."/".$i);
43
-    return $tempArray;
39
+	$tempArray = [];
40
+	$temp = subFolderFile($_dir);
41
+	foreach ($temp as $i)
42
+	  array_push($tempArray, $_dir."/".$i);
43
+	return $tempArray;
44 44
   }
45 45
 ?>
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,41 +1,41 @@
 block discarded – undo
1 1
 <?php
2
-  function subFolder( $_dir = "./" ) {
2
+  function subFolder($_dir = "./") {
3 3
     $temp = fetchInSubFolder($_dir, function() {
4 4
       return true;
5 5
     });
6 6
     return $temp;
7 7
   }
8
-  function subFolderFile( $_dir = "./" ) {
9
-    $temp = fetchInSubFolder($_dir, function( $_file ) {
8
+  function subFolderFile($_dir = "./") {
9
+    $temp = fetchInSubFolder($_dir, function($_file) {
10 10
       return !is_dir($_file);
11 11
     });
12 12
     return $temp;
13 13
   }
14
-  function subFolderDir( $_dir = "./" ) {
15
-    $temp = fetchInSubFolder($_dir, function( $_file ) {
14
+  function subFolderDir($_dir = "./") {
15
+    $temp = fetchInSubFolder($_dir, function($_file) {
16 16
       return !is_file($_file);
17 17
     });
18 18
     return $temp;
19 19
   }
20
-  function fetchInSubFolder( $_dir = "./", $_function) {
20
+  function fetchInSubFolder($_dir = "./", $_function) {
21 21
     $temp = [];
22 22
     if (is_dir($_dir)) {
23 23
         if ($dirOpened = opendir($_dir)) {
24 24
             while (($file = readdir($dirOpened)) !== false)
25
-                if( ($file !='.')&&($file !='..') )
26
-                  if($_function($file))
27
-                    array_push($temp,$file);
25
+                if (($file != '.') && ($file != '..'))
26
+                  if ($_function($file))
27
+                    array_push($temp, $file);
28 28
             closedir($dirOpened);
29 29
         }
30 30
     }
31 31
     return $temp;
32 32
   }
33
-  function requireSubfolder( $_dir = "./" ) {
33
+  function requireSubfolder($_dir = "./") {
34 34
     $temp = subFolderFile($_dir);
35 35
     foreach ($temp as $i)
36 36
       jRequire($_dir."/".$i);
37 37
   }
38
-  function require_js( $_dir = "./" ) {
38
+  function require_js($_dir = "./") {
39 39
     $tempArray = [];
40 40
     $temp = subFolderFile($_dir);
41 41
     foreach ($temp as $i)
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,10 +21,11 @@  discard block
 block discarded – undo
21 21
     $temp = [];
22 22
     if (is_dir($_dir)) {
23 23
         if ($dirOpened = opendir($_dir)) {
24
-            while (($file = readdir($dirOpened)) !== false)
25
-                if( ($file !='.')&&($file !='..') )
24
+            while (($file = readdir($dirOpened)) !== false) {
25
+                            if( ($file !='.')&&($file !='..') )
26 26
                   if($_function($file))
27 27
                     array_push($temp,$file);
28
+            }
28 29
             closedir($dirOpened);
29 30
         }
30 31
     }
@@ -32,14 +33,16 @@  discard block
 block discarded – undo
32 33
   }
33 34
   function requireSubfolder( $_dir = "./" ) {
34 35
     $temp = subFolderFile($_dir);
35
-    foreach ($temp as $i)
36
-      jRequire($_dir."/".$i);
36
+    foreach ($temp as $i) {
37
+          jRequire($_dir."/".$i);
38
+    }
37 39
   }
38 40
   function require_js( $_dir = "./" ) {
39 41
     $tempArray = [];
40 42
     $temp = subFolderFile($_dir);
41
-    foreach ($temp as $i)
42
-      array_push($tempArray, $_dir."/".$i);
43
+    foreach ($temp as $i) {
44
+          array_push($tempArray, $_dir."/".$i);
45
+    }
43 46
     return $tempArray;
44 47
   }
45 48
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Adapters/ConnectionInterface.php 3 patches
Doc Comments   +8 added lines patch added patch discarded remove patch
@@ -1,6 +1,14 @@
 block discarded – undo
1 1
 <?php
2 2
   interface ConnectionAdapterInterface {
3
+
4
+    /**
5
+     * @return void
6
+     */
3 7
     public function __construct( $_srv, $_db, $_usr, $_pass);
8
+
9
+    /**
10
+     * @return boolean
11
+     */
4 12
     public function query( $_query );
5 13
     public function queryFetch( $_query );
6 14
     public function queryArray( $_query );
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
   interface ConnectionAdapterInterface {
3
-    public function __construct( $_srv, $_db, $_usr, $_pass);
4
-    public function query( $_query );
5
-    public function queryFetch( $_query );
6
-    public function queryArray( $_query );
7
-    public function queryInsert( $_query );
3
+	public function __construct( $_srv, $_db, $_usr, $_pass);
4
+	public function query( $_query );
5
+	public function queryFetch( $_query );
6
+	public function queryArray( $_query );
7
+	public function queryInsert( $_query );
8 8
   }
9 9
 ?>
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <?php
2 2
   interface ConnectionAdapterInterface {
3
-    public function __construct( $_srv, $_db, $_usr, $_pass);
4
-    public function query( $_query );
5
-    public function queryFetch( $_query );
6
-    public function queryArray( $_query );
7
-    public function queryInsert( $_query );
3
+    public function __construct($_srv, $_db, $_usr, $_pass);
4
+    public function query($_query);
5
+    public function queryFetch($_query);
6
+    public function queryArray($_query);
7
+    public function queryInsert($_query);
8 8
   }
9 9
 ?>
Please login to merge, or discard this patch.
dist/jate/modules/Module/Module.php 4 patches
Doc Comments   +13 added lines patch added patch discarded remove patch
@@ -39,6 +39,10 @@  discard block
 block discarded – undo
39 39
           array_push($temp,$i);
40 40
       return $temp;
41 41
     }
42
+
43
+    /**
44
+     * @param string $_mods
45
+     */
42 46
     public function addModules( $_mods ) {
43 47
       if(!is_array($_mods))
44 48
         throw new InvalidArgumentException("Parameter must be an array.");
@@ -64,6 +68,10 @@  discard block
 block discarded – undo
64 68
         throw new InvalidArgumentException("Parameter must be a string or an array.");
65 69
       array_push($this->files, $_file);
66 70
     }
71
+
72
+    /**
73
+     * @param string $_files
74
+     */
67 75
     public function addFilesRequired( $_files ) {
68 76
       if(!is_array($_files))
69 77
         throw new InvalidArgumentException("Parameter must be an array.");
@@ -80,6 +88,11 @@  discard block
 block discarded – undo
80 88
       $this->tags["js"] = $this->getJs();
81 89
       $this->tags["jsVariables"] = $this->getJsVariables();
82 90
     }
91
+
92
+    /**
93
+     * @param string $_function
94
+     * @param string $_extenction
95
+     */
83 96
     protected function getRequire( $_function, $_extenction) {
84 97
       $temp = [];
85 98
       foreach ($this->required as $i)
Please login to merge, or discard this patch.
Indentation   +92 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1,96 +1,96 @@
 block discarded – undo
1 1
 <?php
2 2
   class Module {
3
-    public $name;
4
-    public $modules;
5
-    public $files;
6
-    public $required;
7
-    public $data;
8
-    public $tags;
9
-    public $connection;
10
-    public $parameters;
11
-    public function __construct() {
12
-      $this->name        = get_class($this);
13
-      $this->modules    = [];
14
-      $this->files      = [];
15
-      $this->required    = [];
16
-      $this->data        = [];
17
-      $this->tags        = [];
18
-      $this->connection  = null;
19
-      $this->parameters = null;
20
-    }
21
-    // abstract public function config();
22
-    // abstract public function init();
23
-    // abstract public function draw();
24
-    public function getCss() {
25
-      return $this->getRequire("getCss",".css");
26
-    }
27
-    public function getJs() {
28
-      return $this->getRequire("getJs",".js");
29
-    }
30
-    public function getJsVariables() {
31
-      $temp = [];
32
-      foreach ($this->required as $i)
33
-        if (is_array($i))
34
-          array_push($temp,$i);
35
-      foreach ($this->modules as $i)
36
-        $temp = array_merge( $temp, $i->getJsVariables() );
37
-      foreach ($this->files as $i)
38
-        if (is_array($i))
39
-          array_push($temp,$i);
40
-      return $temp;
41
-    }
42
-    public function addModules( $_mods ) {
43
-      if(!is_array($_mods))
44
-        throw new InvalidArgumentException("Parameter must be an array.");
45
-      foreach ($_mods as $value)
46
-        $this->addModule($value);
47
-    }
48
-    public function addModule( $_mod ) {
49
-      if(!is_object($_mod))
50
-        throw new InvalidArgumentException("Parameter must be a class.");
51
-      if(! is_subclass_of ($_mod, "Module"))
52
-        throw new InvalidArgumentException("Parameter must be a class.");
53
-      $this->modules[$_mod->name] = $_mod;
54
-      $this->modules[$_mod->name]->parameters = &$this->parameters;
55
-    }
56
-    public function addFiles( $_files ) {
57
-      if(!is_array($_files))
58
-        throw new InvalidArgumentException("Parameter must be an array.");
59
-      foreach ($_files as $value)
60
-        $this->addFile($value);
61
-    }
62
-    public function addFile( $_file ) {
63
-      if(!(is_string($_file) || is_array($_file)))
64
-        throw new InvalidArgumentException("Parameter must be a string or an array.");
65
-      array_push($this->files, $_file);
66
-    }
67
-    public function addFilesRequired( $_files ) {
68
-      if(!is_array($_files))
69
-        throw new InvalidArgumentException("Parameter must be an array.");
70
-      foreach ($_files as $value)
71
-        $this->addFileRequired($value);
72
-    }
73
-    public function addFileRequired( $_file ) {
74
-      if(!is_string($_file))
75
-        throw new InvalidArgumentException("Parameter must be a string.");
76
-      array_push($this->required, $_file);
77
-    }
78
-    protected function addDipendences() {
79
-      $this->tags["css"] = $this->getCss();
80
-      $this->tags["js"] = $this->getJs();
81
-      $this->tags["jsVariables"] = $this->getJsVariables();
82
-    }
83
-    protected function getRequire( $_function, $_extenction) {
84
-      $temp = [];
85
-      foreach ($this->required as $i)
86
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
87
-          array_push($temp,$i);
88
-      foreach ($this->modules as $i)
89
-        $temp = array_merge( $temp, $i->$_function() );
90
-      foreach ($this->files as $i)
91
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92
-          array_push($temp,$i);
93
-      return $temp;
94
-    }
3
+	public $name;
4
+	public $modules;
5
+	public $files;
6
+	public $required;
7
+	public $data;
8
+	public $tags;
9
+	public $connection;
10
+	public $parameters;
11
+	public function __construct() {
12
+	  $this->name        = get_class($this);
13
+	  $this->modules    = [];
14
+	  $this->files      = [];
15
+	  $this->required    = [];
16
+	  $this->data        = [];
17
+	  $this->tags        = [];
18
+	  $this->connection  = null;
19
+	  $this->parameters = null;
20
+	}
21
+	// abstract public function config();
22
+	// abstract public function init();
23
+	// abstract public function draw();
24
+	public function getCss() {
25
+	  return $this->getRequire("getCss",".css");
26
+	}
27
+	public function getJs() {
28
+	  return $this->getRequire("getJs",".js");
29
+	}
30
+	public function getJsVariables() {
31
+	  $temp = [];
32
+	  foreach ($this->required as $i)
33
+		if (is_array($i))
34
+		  array_push($temp,$i);
35
+	  foreach ($this->modules as $i)
36
+		$temp = array_merge( $temp, $i->getJsVariables() );
37
+	  foreach ($this->files as $i)
38
+		if (is_array($i))
39
+		  array_push($temp,$i);
40
+	  return $temp;
41
+	}
42
+	public function addModules( $_mods ) {
43
+	  if(!is_array($_mods))
44
+		throw new InvalidArgumentException("Parameter must be an array.");
45
+	  foreach ($_mods as $value)
46
+		$this->addModule($value);
47
+	}
48
+	public function addModule( $_mod ) {
49
+	  if(!is_object($_mod))
50
+		throw new InvalidArgumentException("Parameter must be a class.");
51
+	  if(! is_subclass_of ($_mod, "Module"))
52
+		throw new InvalidArgumentException("Parameter must be a class.");
53
+	  $this->modules[$_mod->name] = $_mod;
54
+	  $this->modules[$_mod->name]->parameters = &$this->parameters;
55
+	}
56
+	public function addFiles( $_files ) {
57
+	  if(!is_array($_files))
58
+		throw new InvalidArgumentException("Parameter must be an array.");
59
+	  foreach ($_files as $value)
60
+		$this->addFile($value);
61
+	}
62
+	public function addFile( $_file ) {
63
+	  if(!(is_string($_file) || is_array($_file)))
64
+		throw new InvalidArgumentException("Parameter must be a string or an array.");
65
+	  array_push($this->files, $_file);
66
+	}
67
+	public function addFilesRequired( $_files ) {
68
+	  if(!is_array($_files))
69
+		throw new InvalidArgumentException("Parameter must be an array.");
70
+	  foreach ($_files as $value)
71
+		$this->addFileRequired($value);
72
+	}
73
+	public function addFileRequired( $_file ) {
74
+	  if(!is_string($_file))
75
+		throw new InvalidArgumentException("Parameter must be a string.");
76
+	  array_push($this->required, $_file);
77
+	}
78
+	protected function addDipendences() {
79
+	  $this->tags["css"] = $this->getCss();
80
+	  $this->tags["js"] = $this->getJs();
81
+	  $this->tags["jsVariables"] = $this->getJsVariables();
82
+	}
83
+	protected function getRequire( $_function, $_extenction) {
84
+	  $temp = [];
85
+	  foreach ($this->required as $i)
86
+		if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
87
+		  array_push($temp,$i);
88
+	  foreach ($this->modules as $i)
89
+		$temp = array_merge( $temp, $i->$_function() );
90
+	  foreach ($this->files as $i)
91
+		if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92
+		  array_push($temp,$i);
93
+	  return $temp;
94
+	}
95 95
   }
96 96
 ?>
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -22,56 +22,56 @@  discard block
 block discarded – undo
22 22
     // abstract public function init();
23 23
     // abstract public function draw();
24 24
     public function getCss() {
25
-      return $this->getRequire("getCss",".css");
25
+      return $this->getRequire("getCss", ".css");
26 26
     }
27 27
     public function getJs() {
28
-      return $this->getRequire("getJs",".js");
28
+      return $this->getRequire("getJs", ".js");
29 29
     }
30 30
     public function getJsVariables() {
31 31
       $temp = [];
32 32
       foreach ($this->required as $i)
33 33
         if (is_array($i))
34
-          array_push($temp,$i);
34
+          array_push($temp, $i);
35 35
       foreach ($this->modules as $i)
36
-        $temp = array_merge( $temp, $i->getJsVariables() );
36
+        $temp = array_merge($temp, $i->getJsVariables());
37 37
       foreach ($this->files as $i)
38 38
         if (is_array($i))
39
-          array_push($temp,$i);
39
+          array_push($temp, $i);
40 40
       return $temp;
41 41
     }
42
-    public function addModules( $_mods ) {
43
-      if(!is_array($_mods))
42
+    public function addModules($_mods) {
43
+      if (!is_array($_mods))
44 44
         throw new InvalidArgumentException("Parameter must be an array.");
45 45
       foreach ($_mods as $value)
46 46
         $this->addModule($value);
47 47
     }
48
-    public function addModule( $_mod ) {
49
-      if(!is_object($_mod))
48
+    public function addModule($_mod) {
49
+      if (!is_object($_mod))
50 50
         throw new InvalidArgumentException("Parameter must be a class.");
51
-      if(! is_subclass_of ($_mod, "Module"))
51
+      if (!is_subclass_of($_mod, "Module"))
52 52
         throw new InvalidArgumentException("Parameter must be a class.");
53 53
       $this->modules[$_mod->name] = $_mod;
54 54
       $this->modules[$_mod->name]->parameters = &$this->parameters;
55 55
     }
56
-    public function addFiles( $_files ) {
57
-      if(!is_array($_files))
56
+    public function addFiles($_files) {
57
+      if (!is_array($_files))
58 58
         throw new InvalidArgumentException("Parameter must be an array.");
59 59
       foreach ($_files as $value)
60 60
         $this->addFile($value);
61 61
     }
62
-    public function addFile( $_file ) {
63
-      if(!(is_string($_file) || is_array($_file)))
62
+    public function addFile($_file) {
63
+      if (!(is_string($_file) || is_array($_file)))
64 64
         throw new InvalidArgumentException("Parameter must be a string or an array.");
65 65
       array_push($this->files, $_file);
66 66
     }
67
-    public function addFilesRequired( $_files ) {
68
-      if(!is_array($_files))
67
+    public function addFilesRequired($_files) {
68
+      if (!is_array($_files))
69 69
         throw new InvalidArgumentException("Parameter must be an array.");
70 70
       foreach ($_files as $value)
71 71
         $this->addFileRequired($value);
72 72
     }
73
-    public function addFileRequired( $_file ) {
74
-      if(!is_string($_file))
73
+    public function addFileRequired($_file) {
74
+      if (!is_string($_file))
75 75
         throw new InvalidArgumentException("Parameter must be a string.");
76 76
       array_push($this->required, $_file);
77 77
     }
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
       $this->tags["js"] = $this->getJs();
81 81
       $this->tags["jsVariables"] = $this->getJsVariables();
82 82
     }
83
-    protected function getRequire( $_function, $_extenction) {
83
+    protected function getRequire($_function, $_extenction) {
84 84
       $temp = [];
85 85
       foreach ($this->required as $i)
86 86
         if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
87
-          array_push($temp,$i);
87
+          array_push($temp, $i);
88 88
       foreach ($this->modules as $i)
89
-        $temp = array_merge( $temp, $i->$_function() );
89
+        $temp = array_merge($temp, $i->$_function());
90 90
       foreach ($this->files as $i)
91 91
         if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92
-          array_push($temp,$i);
92
+          array_push($temp, $i);
93 93
       return $temp;
94 94
     }
95 95
   }
Please login to merge, or discard this patch.
Braces   +48 added lines, -32 removed lines patch added patch discarded remove patch
@@ -29,50 +29,63 @@  discard block
 block discarded – undo
29 29
     }
30 30
     public function getJsVariables() {
31 31
       $temp = [];
32
-      foreach ($this->required as $i)
33
-        if (is_array($i))
32
+      foreach ($this->required as $i) {
33
+              if (is_array($i))
34 34
           array_push($temp,$i);
35
-      foreach ($this->modules as $i)
36
-        $temp = array_merge( $temp, $i->getJsVariables() );
37
-      foreach ($this->files as $i)
38
-        if (is_array($i))
35
+      }
36
+      foreach ($this->modules as $i) {
37
+              $temp = array_merge( $temp, $i->getJsVariables() );
38
+      }
39
+      foreach ($this->files as $i) {
40
+              if (is_array($i))
39 41
           array_push($temp,$i);
42
+      }
40 43
       return $temp;
41 44
     }
42 45
     public function addModules( $_mods ) {
43
-      if(!is_array($_mods))
44
-        throw new InvalidArgumentException("Parameter must be an array.");
45
-      foreach ($_mods as $value)
46
-        $this->addModule($value);
46
+      if(!is_array($_mods)) {
47
+              throw new InvalidArgumentException("Parameter must be an array.");
48
+      }
49
+      foreach ($_mods as $value) {
50
+              $this->addModule($value);
51
+      }
47 52
     }
48 53
     public function addModule( $_mod ) {
49
-      if(!is_object($_mod))
50
-        throw new InvalidArgumentException("Parameter must be a class.");
51
-      if(! is_subclass_of ($_mod, "Module"))
52
-        throw new InvalidArgumentException("Parameter must be a class.");
54
+      if(!is_object($_mod)) {
55
+              throw new InvalidArgumentException("Parameter must be a class.");
56
+      }
57
+      if(! is_subclass_of ($_mod, "Module")) {
58
+              throw new InvalidArgumentException("Parameter must be a class.");
59
+      }
53 60
       $this->modules[$_mod->name] = $_mod;
54 61
       $this->modules[$_mod->name]->parameters = &$this->parameters;
55 62
     }
56 63
     public function addFiles( $_files ) {
57
-      if(!is_array($_files))
58
-        throw new InvalidArgumentException("Parameter must be an array.");
59
-      foreach ($_files as $value)
60
-        $this->addFile($value);
64
+      if(!is_array($_files)) {
65
+              throw new InvalidArgumentException("Parameter must be an array.");
66
+      }
67
+      foreach ($_files as $value) {
68
+              $this->addFile($value);
69
+      }
61 70
     }
62 71
     public function addFile( $_file ) {
63
-      if(!(is_string($_file) || is_array($_file)))
64
-        throw new InvalidArgumentException("Parameter must be a string or an array.");
72
+      if(!(is_string($_file) || is_array($_file))) {
73
+              throw new InvalidArgumentException("Parameter must be a string or an array.");
74
+      }
65 75
       array_push($this->files, $_file);
66 76
     }
67 77
     public function addFilesRequired( $_files ) {
68
-      if(!is_array($_files))
69
-        throw new InvalidArgumentException("Parameter must be an array.");
70
-      foreach ($_files as $value)
71
-        $this->addFileRequired($value);
78
+      if(!is_array($_files)) {
79
+              throw new InvalidArgumentException("Parameter must be an array.");
80
+      }
81
+      foreach ($_files as $value) {
82
+              $this->addFileRequired($value);
83
+      }
72 84
     }
73 85
     public function addFileRequired( $_file ) {
74
-      if(!is_string($_file))
75
-        throw new InvalidArgumentException("Parameter must be a string.");
86
+      if(!is_string($_file)) {
87
+              throw new InvalidArgumentException("Parameter must be a string.");
88
+      }
76 89
       array_push($this->required, $_file);
77 90
     }
78 91
     protected function addDipendences() {
@@ -82,14 +95,17 @@  discard block
 block discarded – undo
82 95
     }
83 96
     protected function getRequire( $_function, $_extenction) {
84 97
       $temp = [];
85
-      foreach ($this->required as $i)
86
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
98
+      foreach ($this->required as $i) {
99
+              if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
87 100
           array_push($temp,$i);
88
-      foreach ($this->modules as $i)
89
-        $temp = array_merge( $temp, $i->$_function() );
90
-      foreach ($this->files as $i)
91
-        if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
101
+      }
102
+      foreach ($this->modules as $i) {
103
+              $temp = array_merge( $temp, $i->$_function() );
104
+      }
105
+      foreach ($this->files as $i) {
106
+              if (!is_array($i) && strpos($i, $_extenction) !== FALSE)
92 107
           array_push($temp,$i);
108
+      }
93 109
       return $temp;
94 110
     }
95 111
   }
Please login to merge, or discard this patch.
dist/jate/modules/Parsedown/Parsedown.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -9,6 +9,10 @@
 block discarded – undo
9 9
     public function drawFile( $_template ) {
10 10
       return $this->draw($_template);
11 11
     }
12
+
13
+    /**
14
+     * @param string $_template
15
+     */
12 16
     public function drawText( $_template ) {
13 17
       return $this->draw(trim($_template));
14 18
     }
Please login to merge, or discard this patch.
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -3,20 +3,20 @@
 block discarded – undo
3 3
   jRequire("Parsedown/Parsedown.php");
4 4
   use Parsedown as Parsedown;
5 5
   class Parsedown extends Module {
6
-    public function __construct() {
7
-      parent::__construct();
8
-    }
9
-    public function drawFile( $_template ) {
10
-      return $this->draw($_template);
11
-    }
12
-    public function drawText( $_template ) {
13
-      return $this->draw(trim($_template));
14
-    }
15
-    public function draw( $_template ) {
16
-      $Parsedown = new Parsedown\Parsedown();
17
-      $page = $Parsedown->text($_template);
18
-      $page = preg_replace('/[ ](?=[^>]*(?:<|$))/', "&nbsp", $page);
19
-      return $page;
20
-    }
6
+	public function __construct() {
7
+	  parent::__construct();
8
+	}
9
+	public function drawFile( $_template ) {
10
+	  return $this->draw($_template);
11
+	}
12
+	public function drawText( $_template ) {
13
+	  return $this->draw(trim($_template));
14
+	}
15
+	public function draw( $_template ) {
16
+	  $Parsedown = new Parsedown\Parsedown();
17
+	  $page = $Parsedown->text($_template);
18
+	  $page = preg_replace('/[ ](?=[^>]*(?:<|$))/', "&nbsp", $page);
19
+	  return $page;
20
+	}
21 21
   }
22 22
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,13 +6,13 @@
 block discarded – undo
6 6
     public function __construct() {
7 7
       parent::__construct();
8 8
     }
9
-    public function drawFile( $_template ) {
9
+    public function drawFile($_template) {
10 10
       return $this->draw($_template);
11 11
     }
12
-    public function drawText( $_template ) {
12
+    public function drawText($_template) {
13 13
       return $this->draw(trim($_template));
14 14
     }
15
-    public function draw( $_template ) {
15
+    public function draw($_template) {
16 16
       $Parsedown = new Parsedown\Parsedown();
17 17
       $page = $Parsedown->text($_template);
18 18
       $page = preg_replace('/[ ](?=[^>]*(?:<|$))/', "&nbsp", $page);
Please login to merge, or discard this patch.
dist/jate/modules/Pug/Pug.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -8,6 +8,10 @@
 block discarded – undo
8 8
     public function drawFile( $_file, $_parameters = [] ) {
9 9
       return $this->draw($_file, $_parameters);
10 10
     }
11
+
12
+    /**
13
+     * @param string $_text
14
+     */
11 15
     public function drawText( $_text, $_parameters = [] ) {
12 16
       return $this->draw(trim($_text), $_parameters);
13 17
     }
Please login to merge, or discard this patch.
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -2,19 +2,19 @@
 block discarded – undo
2 2
   use Pug as Pug;
3 3
   jRequire("../Module/Module.php");
4 4
   class Pug extends Module {
5
-    public function __construct() {
6
-      parent::__construct();
7
-    }
8
-    public function drawFile( $_file, $_parameters = [] ) {
9
-      return $this->draw($_file, $_parameters);
10
-    }
11
-    public function drawText( $_text, $_parameters = [] ) {
12
-      return $this->draw(trim($_text), $_parameters);
13
-    }
14
-    public function draw( $_text, $_parameters = [] ) {
15
-      $pug = new Pug\Pug();
16
-      $page = $pug->render($_text, $_parameters);
17
-      return $page;
18
-    }
5
+	public function __construct() {
6
+	  parent::__construct();
7
+	}
8
+	public function drawFile( $_file, $_parameters = [] ) {
9
+	  return $this->draw($_file, $_parameters);
10
+	}
11
+	public function drawText( $_text, $_parameters = [] ) {
12
+	  return $this->draw(trim($_text), $_parameters);
13
+	}
14
+	public function draw( $_text, $_parameters = [] ) {
15
+	  $pug = new Pug\Pug();
16
+	  $page = $pug->render($_text, $_parameters);
17
+	  return $page;
18
+	}
19 19
   }
20 20
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,13 +5,13 @@
 block discarded – undo
5 5
     public function __construct() {
6 6
       parent::__construct();
7 7
     }
8
-    public function drawFile( $_file, $_parameters = [] ) {
8
+    public function drawFile($_file, $_parameters = []) {
9 9
       return $this->draw($_file, $_parameters);
10 10
     }
11
-    public function drawText( $_text, $_parameters = [] ) {
11
+    public function drawText($_text, $_parameters = []) {
12 12
       return $this->draw(trim($_text), $_parameters);
13 13
     }
14
-    public function draw( $_text, $_parameters = [] ) {
14
+    public function draw($_text, $_parameters = []) {
15 15
       $pug = new Pug\Pug();
16 16
       $page = $pug->render($_text, $_parameters);
17 17
       return $page;
Please login to merge, or discard this patch.
dist/jate/modules/Twig/Twig.php 3 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -14,6 +14,10 @@
 block discarded – undo
14 14
       $page = $template->render($_parameters);
15 15
       return $page;
16 16
     }
17
+
18
+    /**
19
+     * @param string $_text
20
+     */
17 21
     public function drawText( $_text, $_parameters = [] ) {
18 22
       $loader = new Twig_Loader_Array([
19 23
         'index' => $_text
Please login to merge, or discard this patch.
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2,25 +2,25 @@
 block discarded – undo
2 2
   // use Twig as Twig;
3 3
   jRequire("../Module/Module.php");
4 4
   class Twig extends Module {
5
-    public function __construct() {
6
-      parent::__construct();
7
-    }
8
-    public function drawFile( $_file, $_parameters = [] ) {
9
-      $loader  = new Twig_Loader_Filesystem('bundles/views');
10
-      $twig    = new Twig_Environment( $loader, [
11
-        'cache' => 'bundles/views',
12
-      ]);
13
-      $template = $twig->loadTemplate($_text);
14
-      $page = $template->render($_parameters);
15
-      return $page;
16
-    }
17
-    public function drawText( $_text, $_parameters = [] ) {
18
-      $loader = new Twig_Loader_Array([
19
-        'index' => $_text
20
-      ]);
21
-      $twig = new Twig_Environment($loader);
22
-      $page = $twig->render('index', $_parameters);
23
-      return $page;
24
-    }
5
+	public function __construct() {
6
+	  parent::__construct();
7
+	}
8
+	public function drawFile( $_file, $_parameters = [] ) {
9
+	  $loader  = new Twig_Loader_Filesystem('bundles/views');
10
+	  $twig    = new Twig_Environment( $loader, [
11
+		'cache' => 'bundles/views',
12
+	  ]);
13
+	  $template = $twig->loadTemplate($_text);
14
+	  $page = $template->render($_parameters);
15
+	  return $page;
16
+	}
17
+	public function drawText( $_text, $_parameters = [] ) {
18
+	  $loader = new Twig_Loader_Array([
19
+		'index' => $_text
20
+	  ]);
21
+	  $twig = new Twig_Environment($loader);
22
+	  $page = $twig->render('index', $_parameters);
23
+	  return $page;
24
+	}
25 25
   }
26 26
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@
 block discarded – undo
5 5
     public function __construct() {
6 6
       parent::__construct();
7 7
     }
8
-    public function drawFile( $_file, $_parameters = [] ) {
8
+    public function drawFile($_file, $_parameters = []) {
9 9
       $loader  = new Twig_Loader_Filesystem('bundles/views');
10
-      $twig    = new Twig_Environment( $loader, [
10
+      $twig    = new Twig_Environment($loader, [
11 11
         'cache' => 'bundles/views',
12 12
       ]);
13 13
       $template = $twig->loadTemplate($_text);
14 14
       $page = $template->render($_parameters);
15 15
       return $page;
16 16
     }
17
-    public function drawText( $_text, $_parameters = [] ) {
17
+    public function drawText($_text, $_parameters = []) {
18 18
       $loader = new Twig_Loader_Array([
19 19
         'index' => $_text
20 20
       ]);
Please login to merge, or discard this patch.
dist/jate/modules/Statistic/Statistic.php 2 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -1,25 +1,25 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
   jRequire("../Module/Module.php");
3 3
   class Statistic extends Module {
4
-    public function __construct( $_webApp ) {
5
-      parent::__construct();
6
-      $pages = [];
7
-      $stats = [];
8
-      $pages = $_webApp->pages;
9
-      foreach ( $pages as $k => $v ) {
10
-        $temp = new $v[0]($v[1]);
11
-        $temp->addDipendences();
12
-        $stats[$k] = [];
13
-        $stats[$k]["page"]  = $v[0];
14
-        $stats[$k]["css"]    = $temp->data["css"];
15
-        $stats[$k]["js"]    = $temp->data["js"];
16
-      }
17
-      $this->data = $stats;
18
-    }
19
-    public function draw() {
20
-      jBlock();
21
-      foreach ($this->data as $i) {
22
-      ?>
4
+	public function __construct( $_webApp ) {
5
+	  parent::__construct();
6
+	  $pages = [];
7
+	  $stats = [];
8
+	  $pages = $_webApp->pages;
9
+	  foreach ( $pages as $k => $v ) {
10
+		$temp = new $v[0]($v[1]);
11
+		$temp->addDipendences();
12
+		$stats[$k] = [];
13
+		$stats[$k]["page"]  = $v[0];
14
+		$stats[$k]["css"]    = $temp->data["css"];
15
+		$stats[$k]["js"]    = $temp->data["js"];
16
+	  }
17
+	  $this->data = $stats;
18
+	}
19
+	public function draw() {
20
+	  jBlock();
21
+	  foreach ($this->data as $i) {
22
+	  ?>
23 23
         <div class="row">
24 24
           <div class="col-lg-12">
25 25
             Page: <?=$i["page"]?><br>
@@ -28,8 +28,8 @@  discard block
 block discarded – undo
28 28
           </div>
29 29
         </div>
30 30
       <?php
31
-      }
32
-      return jBlockEnd();
33
-    }
31
+	  }
32
+	  return jBlockEnd();
33
+	}
34 34
   }
35 35
 ?>
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("../Module/Module.php");
3 3
   class Statistic extends Module {
4
-    public function __construct( $_webApp ) {
4
+    public function __construct($_webApp) {
5 5
       parent::__construct();
6 6
       $pages = [];
7 7
       $stats = [];
8 8
       $pages = $_webApp->pages;
9
-      foreach ( $pages as $k => $v ) {
9
+      foreach ($pages as $k => $v) {
10 10
         $temp = new $v[0]($v[1]);
11 11
         $temp->addDipendences();
12 12
         $stats[$k] = [];
13 13
         $stats[$k]["page"]  = $v[0];
14
-        $stats[$k]["css"]    = $temp->data["css"];
14
+        $stats[$k]["css"] = $temp->data["css"];
15 15
         $stats[$k]["js"]    = $temp->data["js"];
16 16
       }
17 17
       $this->data = $stats;
Please login to merge, or discard this patch.
dist/jate/modules/WebApp/WebApp.php 3 patches
Indentation   +85 added lines, -85 removed lines patch added patch discarded remove patch
@@ -1,90 +1,90 @@
 block discarded – undo
1 1
 <?php
2 2
   jRequire("../Module/Module.php");
3 3
   class WebApp extends Module {
4
-    protected $pages;
5
-    protected $defaultPage;
6
-    public $currentPage;
7
-    public $jConfig;
8
-    public function __construct() {
9
-      parent::__construct();
10
-      $this->pages = [];
11
-      $this->defaultPage = ["Page404",[]];
12
-      $this->currentPage = null;
13
-      $this->jConfig     = null;
14
-    }
15
-    public function addPage( $_page ) {
16
-      $param = [];
17
-      $path  = $_page;
18
-      $class = $_page;
19
-      if(is_array($_page)) {
20
-        $path  = $_page[0];
21
-        $class = $_page[1];
22
-        if(isset($_page[2]))
23
-          $param = $_page[2];
24
-      }
25
-      $this->pages[$path] = [$class, $param];
26
-      return $this->pages[$path];
27
-    }
28
-    public function addPages( $_pages ) {
29
-      foreach ($_pages as $i)
30
-        $this->addPage($i);
31
-    }
32
-    public function fetchPage() {
33
-      $router = new Router();
34
-      $router->parameters = [ "app" => &$this->jConfig, "page" => null];
35
-      $stack = $router->getPage();
36
-      $parameters = [];
37
-      $temp = $this->defaultPage;
38
-      foreach ($this->pages as $key => $value) {
39
-        $variables = $this->pathSeeker(explode("/", $key), $stack);
40
-        if(is_array($variables)) {
41
-          $temp = $value;
42
-          $parameters = $variables;
43
-          break;
44
-        }
45
-      }
46
-      if( isset($temp[1]) && is_array($temp[1]) )
47
-        $temp[1] = array_merge($temp[1], $parameters);
48
-      else
49
-        $temp[1] = $parameters;
50
-      $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
51
-      return $this->currentPage;
52
-    }
53
-    public function setDefaultPage( $_page ) {
54
-      $this->defaultPage = $this->addPage($_page);
55
-    }
56
-    public function draw() {
57
-      $this->currentPage->uniforma();
58
-      $gui = new GUI();
59
-      $gui->init($this->currentPage);
60
-      $gui->draw($this->currentPage->data["template"]);
61
-    }
62
-    public function pathSeeker( $_path, $_url ) {
63
-      $urlLength = count($_url);
64
-      $cont = 0;
65
-      $variables = [];
66
-      $pathLength = count($_path);
67
-      if($urlLength == $pathLength) {
68
-        while($cont < $urlLength) {
69
-          if(
70
-            ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
71
-            (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
72
-            $cont++;
73
-          else if( strpos($_path[$cont], "\$") !== false ) {
74
-            $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
75
-            $cont++;
76
-          } else break;
77
-        }
78
-        if($cont == $urlLength)
79
-          return $variables;
80
-      }
81
-      return null;
82
-    }
83
-    public function newConfig( $_path = "config/") {
84
-      $this->jConfig = new JConfig();
85
-      $this->jConfig->import("${_path}connection.json","connection");
86
-      $this->jConfig->import("${_path}misc.json");
87
-      $this->jConfig->import("${_path}router.json");
88
-    }
4
+	protected $pages;
5
+	protected $defaultPage;
6
+	public $currentPage;
7
+	public $jConfig;
8
+	public function __construct() {
9
+	  parent::__construct();
10
+	  $this->pages = [];
11
+	  $this->defaultPage = ["Page404",[]];
12
+	  $this->currentPage = null;
13
+	  $this->jConfig     = null;
14
+	}
15
+	public function addPage( $_page ) {
16
+	  $param = [];
17
+	  $path  = $_page;
18
+	  $class = $_page;
19
+	  if(is_array($_page)) {
20
+		$path  = $_page[0];
21
+		$class = $_page[1];
22
+		if(isset($_page[2]))
23
+		  $param = $_page[2];
24
+	  }
25
+	  $this->pages[$path] = [$class, $param];
26
+	  return $this->pages[$path];
27
+	}
28
+	public function addPages( $_pages ) {
29
+	  foreach ($_pages as $i)
30
+		$this->addPage($i);
31
+	}
32
+	public function fetchPage() {
33
+	  $router = new Router();
34
+	  $router->parameters = [ "app" => &$this->jConfig, "page" => null];
35
+	  $stack = $router->getPage();
36
+	  $parameters = [];
37
+	  $temp = $this->defaultPage;
38
+	  foreach ($this->pages as $key => $value) {
39
+		$variables = $this->pathSeeker(explode("/", $key), $stack);
40
+		if(is_array($variables)) {
41
+		  $temp = $value;
42
+		  $parameters = $variables;
43
+		  break;
44
+		}
45
+	  }
46
+	  if( isset($temp[1]) && is_array($temp[1]) )
47
+		$temp[1] = array_merge($temp[1], $parameters);
48
+	  else
49
+		$temp[1] = $parameters;
50
+	  $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
51
+	  return $this->currentPage;
52
+	}
53
+	public function setDefaultPage( $_page ) {
54
+	  $this->defaultPage = $this->addPage($_page);
55
+	}
56
+	public function draw() {
57
+	  $this->currentPage->uniforma();
58
+	  $gui = new GUI();
59
+	  $gui->init($this->currentPage);
60
+	  $gui->draw($this->currentPage->data["template"]);
61
+	}
62
+	public function pathSeeker( $_path, $_url ) {
63
+	  $urlLength = count($_url);
64
+	  $cont = 0;
65
+	  $variables = [];
66
+	  $pathLength = count($_path);
67
+	  if($urlLength == $pathLength) {
68
+		while($cont < $urlLength) {
69
+		  if(
70
+			($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
71
+			(!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
72
+			$cont++;
73
+		  else if( strpos($_path[$cont], "\$") !== false ) {
74
+			$variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
75
+			$cont++;
76
+		  } else break;
77
+		}
78
+		if($cont == $urlLength)
79
+		  return $variables;
80
+	  }
81
+	  return null;
82
+	}
83
+	public function newConfig( $_path = "config/") {
84
+	  $this->jConfig = new JConfig();
85
+	  $this->jConfig->import("${_path}connection.json","connection");
86
+	  $this->jConfig->import("${_path}misc.json");
87
+	  $this->jConfig->import("${_path}router.json");
88
+	}
89 89
   }
90 90
 ?>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,49 +8,49 @@  discard block
 block discarded – undo
8 8
     public function __construct() {
9 9
       parent::__construct();
10 10
       $this->pages = [];
11
-      $this->defaultPage = ["Page404",[]];
11
+      $this->defaultPage = ["Page404", []];
12 12
       $this->currentPage = null;
13 13
       $this->jConfig     = null;
14 14
     }
15
-    public function addPage( $_page ) {
15
+    public function addPage($_page) {
16 16
       $param = [];
17 17
       $path  = $_page;
18 18
       $class = $_page;
19
-      if(is_array($_page)) {
19
+      if (is_array($_page)) {
20 20
         $path  = $_page[0];
21 21
         $class = $_page[1];
22
-        if(isset($_page[2]))
22
+        if (isset($_page[2]))
23 23
           $param = $_page[2];
24 24
       }
25 25
       $this->pages[$path] = [$class, $param];
26 26
       return $this->pages[$path];
27 27
     }
28
-    public function addPages( $_pages ) {
28
+    public function addPages($_pages) {
29 29
       foreach ($_pages as $i)
30 30
         $this->addPage($i);
31 31
     }
32 32
     public function fetchPage() {
33 33
       $router = new Router();
34
-      $router->parameters = [ "app" => &$this->jConfig, "page" => null];
34
+      $router->parameters = ["app" => &$this->jConfig, "page" => null];
35 35
       $stack = $router->getPage();
36 36
       $parameters = [];
37 37
       $temp = $this->defaultPage;
38 38
       foreach ($this->pages as $key => $value) {
39 39
         $variables = $this->pathSeeker(explode("/", $key), $stack);
40
-        if(is_array($variables)) {
40
+        if (is_array($variables)) {
41 41
           $temp = $value;
42 42
           $parameters = $variables;
43 43
           break;
44 44
         }
45 45
       }
46
-      if( isset($temp[1]) && is_array($temp[1]) )
46
+      if (isset($temp[1]) && is_array($temp[1]))
47 47
         $temp[1] = array_merge($temp[1], $parameters);
48 48
       else
49 49
         $temp[1] = $parameters;
50 50
       $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
51 51
       return $this->currentPage;
52 52
     }
53
-    public function setDefaultPage( $_page ) {
53
+    public function setDefaultPage($_page) {
54 54
       $this->defaultPage = $this->addPage($_page);
55 55
     }
56 56
     public function draw() {
@@ -59,30 +59,30 @@  discard block
 block discarded – undo
59 59
       $gui->init($this->currentPage);
60 60
       $gui->draw($this->currentPage->data["template"]);
61 61
     }
62
-    public function pathSeeker( $_path, $_url ) {
62
+    public function pathSeeker($_path, $_url) {
63 63
       $urlLength = count($_url);
64 64
       $cont = 0;
65 65
       $variables = [];
66 66
       $pathLength = count($_path);
67
-      if($urlLength == $pathLength) {
68
-        while($cont < $urlLength) {
69
-          if(
67
+      if ($urlLength == $pathLength) {
68
+        while ($cont < $urlLength) {
69
+          if (
70 70
             ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
71 71
             (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
72 72
             $cont++;
73
-          else if( strpos($_path[$cont], "\$") !== false ) {
73
+          else if (strpos($_path[$cont], "\$") !== false) {
74 74
             $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
75 75
             $cont++;
76 76
           } else break;
77 77
         }
78
-        if($cont == $urlLength)
78
+        if ($cont == $urlLength)
79 79
           return $variables;
80 80
       }
81 81
       return null;
82 82
     }
83
-    public function newConfig( $_path = "config/") {
83
+    public function newConfig($_path = "config/") {
84 84
       $this->jConfig = new JConfig();
85
-      $this->jConfig->import("${_path}connection.json","connection");
85
+      $this->jConfig->import("${_path}connection.json", "connection");
86 86
       $this->jConfig->import("${_path}misc.json");
87 87
       $this->jConfig->import("${_path}router.json");
88 88
     }
Please login to merge, or discard this patch.
Braces   +20 added lines, -14 removed lines patch added patch discarded remove patch
@@ -19,15 +19,17 @@  discard block
 block discarded – undo
19 19
       if(is_array($_page)) {
20 20
         $path  = $_page[0];
21 21
         $class = $_page[1];
22
-        if(isset($_page[2]))
23
-          $param = $_page[2];
22
+        if(isset($_page[2])) {
23
+                  $param = $_page[2];
24
+        }
24 25
       }
25 26
       $this->pages[$path] = [$class, $param];
26 27
       return $this->pages[$path];
27 28
     }
28 29
     public function addPages( $_pages ) {
29
-      foreach ($_pages as $i)
30
-        $this->addPage($i);
30
+      foreach ($_pages as $i) {
31
+              $this->addPage($i);
32
+      }
31 33
     }
32 34
     public function fetchPage() {
33 35
       $router = new Router();
@@ -43,10 +45,11 @@  discard block
 block discarded – undo
43 45
           break;
44 46
         }
45 47
       }
46
-      if( isset($temp[1]) && is_array($temp[1]) )
47
-        $temp[1] = array_merge($temp[1], $parameters);
48
-      else
49
-        $temp[1] = $parameters;
48
+      if( isset($temp[1]) && is_array($temp[1]) ) {
49
+              $temp[1] = array_merge($temp[1], $parameters);
50
+      } else {
51
+              $temp[1] = $parameters;
52
+      }
50 53
       $this->currentPage = new $temp[0](["app" => $this->jConfig, "page" => $temp[1]]);
51 54
       return $this->currentPage;
52 55
     }
@@ -68,15 +71,18 @@  discard block
 block discarded – undo
68 71
         while($cont < $urlLength) {
69 72
           if(
70 73
             ($this->jConfig->urlCaseSensitive && $_path[$cont] == $_url[$cont]) ||
71
-            (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) )
72
-            $cont++;
73
-          else if( strpos($_path[$cont], "\$") !== false ) {
74
+            (!$this->jConfig->urlCaseSensitive && strtolower($_path[$cont]) == strtolower($_url[$cont])) ) {
75
+                      $cont++;
76
+          } else if( strpos($_path[$cont], "\$") !== false ) {
74 77
             $variables[str_replace('$', "", $_path[$cont])] = $_url[$cont];
75 78
             $cont++;
76
-          } else break;
79
+          } else {
80
+          	break;
81
+          }
82
+        }
83
+        if($cont == $urlLength) {
84
+                  return $variables;
77 85
         }
78
-        if($cont == $urlLength)
79
-          return $variables;
80 86
       }
81 87
       return null;
82 88
     }
Please login to merge, or discard this patch.