Completed
Push — master ( f813e0...5f1c56 )
by Thierry
03:59 queued 02:07
created
src/Utils/Config/Config.php 1 patch
Spacing   +9 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,14 +50,14 @@  discard block
 block discarded – undo
50 50
         $sPrefix = trim((string)$sPrefix);
51 51
         $nDepth = intval($nDepth);
52 52
         // Check the max depth
53
-        if($nDepth < 0 || $nDepth > 9)
53
+        if ($nDepth < 0 || $nDepth > 9)
54 54
         {
55 55
             throw new \Jaxon\Exception\Config\Data(jaxon_trans('config.errors.data.depth',
56 56
                 array('key' => $sPrefix, 'depth' => $nDepth)));
57 57
         }
58
-        foreach($aOptions as $sName => $xOption)
58
+        foreach ($aOptions as $sName => $xOption)
59 59
         {
60
-            if(is_int($sName))
60
+            if (is_int($sName))
61 61
             {
62 62
                 continue;
63 63
             }
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
             // Save the value of this option
68 68
             $this->aOptions[$sFullName] = $xOption;
69 69
             // Save the values of its sub-options
70
-            if(is_array($xOption))
70
+            if (is_array($xOption))
71 71
             {
72 72
                 // Recursively read the options in the array
73 73
                 $this->_setOptions($xOption, $sFullName, $nDepth + 1);
@@ -89,9 +89,9 @@  discard block
 block discarded – undo
89 89
         $aKeys = explode('.', (string)$sKeys);
90 90
         foreach ($aKeys as $sKey)
91 91
         {
92
-            if(($sKey))
92
+            if (($sKey))
93 93
             {
94
-                if(!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey]))
94
+                if (!array_key_exists($sKey, $aOptions) || !is_array($aOptions[$sKey]))
95 95
                 {
96 96
                     return;
97 97
                 }
@@ -139,13 +139,12 @@  discard block
 block discarded – undo
139 139
         $sPrefix = rtrim($sPrefix, '.') . '.';
140 140
         $sPrefixLen = strlen($sPrefix);
141 141
         $aOptions = array();
142
-        foreach($this->aOptions as $sName => $xValue)
142
+        foreach ($this->aOptions as $sName => $xValue)
143 143
         {
144
-            if(substr($sName, 0, $sPrefixLen) == $sPrefix)
144
+            if (substr($sName, 0, $sPrefixLen) == $sPrefix)
145 145
             {
146 146
                 $iNextDotPos = strpos($sName, '.', $sPrefixLen);
147
-                $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) :
148
-                    substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen);
147
+                $sOptionName = $iNextDotPos === false ? substr($sName, $sPrefixLen) : substr($sName, $sPrefixLen, $iNextDotPos - $sPrefixLen);
149 148
                 $aOptions[$sOptionName] = $sPrefix . $sOptionName;
150 149
             }
151 150
         }
Please login to merge, or discard this patch.
src/Traits/Autoload.php 1 patch
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,6 @@
 block discarded – undo
19 19
 
20 20
 namespace Jaxon\Traits;
21 21
 
22
-use Jaxon\Utils\Container;
23
-
24 22
 trait Autoload
25 23
 {
26 24
     /**
Please login to merge, or discard this patch.
src/Traits/Config.php 2 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
      * @param string        $sLibKey            The key of the library options in the file
70 70
      * @param string|null   $sAppKey            The key of the application options in the file
71 71
      *
72
-     * @return array
72
+     * @return null|\Jaxon\Utils\Config\Config
73 73
      */
74 74
     public function readPhpConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
75 75
     {
@@ -83,7 +83,7 @@  discard block
 block discarded – undo
83 83
      * @param string        $sLibKey            The key of the library options in the file
84 84
      * @param string|null   $sAppKey            The key of the application options in the file
85 85
      *
86
-     * @return array
86
+     * @return null|\Jaxon\Utils\Config\Config
87 87
      */
88 88
     public function readYamlConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
89 89
     {
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
      * @param string        $sLibKey            The key of the library options in the file
98 98
      * @param string|null   $sAppKey            The key of the application options in the file
99 99
      *
100
-     * @return array
100
+     * @return \Jaxon\Utils\Config\Config|null
101 101
      */
102 102
     public function readJsonConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
103 103
     {
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
      * @param string        $sLibKey            The key of the library options in the file
112 112
      * @param string|null   $sAppKey            The key of the application options in the file
113 113
      *
114
-     * @return array
114
+     * @return null|\Jaxon\Utils\Config\Config
115 115
      */
116 116
     public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
117 117
     {
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
             'core.prefix.event'                 => 'jaxon_event_',
44 44
             // 'core.request.uri'               => '',
45 45
             'core.request.mode'                 => 'asynchronous',
46
-            'core.request.method'               => 'POST',    // W3C: Method is case sensitive
46
+            'core.request.method'               => 'POST', // W3C: Method is case sensitive
47 47
             'core.debug.on'                     => false,
48 48
             'core.debug.verbose'                => false,
49 49
             'core.process.exit'                 => true,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     public function readConfigFile($sConfigFile, $sLibKey = '', $sAppKey = null)
117 117
     {
118 118
         $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION);
119
-        switch($sExt)
119
+        switch ($sExt)
120 120
         {
121 121
         case 'php':
122 122
             return $this->readPhpConfigFile($sConfigFile, $sLibKey, $sAppKey);
Please login to merge, or discard this patch.
src/Traits/Plugin.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@
 block discarded – undo
31 31
      * - 1000 thru 8999: User created plugins, typically, these plugins don't care about order
32 32
      * - 9000 thru 9999: Plugins that generally need to be last or near the end of the plugin list
33 33
      *
34
-     * @param Plugin         $xPlugin               An instance of a plugin
34
+     * @param \Jaxon\Plugin\Plugin         $xPlugin               An instance of a plugin
35 35
      * @param integer        $nPriority             The plugin priority, used to order the plugins
36 36
      *
37 37
      * @return void
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,6 @@
 block discarded – undo
19 19
 
20 20
 namespace Jaxon\Traits;
21 21
 
22
-use Jaxon\Utils\Container;
23
-
24 22
 trait Plugin
25 23
 {
26 24
     /**
Please login to merge, or discard this patch.
src/Traits/Upload.php 5 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@
 block discarded – undo
46 46
    /**
47 47
      * Check uploaded files validity and move them to the user dir
48 48
      *
49
-     * @return boolean
49
+     * @return null|boolean
50 50
      */
51 51
     public function saveUploadedFiles()
52 52
     {
Please login to merge, or discard this patch.
Unused Use Statements   -5 removed lines patch added patch discarded remove patch
@@ -19,11 +19,6 @@
 block discarded – undo
19 19
 
20 20
 namespace Jaxon\Traits;
21 21
 
22
-use Jaxon\Plugin\Manager as PluginManager;
23
-use Jaxon\Request\Manager as RequestManager;
24
-use Jaxon\Response\Manager as ResponseManager;
25
-
26
-use Jaxon\Utils\URI;
27 22
 use Exception;
28 23
 use Closure;
29 24
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 
30 30
 trait Upload
31 31
 {
32
-   /**
32
+    /**
33 33
      * Check if uploaded files are available
34 34
      *
35 35
      * @return boolean
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         return $xUploadPlugin->canProcessRequest();
44 44
     }
45 45
 
46
-   /**
46
+    /**
47 47
      * Check uploaded files validity and move them to the user dir
48 48
      *
49 49
      * @return boolean
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
      */
37 37
     public function hasUploadedFiles()
38 38
     {
39
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
39
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
40 40
         {
41 41
             return false;
42 42
         }
@@ -52,11 +52,11 @@  discard block
 block discarded – undo
52 52
     {
53 53
         try
54 54
         {
55
-            if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
55
+            if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
56 56
             {
57 57
                 throw new Exception($this->trans('errors.upload.plugin'));
58 58
             }
59
-            elseif(!$xUploadPlugin->canProcessRequest())
59
+            elseif (!$xUploadPlugin->canProcessRequest())
60 60
             {
61 61
                 throw new Exception($this->trans('errors.upload.request'));
62 62
             }
@@ -65,14 +65,14 @@  discard block
 block discarded – undo
65 65
             $sResponse = '{"code": "success", "upl": "' . $sKey . '"}';
66 66
             $return = true;
67 67
         }
68
-        catch(Exception $e)
68
+        catch (Exception $e)
69 69
         {
70 70
             $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}';
71 71
             $return = false;
72 72
         }
73 73
         // Send the response back to the browser
74 74
         echo '<script>var res = ', $sResponse, '; </script>';
75
-        if(($this->getOption('core.process.exit')))
75
+        if (($this->getOption('core.process.exit')))
76 76
         {
77 77
             exit();
78 78
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      */
87 87
     public function getUploadedFiles()
88 88
     {
89
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
89
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
90 90
         {
91 91
             return [];
92 92
         }
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
      */
103 103
     public function setUploadFileFilter(Closure $fFileFilter)
104 104
     {
105
-        if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
105
+        if (($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
106 106
         {
107 107
             return;
108 108
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,7 @@  discard block
 block discarded – undo
55 55
             if(($xUploadPlugin = $this->getPluginManager()->getRequestPlugin(self::FILE_UPLOAD)) == null)
56 56
             {
57 57
                 throw new Exception($this->trans('errors.upload.plugin'));
58
-            }
59
-            elseif(!$xUploadPlugin->canProcessRequest())
58
+            } elseif(!$xUploadPlugin->canProcessRequest())
60 59
             {
61 60
                 throw new Exception($this->trans('errors.upload.request'));
62 61
             }
@@ -64,8 +63,7 @@  discard block
 block discarded – undo
64 63
             $sKey = $xUploadPlugin->saveUploadedFiles();
65 64
             $sResponse = '{"code": "success", "upl": "' . $sKey . '"}';
66 65
             $return = true;
67
-        }
68
-        catch(Exception $e)
66
+        } catch(Exception $e)
69 67
         {
70 68
             $sResponse = '{"code": "error", "msg": "' . addslashes($e->getMessage()) . '"}';
71 69
             $return = false;
Please login to merge, or discard this patch.