Test Failed
Push — master ( ce85a8...f19bfa )
by Federico
02:31
created
dist/jate/functions/array.php 2 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.
Spacing   +13 added lines, -13 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,19 +33,19 @@  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" );
42
-      else if(is_object($i))
40
+      if (is_array($i))
41
+        arrayDump($i, $k, "&nbsp;&nbsp;$_tab");
42
+      else if (is_object($i))
43 43
         echo "$_tab<b>object:</b> [Object]<br>";
44 44
       else
45 45
         echo "$_tab<b>$k:</b> $i<br>";
46 46
   }
47 47
 
48
-  function htmlParser( $_str) {
48
+  function htmlParser($_str) {
49 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/folder.php 2 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.
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.
dist/jate/modules/Connection/Adapters/ConnectionInterface.php 2 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.
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.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-  if(!isset($GLOBALS["JATEPath"]))
2
+  if (!isset($GLOBALS["JATEPath"]))
3 3
     $GLOBALS["JATEPath"] = [];
4 4
   $commonLocations = [
5 5
       "bower_components/JATE/dist/"
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
   ];
11 11
   $jSuccess = false;
12 12
   foreach ($commonLocations as $path)
13
-    if(file_exists("${path}jate/coreEngine.php")) {
13
+    if (file_exists("${path}jate/coreEngine.php")) {
14 14
       array_push($GLOBALS["JATEPath"], $path);
15 15
       require_once("${path}jate/coreEngine.php");
16 16
       $jSuccess = true;
17 17
       break;
18 18
     }
19
-  if( !$jSuccess )
19
+  if (!$jSuccess)
20 20
     throw new Exception("JATE can't find coreEngine.php.");
21 21
 ?>
Please login to merge, or discard this patch.
dist/jate/functions/requirer.php 2 patches
Doc Comments   +11 added lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
+  /**
3
+   * @param string $_path
4
+   */
2 5
   function requireComponent( $_path, $_local = true ) {
3 6
     $path = getJFolder($_path, $_local, debug_backtrace());
4 7
     if(file_exists($path) && isPhp($path))
@@ -26,6 +29,10 @@  discard block
 block discarded – undo
26 29
     $info = pathinfo($_file);
27 30
     return ($info["extension"] == "php") || ($info["extension"] == "PHP");
28 31
   }
32
+
33
+  /**
34
+   * @param string $_path
35
+   */
29 36
   function requireModules( $_path, $_local = true ) {
30 37
     $path = getJFolder($_path, $_local, debug_backtrace());
31 38
     $subFolders = subFolderDir($path);
@@ -36,6 +43,10 @@  discard block
 block discarded – undo
36 43
     $path = getJFolder($_path, $_local, debug_backtrace());
37 44
     require_once( $path );
38 45
   }
46
+
47
+  /**
48
+   * @param boolean $_local
49
+   */
39 50
   function getJFolder( $_path, $_local, $_stack ) {
40 51
     if($_local) {
41 52
       $stackInfo = $_stack;
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,43 +1,43 @@  discard block
 block discarded – undo
1 1
 <?php
2
-  function requireComponent( $_path, $_local = true ) {
2
+  function requireComponent($_path, $_local = true) {
3 3
     $path = getJFolder($_path, $_local, debug_backtrace());
4
-    if(file_exists($path) && isPhp($path))
4
+    if (file_exists($path) && isPhp($path))
5 5
       jRequire($path, false, 0);
6 6
     else
7 7
       requireError($_path);
8 8
   }
9
-  function requireComponents( $_path, $_local = true ) {
9
+  function requireComponents($_path, $_local = true) {
10 10
     $path = getJFolder($_path, $_local, debug_backtrace());
11
-    if(file_exists($path)) {
11
+    if (file_exists($path)) {
12 12
       $files = subFolderFile($path);
13 13
       foreach ($files as $i)
14
-        if(isPhp("$path/$i"))
14
+        if (isPhp("$path/$i"))
15 15
           requireComponent($path."/".$i, false);
16 16
     } else
17 17
       requireError($_path);
18 18
   }
19
-  function requireError( $_path ) {
19
+  function requireError($_path) {
20 20
     global $DEBUG;
21
-    if( $DEBUG == 1 )
21
+    if ($DEBUG == 1)
22 22
       echo "Error load ($_path)<br>";
23 23
   }
24
-  function isPhp ( $_file ) {
25
-    if(!is_file($_file)) return false;
24
+  function isPhp($_file) {
25
+    if (!is_file($_file)) return false;
26 26
     $info = pathinfo($_file);
27 27
     return ($info["extension"] == "php") || ($info["extension"] == "PHP");
28 28
   }
29
-  function requireModules( $_path, $_local = true ) {
29
+  function requireModules($_path, $_local = true) {
30 30
     $path = getJFolder($_path, $_local, debug_backtrace());
31 31
     $subFolders = subFolderDir($path);
32 32
     foreach ($subFolders as $i)
33 33
       requireComponents("$path/$i", false);
34 34
   }
35
-  function jRequire( $_path, $_local = true ) {
35
+  function jRequire($_path, $_local = true) {
36 36
     $path = getJFolder($_path, $_local, debug_backtrace());
37
-    require_once( $path );
37
+    require_once($path);
38 38
   }
39
-  function getJFolder( $_path, $_local, $_stack ) {
40
-    if($_local) {
39
+  function getJFolder($_path, $_local, $_stack) {
40
+    if ($_local) {
41 41
       $stackInfo = $_stack;
42 42
       $folder = dirname($stackInfo[0]["file"]);
43 43
       $file = "$folder/$_path";
@@ -45,15 +45,15 @@  discard block
 block discarded – undo
45 45
       $file = $_path;
46 46
     return $file;
47 47
   }
48
-  function requireModulesList( $_path ) {
49
-    if(!file_exists($_path))
48
+  function requireModulesList($_path) {
49
+    if (!file_exists($_path))
50 50
       return;
51 51
     $data = file_get_contents($_path);
52 52
     $data = json_decode($data);
53
-    if($data === NULL)
53
+    if ($data === NULL)
54 54
       throw new Exception("Error in the file format [$_path]", 1);
55 55
     foreach ($data as $item) {
56
-      if(substr($item, -1) == "*")
56
+      if (substr($item, -1) == "*")
57 57
         requireModules(substr($item, 0, -2), false);
58 58
       else {
59 59
         $path = getJFolder($item, false, debug_backtrace());
Please login to merge, or discard this patch.
dist/jate/functions/block.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -9,6 +9,9 @@
 block discarded – undo
9 9
     return jBlockEnd($_type, $_parameters);
10 10
   }
11 11
 
12
+  /**
13
+   * @param string $_path
14
+   */
12 15
   function jBlockFile( $_path, $_parameters = [] ) {
13 16
     try {
14 17
       $temp = Parser::parseFile($_path, $_parameters);
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -5,11 +5,11 @@  discard block
 block discarded – undo
5 5
     return ob_start();
6 6
   }
7 7
 
8
-  function jBlockClose( $_type = "html", $_parameters = [] ) {
8
+  function jBlockClose($_type = "html", $_parameters = []) {
9 9
     return jBlockEnd($_type, $_parameters);
10 10
   }
11 11
 
12
-  function jBlockFile( $_path, $_parameters = [] ) {
12
+  function jBlockFile($_path, $_parameters = []) {
13 13
     try {
14 14
       $temp = Parser::parseFile($_path, $_parameters);
15 15
     } catch (Exception $e) {
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     return $temp;
19 19
   }
20 20
 
21
-  function jBlockFileMan( $_path, $_type, $_parameters = [] ) {
21
+  function jBlockFileMan($_path, $_type, $_parameters = []) {
22 22
     try {
23 23
       $temp = Parser::parseFileMan($_path, $_parameters, $_type);
24 24
     } catch (Exception $e) {
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     return $temp;
28 28
   }
29 29
 
30
-  function jBlockEnd( $_type = "html", $_parameters = [] ) {
30
+  function jBlockEnd($_type = "html", $_parameters = []) {
31 31
     $text = ob_get_clean();
32 32
     try {
33 33
       $temp = Parser::parseText($text, $_parameters, $_type);
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
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)
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 44
       $_buffer = preg_replace($search, $replace, utf8_decode($_buffer));
45 45
     return utf8_encode($_buffer);
46 46
   }
Please login to merge, or discard this patch.
dist/jate/functions/errorHandler.php 1 patch
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -1,4 +1,7 @@
 block discarded – undo
1 1
 <?php
2
+  /**
3
+   * @param integer $number
4
+   */
2 5
   function jateErrorHandler($number, $message, $file, $line) {
3 6
     if (!(error_reporting() & $number)) {
4 7
       return false;
Please login to merge, or discard this patch.
dist/jate/modules/Connection/Connection.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -3,6 +3,10 @@
 block discarded – undo
3 3
   class Connection {
4 4
     public $database;
5 5
     public $info;
6
+
7
+    /**
8
+     * @param JConfig $_object
9
+     */
6 10
     public function __construct( $_object ) {
7 11
       if(!is_object($_object))
8 12
         throw new InvalidArgumentException("Parameter must be an object.");
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@  discard block
 block discarded – undo
3 3
   class Connection {
4 4
     public $database;
5 5
     public $info;
6
-    public function __construct( $_object ) {
7
-      if(!is_object($_object))
6
+    public function __construct($_object) {
7
+      if (!is_object($_object))
8 8
         throw new InvalidArgumentException("Parameter must be an object.");
9 9
       $this->setConnection(
10 10
         $_object->server,
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
         $this->getConnectionType($_object->engine)
15 15
       );
16 16
     }
17
-    protected function setConnection ( $_srv, $_db, $_usr, $_pass, $_type ) {
17
+    protected function setConnection($_srv, $_db, $_usr, $_pass, $_type) {
18 18
       switch ($_type) {
19 19
         case "mysqli":
20 20
           $this->database = new MysqliAdapter($_srv, $_db, $_usr, $_pass);
@@ -38,10 +38,10 @@  discard block
 block discarded – undo
38 38
         "type" => $_type
39 39
       ];
40 40
     }
41
-    protected function getConnectionType( $_type ) {
42
-      $array = (array)$_type;
41
+    protected function getConnectionType($_type) {
42
+      $array = (array) $_type;
43 43
       foreach ($array as $key => $value)
44
-        if($value)
44
+        if ($value)
45 45
           return $key;
46 46
       return "pdo";
47 47
     }
Please login to merge, or discard this patch.
dist/jate/modules/File/File.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -47,6 +47,10 @@
 block discarded – undo
47 47
       if(!(file_exists($_file) || $this->isCorrectUrl($_file)))
48 48
         throw new JException("File [$_file] not found.");
49 49
     }
50
+
51
+    /**
52
+     * @param string $_url
53
+     */
50 54
     protected function isCorrectUrl( $_url ) {
51 55
       return strpos(@get_headers($_url)[0],'200') === false ? false : true;
52 56
     }
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,30 +7,30 @@  discard block
 block discarded – undo
7 7
         "attached" => []
8 8
       ];
9 9
     }
10
-    public function addFile( $_file ) {
10
+    public function addFile($_file) {
11 11
       try {
12 12
       $this->isCorrectPath($_file);
13
-      } catch( Exception $e) {
13
+      } catch (Exception $e) {
14 14
         throw new JException($e->getMessage());
15 15
       }
16 16
       $this->files["attached"][] = $_file;
17 17
     }
18
-    public function addFileRequired( $_file ) {
18
+    public function addFileRequired($_file) {
19 19
       try {
20 20
         $this->isCorrectPath($_file);
21
-      } catch( Exception $e) {
21
+      } catch (Exception $e) {
22 22
         throw new JException($e->getMessage());
23 23
       }
24 24
       $this->files["required"][] = $_file;
25 25
     }
26
-    public function addFiles( $_files ) {
27
-      if(!is_array($_files))
26
+    public function addFiles($_files) {
27
+      if (!is_array($_files))
28 28
         throw new JException("Parameter must be an array.");
29 29
       foreach ($_files as $value)
30 30
         $this->addFile($value);
31 31
     }
32
-    public function addFilesRequired( $_files ) {
33
-      if(!is_array($_files))
32
+    public function addFilesRequired($_files) {
33
+      if (!is_array($_files))
34 34
         throw new JException("Parameter must be an array.");
35 35
       foreach ($_files as $value)
36 36
         $this->addFileRequired($value);
@@ -41,14 +41,14 @@  discard block
 block discarded – undo
41 41
     public function getFilesRequired() {
42 42
       return $this->files["required"];
43 43
     }
44
-    protected function isCorrectPath( $_file ) {
45
-      if(!is_string($_file))
44
+    protected function isCorrectPath($_file) {
45
+      if (!is_string($_file))
46 46
         throw new JException("Path must be a string.");
47
-      if(!(file_exists($_file) || $this->isCorrectUrl($_file)))
47
+      if (!(file_exists($_file) || $this->isCorrectUrl($_file)))
48 48
         throw new JException("File [$_file] not found.");
49 49
     }
50
-    protected function isCorrectUrl( $_url ) {
51
-      return strpos(@get_headers($_url)[0],'200') === false ? false : true;
50
+    protected function isCorrectUrl($_url) {
51
+      return strpos(@get_headers($_url)[0], '200') === false ? false : true;
52 52
     }
53 53
   }
54 54
 ?>
Please login to merge, or discard this patch.