Passed
Push — main ( ca0571...5ee2f7 )
by Thierry
03:43
created
jaxon-core/src/App/PageDatabagTrait.php 2 patches
Switch Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,81 +6,81 @@
 block discarded – undo
6 6
 
7 7
 trait PageDatabagTrait
8 8
 {
9
-    /**
9
+/**
10 10
      * The current page number.
11 11
      *
12 12
      * @var int
13 13
      */
14
-    private int $currentPage = 1;
14
+private int $currentPage = 1;
15 15
 
16
-    /**
16
+/**
17 17
      * Get the pagination databag name.
18 18
      *
19 19
      * @return string
20 20
      */
21
-    abstract protected function bagName(): string;
21
+abstract protected function bagName(): string;
22 22
 
23
-    /**
23
+/**
24 24
      * Get the pagination databag attribute.
25 25
      *
26 26
      * @return string
27 27
      */
28
-    abstract protected function bagAttr(): string;
28
+abstract protected function bagAttr(): string;
29 29
 
30
-    /**
30
+/**
31 31
      * Get the page number.
32 32
      *
33 33
      * @param int $pageNumber
34 34
      *
35 35
      * @return int
36 36
      */
37
-    private function getPageNumber(int $pageNumber): int
38
-    {
39
-        // If no page number is provided, then get the value from the databag.
40
-        return $pageNumber > 0 ? $pageNumber :
41
-            (int)$this->bag($this->bagName())->get($this->bagAttr(), 1);
42
-    }
37
+private function getPageNumber(int $pageNumber): int
38
+{
39
+// If no page number is provided, then get the value from the databag.
40
+return $pageNumber > 0 ? $pageNumber :
41
+(int)$this->bag($this->bagName())->get($this->bagAttr(), 1);
42
+}
43 43
 
44
-    /**
44
+/**
45 45
      * Set the page number.
46 46
      *
47 47
      * @param int $currentPage
48 48
      *
49 49
      * @return void
50 50
      */
51
-    private function setCurrentPage(int $currentPage): void
52
-    {
53
-        // Save the current page in the databag.
54
-        $this->bag($this->bagName())->set($this->bagAttr(), $currentPage);
55
-        $this->currentPage = $currentPage;
56
-    }
51
+private function setCurrentPage(int $currentPage): void
52
+{
53
+// Save the current page in the databag.
54
+$this->bag($this->bagName())->set($this->bagAttr(), $currentPage);
55
+$this->currentPage = $currentPage;
56
+}
57 57
 
58
-    /**
58
+/**
59 59
      * Get the paginator for the component.
60 60
      *
61 61
      * @param int $pageNumber
62 62
      *
63 63
      * @return Paginator
64 64
      */
65
-    protected function paginator(int $pageNumber): Paginator
66
-    {
67
-        return $this->cl(Component\Pagination::class)
68
-            // Use the js class name as component item identifier.
69
-            ->item($this->rq()->_class())
70
-            ->paginator($this->getPageNumber($pageNumber), $this->limit(), $this->count())
71
-            // This callback will receive the final value of the current page number.
72
-            ->page(function(int $currentPage) {
73
-                $this->setCurrentPage($currentPage);
74
-            });
75
-    }
65
+protected function paginator(int $pageNumber): Paginator
66
+{
67
+return $this->cl(Component\Pagination::class)
68
+// Use the js class name as component item identifier.
69
+->item($this->rq()->_class())
70
+->paginator($this->getPageNumber($pageNumber), $this->limit(), $this->count())
71
+// This callback will receive the final value of the current page number.
72
+->page(function(int $currentPage) {
73
+    $this->setCurrentPage($currentPage);
74
+});
75
+}
76 76
 
77
-    /**
77
+/**
78 78
      * Get the current page number
79 79
      *
80 80
      * @return int
81 81
      */
82
-    protected function currentPage(): int
83
-    {
84
-        return $this->currentPage;
85
-    }
82
+protected function currentPage(): int
83
+{
84
+return $this->currentPage;
85
+}
86 86
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,8 +37,7 @@
 block discarded – undo
37 37
     private function getPageNumber(int $pageNumber): int
38 38
     {
39 39
         // If no page number is provided, then get the value from the databag.
40
-        return $pageNumber > 0 ? $pageNumber :
41
-            (int)$this->bag($this->bagName())->get($this->bagAttr(), 1);
40
+        return $pageNumber > 0 ? $pageNumber : (int)$this->bag($this->bagName())->get($this->bagAttr(), 1);
42 41
     }
43 42
 
44 43
     /**
Please login to merge, or discard this patch.
jaxon-core/src/jaxon_ns.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  */
31 31
 function jaxon(): JaxonLib
32 32
 {
33
-    return JaxonLib::getInstance();
33
+return JaxonLib::getInstance();
34 34
 }
35 35
 
36 36
 /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function cl(string $sClassName): mixed
46 46
 {
47
-    return jaxon()->cdi()->makeComponent($sClassName);
47
+return jaxon()->cdi()->makeComponent($sClassName);
48 48
 }
49 49
 
50 50
 /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function rq(string $sClassName = ''): JxnCall
58 58
 {
59
-    return jaxon()->di()->getCallFactory()->rq($sClassName);
59
+return jaxon()->di()->getCallFactory()->rq($sClassName);
60 60
 }
61 61
 
62 62
 /**
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
  */
69 69
 function jo(string $sJsObject = ''): JsObjectCall
70 70
 {
71
-    return jaxon()->di()->getCallFactory()->jo($sJsObject);
71
+return jaxon()->di()->getCallFactory()->jo($sJsObject);
72 72
 }
73 73
 
74 74
 /**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
  */
82 82
 function jq(string $sPath = '', $xContext = null): JqSelectorCall
83 83
 {
84
-    return jaxon()->di()->getCallFactory()->jq($sPath, $xContext);
84
+return jaxon()->di()->getCallFactory()->jq($sPath, $xContext);
85 85
 }
86 86
 
87 87
 /**
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
  */
94 94
 function je(string $sElementId = ''): JsSelectorCall
95 95
 {
96
-    return jaxon()->di()->getCallFactory()->je($sElementId);
96
+return jaxon()->di()->getCallFactory()->je($sElementId);
97 97
 }
98 98
 
99 99
 /**
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
  */
104 104
 function attr(): HtmlAttrHelper
105 105
 {
106
-    return jaxon()->di()->getHtmlAttrHelper();
106
+return jaxon()->di()->getHtmlAttrHelper();
107 107
 }
108 108
 
109 109
 /**
@@ -114,5 +114,5 @@  discard block
 block discarded – undo
114 114
  */
115 115
 function pm(): ParameterFactory
116 116
 {
117
-    return jaxon()->di()->getParameterFactory();
117
+return jaxon()->di()->getParameterFactory();
118 118
 }
Please login to merge, or discard this patch.
jaxon-core/src/jaxon_fn.php 1 patch
Switch Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,5 +21,5 @@
 block discarded – undo
21 21
  */
22 22
 function jaxon(): Jaxon
23 23
 {
24
-    return Jaxon::getInstance();
24
+return Jaxon::getInstance();
25 25
 }
Please login to merge, or discard this patch.
jaxon-core/src/Exception/Exception.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@
 block discarded – undo
16 16
 
17 17
 class Exception extends \Exception
18 18
 {
19
-    public function __construct(string $sMessage)
20
-    {
21
-        parent::__construct($sMessage);
22
-    }
19
+public function __construct(string $sMessage)
20
+{
21
+parent::__construct($sMessage);
22
+}
23 23
 }
Please login to merge, or discard this patch.
jaxon-core/src/globals.php 1 patch
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  */
33 33
 function cl(string $sClassName): mixed
34 34
 {
35
-    return \Jaxon\cl($sClassName);
35
+return \Jaxon\cl($sClassName);
36 36
 }
37 37
 
38 38
 /**
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
  */
45 45
 function rq(string $sClassName = ''): JxnCall
46 46
 {
47
-    return \Jaxon\rq($sClassName);
47
+return \Jaxon\rq($sClassName);
48 48
 }
49 49
 
50 50
 /**
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
  */
57 57
 function jo(string $sJsObject = ''): JsObjectCall
58 58
 {
59
-    return \Jaxon\jo($sJsObject);
59
+return \Jaxon\jo($sJsObject);
60 60
 }
61 61
 
62 62
 /**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  */
70 70
 function jq(string $sPath = '', $xContext = null): JqSelectorCall
71 71
 {
72
-    return \Jaxon\jq($sPath, $xContext);
72
+return \Jaxon\jq($sPath, $xContext);
73 73
 }
74 74
 
75 75
 /**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
  */
82 82
 function je(string $sElementId = ''): JsSelectorCall
83 83
 {
84
-    return \Jaxon\je($sElementId);
84
+return \Jaxon\je($sElementId);
85 85
 }
86 86
 
87 87
 /**
@@ -91,5 +91,5 @@  discard block
 block discarded – undo
91 91
  */
92 92
 function attr(): HtmlAttrHelper
93 93
 {
94
-    return \Jaxon\attr();
94
+return \Jaxon\attr();
95 95
 }
Please login to merge, or discard this patch.
jaxon-core/src/Request/TargetInterface.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@
 block discarded – undo
4 4
 
5 5
 interface TargetInterface
6 6
 {
7
-    /**
7
+/**
8 8
      * The target method name.
9 9
      *
10 10
      * @return string
11 11
      */
12
-    public function method(): string;
12
+public function method(): string;
13 13
 
14
-    /**
14
+/**
15 15
      * The target method args.
16 16
      *
17 17
      * @return array
18 18
      */
19
-    public function args(): array;
19
+public function args(): array;
20 20
 }
Please login to merge, or discard this patch.
jaxon-core/src/Request/Validator.php 1 patch
Switch Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -29,73 +29,73 @@
 block discarded – undo
29 29
 
30 30
 class Validator
31 31
 {
32
-    /**
32
+/**
33 33
      * The config manager
34 34
      *
35 35
      * @var ConfigManager
36 36
      */
37
-    protected $xConfigManager;
37
+protected $xConfigManager;
38 38
 
39
-    /**
39
+/**
40 40
      * The translator
41 41
      *
42 42
      * @var Translator
43 43
      */
44
-    protected $xTranslator;
44
+protected $xTranslator;
45 45
 
46
-    public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
47
-    {
48
-        // Set the config manager
49
-        $this->xConfigManager = $xConfigManager;
50
-        // Set the translator
51
-        $this->xTranslator = $xTranslator;
52
-    }
46
+public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
47
+{
48
+// Set the config manager
49
+$this->xConfigManager = $xConfigManager;
50
+// Set the translator
51
+$this->xTranslator = $xTranslator;
52
+}
53 53
 
54
-    /**
54
+/**
55 55
      * Validate a function name
56 56
      *
57 57
      * @param string $sName    The function name
58 58
      *
59 59
      * @return bool
60 60
      */
61
-    public function validateFunction(string $sName): bool
62
-    {
63
-        return preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $sName) > 0;
64
-    }
61
+public function validateFunction(string $sName): bool
62
+{
63
+return preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $sName) > 0;
64
+}
65 65
 
66
-    /**
66
+/**
67 67
      * Validate a class name
68 68
      *
69 69
      * @param string $sName    The class name
70 70
      *
71 71
      * @return bool
72 72
      */
73
-    public function validateJsObject(string $sName): bool
74
-    {
75
-        return preg_match('/^([a-zA-Z][a-zA-Z0-9_]*)(\.[a-zA-Z][a-zA-Z0-9_]*)*$/', $sName) > 0;
76
-    }
73
+public function validateJsObject(string $sName): bool
74
+{
75
+return preg_match('/^([a-zA-Z][a-zA-Z0-9_]*)(\.[a-zA-Z][a-zA-Z0-9_]*)*$/', $sName) > 0;
76
+}
77 77
 
78
-    /**
78
+/**
79 79
      * Validate a class name
80 80
      *
81 81
      * @param string $sName    The class name
82 82
      *
83 83
      * @return bool
84 84
      */
85
-    public function validateClass(string $sName): bool
86
-    {
87
-        return preg_match('/^([a-zA-Z][a-zA-Z0-9_]*)(\\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sName) > 0;
88
-    }
85
+public function validateClass(string $sName): bool
86
+{
87
+return preg_match('/^([a-zA-Z][a-zA-Z0-9_]*)(\\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sName) > 0;
88
+}
89 89
 
90
-    /**
90
+/**
91 91
      * Validate a method name
92 92
      *
93 93
      * @param string $sName    The function name
94 94
      *
95 95
      * @return bool
96 96
      */
97
-    public function validateMethod(string $sName): bool
98
-    {
99
-        return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sName) > 0;
100
-    }
97
+public function validateMethod(string $sName): bool
98
+{
99
+return preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sName) > 0;
100
+}
101 101
 }
Please login to merge, or discard this patch.
jaxon-core/src/Request/Handler/Psr/PsrAjaxMiddleware.php 2 patches
Switch Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -25,54 +25,54 @@
 block discarded – undo
25 25
 
26 26
 class PsrAjaxMiddleware implements MiddlewareInterface
27 27
 {
28
-    /**
28
+/**
29 29
      * @var Container
30 30
      */
31
-    private $di;
31
+private $di;
32 32
 
33
-    /**
33
+/**
34 34
      * @var RequestHandler
35 35
      */
36
-    private $xRequestHandler;
36
+private $xRequestHandler;
37 37
 
38
-    /**
38
+/**
39 39
      * @var ResponseManager
40 40
      */
41
-    private $xResponseManager;
41
+private $xResponseManager;
42 42
 
43
-    /**
43
+/**
44 44
      * The constructor
45 45
      *
46 46
      * @param Container $di
47 47
      * @param RequestHandler $xRequestHandler
48 48
      * @param ResponseManager $xResponseManager
49 49
      */
50
-    public function __construct(Container $di, RequestHandler $xRequestHandler, ResponseManager $xResponseManager)
51
-    {
52
-        $this->di = $di;
53
-        $this->xRequestHandler = $xRequestHandler;
54
-        $this->xResponseManager = $xResponseManager;
55
-    }
50
+public function __construct(Container $di, RequestHandler $xRequestHandler, ResponseManager $xResponseManager)
51
+{
52
+$this->di = $di;
53
+$this->xRequestHandler = $xRequestHandler;
54
+$this->xResponseManager = $xResponseManager;
55
+}
56 56
 
57
-    /**
57
+/**
58 58
      * @inheritDoc
59 59
      * @throws RequestException
60 60
      */
61
-    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
62
-    {
63
-        // Save the request in the container. This will override the default request,
64
-        // and the other classes will get this request from there.
65
-        $this->di->val(ServerRequestInterface::class, $request);
61
+public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
62
+{
63
+// Save the request in the container. This will override the default request,
64
+// and the other classes will get this request from there.
65
+$this->di->val(ServerRequestInterface::class, $request);
66 66
 
67
-        if(!$this->xRequestHandler->canProcessRequest())
68
-        {
69
-            // Unable to find a plugin to process the request
70
-            return $handler->handle($request);
71
-        }
67
+if(!$this->xRequestHandler->canProcessRequest())
68
+{
69
+// Unable to find a plugin to process the request
70
+return $handler->handle($request);
71
+}
72 72
 
73
-        // Process the request
74
-        $this->xRequestHandler->processRequest();
75
-        // Return a Psr7 response
76
-        return $this->xResponseManager->getResponse()->toPsr();
77
-    }
73
+// Process the request
74
+$this->xRequestHandler->processRequest();
75
+// Return a Psr7 response
76
+return $this->xResponseManager->getResponse()->toPsr();
77
+}
78 78
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
         // and the other classes will get this request from there.
65 65
         $this->di->val(ServerRequestInterface::class, $request);
66 66
 
67
-        if(!$this->xRequestHandler->canProcessRequest())
67
+        if (!$this->xRequestHandler->canProcessRequest())
68 68
         {
69 69
             // Unable to find a plugin to process the request
70 70
             return $handler->handle($request);
Please login to merge, or discard this patch.
jaxon-core/src/Request/Handler/Psr/PsrConfigMiddleware.php 1 patch
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -23,37 +23,37 @@
 block discarded – undo
23 23
 
24 24
 class PsrConfigMiddleware implements MiddlewareInterface
25 25
 {
26
-    /**
26
+/**
27 27
      * @var Container
28 28
      */
29
-    protected $di;
29
+protected $di;
30 30
 
31
-    /**
31
+/**
32 32
      * @var string
33 33
      */
34
-    protected $sConfigFile;
34
+protected $sConfigFile;
35 35
 
36
-    /**
36
+/**
37 37
      * The constructor
38 38
      *
39 39
      * @param Container $di
40 40
      * @param string $sConfigFile
41 41
      */
42
-    public function __construct(Container $di, string $sConfigFile)
43
-    {
44
-        $this->di = $di;
45
-        $this->sConfigFile = $sConfigFile;
46
-    }
42
+public function __construct(Container $di, string $sConfigFile)
43
+{
44
+$this->di = $di;
45
+$this->sConfigFile = $sConfigFile;
46
+}
47 47
 
48
-    /**
48
+/**
49 49
      * @inheritDoc
50 50
      * @throws SetupException
51 51
      */
52
-    public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
53
-    {
54
-        // Load the config
55
-        $this->di->getApp()->setup($this->sConfigFile);
56
-        // Next
57
-        return $handler->handle($request);
58
-    }
52
+public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
53
+{
54
+// Load the config
55
+$this->di->getApp()->setup($this->sConfigFile);
56
+// Next
57
+return $handler->handle($request);
58
+}
59 59
 }
Please login to merge, or discard this patch.