Passed
Push — main ( 27211a...7f530d )
by Thierry
03:53
created
jaxon-core/src/App/Databag/Databag.php 1 patch
Switch Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -11,110 +11,110 @@
 block discarded – undo
11 11
 
12 12
 class Databag implements JsonSerializable
13 13
 {
14
-    /**
14
+/**
15 15
      * @var DatabagPlugin
16 16
      */
17
-    protected $xPlugin;
17
+protected $xPlugin;
18 18
 
19
-    /**
19
+/**
20 20
      * @var array
21 21
      */
22
-    protected $aData = [];
22
+protected $aData = [];
23 23
 
24
-    /**
24
+/**
25 25
      * @var bool
26 26
      */
27
-    protected $bTouched = false;
27
+protected $bTouched = false;
28 28
 
29
-    /**
29
+/**
30 30
      * The constructor
31 31
      *
32 32
      * @param array $aData
33 33
      */
34
-    public function __construct(DatabagPlugin $xPlugin, array $aData)
35
-    {
36
-        $this->xPlugin = $xPlugin;
37
-        // Ensure all contents are arrays.
38
-        $this->aData = array_map(function($aValue) {
39
-            return is_array($aValue) ? $aValue : [];
40
-        }, $aData);
41
-    }
34
+public function __construct(DatabagPlugin $xPlugin, array $aData)
35
+{
36
+$this->xPlugin = $xPlugin;
37
+// Ensure all contents are arrays.
38
+$this->aData = array_map(function($aValue) {
39
+return is_array($aValue) ? $aValue : [];
40
+}, $aData);
41
+}
42 42
 
43
-    /**
43
+/**
44 44
      * @return bool
45 45
      */
46
-    public function touched(): bool
47
-    {
48
-        return $this->bTouched;
49
-    }
46
+public function touched(): bool
47
+{
48
+return $this->bTouched;
49
+}
50 50
 
51
-    /**
51
+/**
52 52
      * @return array
53 53
      */
54
-    public function getAll(): array
55
-    {
56
-        return $this->aData;
57
-    }
54
+public function getAll(): array
55
+{
56
+return $this->aData;
57
+}
58 58
 
59
-    /**
59
+/**
60 60
      * @param string $sBag
61 61
      *
62 62
      * @return void
63 63
      */
64
-    public function clear(string $sBag): void
65
-    {
66
-        $this->aData[$sBag] = [];
67
-        $this->xPlugin->addCommand('databag.clear', ['bag' => $sBag]);
68
-    }
64
+public function clear(string $sBag): void
65
+{
66
+$this->aData[$sBag] = [];
67
+$this->xPlugin->addCommand('databag.clear', ['bag' => $sBag]);
68
+}
69 69
 
70
-    /**
70
+/**
71 71
      * @param string $sBag
72 72
      * @param string $sKey
73 73
      * @param mixed $xValue
74 74
      *
75 75
      * @return void
76 76
      */
77
-    public function set(string $sBag, string $sKey, $xValue): void
78
-    {
79
-        $this->bTouched = true;
80
-        $this->aData[$sBag][$sKey] = $xValue;
81
-    }
77
+public function set(string $sBag, string $sKey, $xValue): void
78
+{
79
+$this->bTouched = true;
80
+$this->aData[$sBag][$sKey] = $xValue;
81
+}
82 82
 
83
-    /**
83
+/**
84 84
      * @param string $sBag
85 85
      * @param string $sKey
86 86
      * @param mixed $xValue
87 87
      *
88 88
      * @return void
89 89
      */
90
-    public function new(string $sBag, string $sKey, $xValue): void
91
-    {
92
-        // Set the value only if it doesn't already exist.
93
-        if(!isset($this->aData[$sBag]) || !key_exists($sKey, $this->aData[$sBag]))
94
-        {
95
-            $this->set($sBag, $sKey, $xValue);
96
-        }
97
-    }
90
+public function new(string $sBag, string $sKey, $xValue): void
91
+{
92
+// Set the value only if it doesn't already exist.
93
+if(!isset($this->aData[$sBag]) || !key_exists($sKey, $this->aData[$sBag]))
94
+{
95
+$this->set($sBag, $sKey, $xValue);
96
+}
97
+}
98 98
 
99
-    /**
99
+/**
100 100
      * @param string $sBag
101 101
      * @param string $sKey
102 102
      * @param mixed $xValue
103 103
      *
104 104
      * @return mixed
105 105
      */
106
-    public function get(string $sBag, string $sKey, $xValue = null): mixed
107
-    {
108
-        return $this->aData[$sBag][$sKey] ?? $xValue;
109
-    }
106
+public function get(string $sBag, string $sKey, $xValue = null): mixed
107
+{
108
+return $this->aData[$sBag][$sKey] ?? $xValue;
109
+}
110 110
 
111
-    /**
111
+/**
112 112
      * Convert this call to array, when converting the response into json.
113 113
      *
114 114
      * @return array
115 115
      */
116
-    public function jsonSerialize(): array
117
-    {
118
-        return $this->aData;
119
-    }
116
+public function jsonSerialize(): array
117
+{
118
+return $this->aData;
119
+}
120 120
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Component/ComponentTrait.php 1 patch
Switch Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -14,41 +14,41 @@  discard block
 block discarded – undo
14 14
 
15 15
 trait ComponentTrait
16 16
 {
17
-    /**
17
+/**
18 18
      * Get the component helper
19 19
      *
20 20
      * @return ComponentHelper
21 21
      */
22
-    abstract protected function helper(): ComponentHelper;
22
+abstract protected function helper(): ComponentHelper;
23 23
 
24
-    /**
24
+/**
25 25
      * Get the Ajax response
26 26
      *
27 27
      * @return AjaxResponse
28 28
      */
29
-    abstract protected function response(): AjaxResponse;
29
+abstract protected function response(): AjaxResponse;
30 30
 
31
-    /**
31
+/**
32 32
      * Get the Jaxon request target
33 33
      *
34 34
      * @return TargetInterface|null
35 35
      */
36
-    protected function target(): ?TargetInterface
37
-    {
38
-        return $this->helper()->xTarget;
39
-    }
36
+protected function target(): ?TargetInterface
37
+{
38
+return $this->helper()->xTarget;
39
+}
40 40
 
41
-    /**
41
+/**
42 42
      * Get the temp cache
43 43
      *
44 44
      * @return Stash
45 45
      */
46
-    protected function stash(): Stash
47
-    {
48
-        return $this->helper()->xStash;
49
-    }
46
+protected function stash(): Stash
47
+{
48
+return $this->helper()->xStash;
49
+}
50 50
 
51
-    /**
51
+/**
52 52
      * Get an instance of a Jaxon class by name
53 53
      *
54 54
      * @template T
@@ -57,60 +57,60 @@  discard block
 block discarded – undo
57 57
      * @return T|null
58 58
      * @throws SetupException
59 59
      */
60
-    protected function cl(string $sClassName): mixed
61
-    {
62
-        return $this->helper()->cl($sClassName);
63
-    }
60
+protected function cl(string $sClassName): mixed
61
+{
62
+return $this->helper()->cl($sClassName);
63
+}
64 64
 
65
-    /**
65
+/**
66 66
      * Get the logger
67 67
      *
68 68
      * @return LoggerInterface
69 69
      */
70
-    protected function logger(): LoggerInterface
71
-    {
72
-        return $this->helper()->xLogger;
73
-    }
70
+protected function logger(): LoggerInterface
71
+{
72
+return $this->helper()->xLogger;
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * Get the view renderer
77 77
      *
78 78
      * @return ViewRenderer
79 79
      */
80
-    protected function view(): ViewRenderer
81
-    {
82
-        return $this->helper()->xViewRenderer;
83
-    }
80
+protected function view(): ViewRenderer
81
+{
82
+return $this->helper()->xViewRenderer;
83
+}
84 84
 
85
-    /**
85
+/**
86 86
      * Get the session manager
87 87
      *
88 88
      * @return SessionInterface
89 89
      */
90
-    protected function session(): SessionInterface
91
-    {
92
-        return $this->helper()->xSessionManager;
93
-    }
90
+protected function session(): SessionInterface
91
+{
92
+return $this->helper()->xSessionManager;
93
+}
94 94
 
95
-    /**
95
+/**
96 96
      * Get the uploaded files
97 97
      *
98 98
      * @return array
99 99
      */
100
-    protected function files(): array
101
-    {
102
-        return $this->helper()->xUploadHandler->files();
103
-    }
100
+protected function files(): array
101
+{
102
+return $this->helper()->xUploadHandler->files();
103
+}
104 104
 
105
-    /**
105
+/**
106 106
      * Get a data bag.
107 107
      *
108 108
      * @param string  $sBagName
109 109
      *
110 110
      * @return DatabagContext
111 111
      */
112
-    protected function bag(string $sBagName): DatabagContext
113
-    {
114
-        return $this->response()->bag($sBagName);
115
-    }
112
+protected function bag(string $sBagName): DatabagContext
113
+{
114
+return $this->response()->bag($sBagName);
115
+}
116 116
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/MetadataReaderInterface.php 1 patch
Switch Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@
 block discarded – undo
16 16
 
17 17
 interface MetadataReaderInterface
18 18
 {
19
-    /**
19
+/**
20 20
      * Get the component metadata
21 21
      *
22 22
      * @param InputData $xInput
23 23
      *
24 24
      * @return Metadata
25 25
      */
26
-    public function getAttributes(InputData $xInput): Metadata;
26
+public function getAttributes(InputData $xInput): Metadata;
27 27
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/DatabagData.php 1 patch
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -22,61 +22,61 @@
 block discarded – undo
22 22
 
23 23
 class DatabagData extends AbstractData
24 24
 {
25
-    /**
25
+/**
26 26
      * The databag names
27 27
      *
28 28
      * @var string
29 29
      */
30
-    protected $aNames = [];
30
+protected $aNames = [];
31 31
 
32
-    /**
32
+/**
33 33
      * @return string
34 34
      */
35
-    public function getName(): string
36
-    {
37
-        return 'bags';
38
-    }
35
+public function getName(): string
36
+{
37
+return 'bags';
38
+}
39 39
 
40
-    /**
40
+/**
41 41
      * @return mixed
42 42
      */
43
-    public function getValue(): mixed
44
-    {
45
-        return array_values($this->aNames);
46
-    }
43
+public function getValue(): mixed
44
+{
45
+return array_values($this->aNames);
46
+}
47 47
 
48
-    /**
48
+/**
49 49
      * @param string $sName
50 50
      *
51 51
      * @return void
52 52
      */
53
-    protected function validateName(string $sName): void
54
-    {
55
-        if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0)
56
-        {
57
-            return;
58
-        }
59
-        throw new SetupException("$sName is not a valid \"name\" value for databag");
60
-    }
53
+protected function validateName(string $sName): void
54
+{
55
+if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0)
56
+{
57
+return;
58
+}
59
+throw new SetupException("$sName is not a valid \"name\" value for databag");
60
+}
61 61
 
62
-    /**
62
+/**
63 63
      * @param string $sName
64 64
      *
65 65
      * @return void
66 66
      */
67
-    public function addValue(string $sName): void
68
-    {
69
-        $this->validateName($sName);
67
+public function addValue(string $sName): void
68
+{
69
+$this->validateName($sName);
70 70
 
71
-        $this->aNames[$sName] = $sName;
72
-    }
71
+$this->aNames[$sName] = $sName;
72
+}
73 73
 
74
-    /**
74
+/**
75 75
      * @inheritDoc
76 76
      */
77
-    public function encode(string $sVarName): array
78
-    {
79
-        return array_map(fn($sName) =>
80
-            "{$sVarName}->addValue('$sName');", $this->aNames);
81
-    }
77
+public function encode(string $sVarName): array
78
+{
79
+return array_map(fn($sName) =>
80
+"{$sVarName}->addValue('$sName');", $this->aNames);
81
+}
82 82
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/CallbackData.php 1 patch
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -22,61 +22,61 @@
 block discarded – undo
22 22
 
23 23
 class CallbackData extends AbstractData
24 24
 {
25
-    /**
25
+/**
26 26
      * The callback js objects
27 27
      *
28 28
      * @var string
29 29
      */
30
-    protected $aNames = [];
30
+protected $aNames = [];
31 31
 
32
-    /**
32
+/**
33 33
      * @return string
34 34
      */
35
-    public function getName(): string
36
-    {
37
-        return 'callback';
38
-    }
35
+public function getName(): string
36
+{
37
+return 'callback';
38
+}
39 39
 
40
-    /**
40
+/**
41 41
      * @return mixed
42 42
      */
43
-    public function getValue(): mixed
44
-    {
45
-        return array_values($this->aNames);
46
-    }
43
+public function getValue(): mixed
44
+{
45
+return array_values($this->aNames);
46
+}
47 47
 
48
-    /**
48
+/**
49 49
      * @param string $sName
50 50
      *
51 51
      * @return void
52 52
      */
53
-    protected function validateObjectName(string $sName): void
54
-    {
55
-        if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0)
56
-        {
57
-            return;
58
-        }
59
-        throw new SetupException("$sName is not a valid \"name\" value for callback");
60
-    }
53
+protected function validateObjectName(string $sName): void
54
+{
55
+if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0)
56
+{
57
+return;
58
+}
59
+throw new SetupException("$sName is not a valid \"name\" value for callback");
60
+}
61 61
 
62
-    /**
62
+/**
63 63
      * @param string $sName
64 64
      *
65 65
      * @return void
66 66
      */
67
-    public function addValue(string $sName): void
68
-    {
69
-        $this->validateObjectName($sName);
67
+public function addValue(string $sName): void
68
+{
69
+$this->validateObjectName($sName);
70 70
 
71
-        $this->aNames[$sName] = $sName;
72
-    }
71
+$this->aNames[$sName] = $sName;
72
+}
73 73
 
74
-    /**
74
+/**
75 75
      * @inheritDoc
76 76
      */
77
-    public function encode(string $sVarName): array
78
-    {
79
-        return array_map(fn($sName) =>
80
-            "{$sVarName}->addValue('$sName');", $this->aNames);
81
-    }
77
+public function encode(string $sVarName): array
78
+{
79
+return array_map(fn($sName) =>
80
+"{$sVarName}->addValue('$sName');", $this->aNames);
81
+}
82 82
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Manager/PluginManager.php 1 patch
Switch Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -45,49 +45,49 @@  discard block
 block discarded – undo
45 45
 
46 46
 class PluginManager
47 47
 {
48
-    /**
48
+/**
49 49
      * Request plugins, indexed by name
50 50
      *
51 51
      * @var array<string>
52 52
      */
53
-    private $aRegistryPlugins = [];
53
+private $aRegistryPlugins = [];
54 54
 
55
-    /**
55
+/**
56 56
      * Request handlers, indexed by name
57 57
      *
58 58
      * @var array<string>
59 59
      */
60
-    private $aRequestHandlers = [];
60
+private $aRequestHandlers = [];
61 61
 
62
-    /**
62
+/**
63 63
      * Response plugins, indexed by name
64 64
      *
65 65
      * @var array<string>
66 66
      */
67
-    private $aResponsePlugins = [];
67
+private $aResponsePlugins = [];
68 68
 
69
-    /**
69
+/**
70 70
      * The constructor
71 71
      *
72 72
      * @param Container $di
73 73
      * @param CodeGenerator $xCodeGenerator
74 74
      * @param Translator $xTranslator
75 75
      */
76
-    public function __construct(private Container $di,
77
-        private CodeGenerator $xCodeGenerator, private Translator $xTranslator)
78
-    {}
76
+public function __construct(private Container $di,
77
+private CodeGenerator $xCodeGenerator, private Translator $xTranslator)
78
+{}
79 79
 
80
-    /**
80
+/**
81 81
      * Get the request plugins
82 82
      *
83 83
      * @return array<class-string>
84 84
      */
85
-    public function getRequestHandlers(): array
86
-    {
87
-        return $this->aRequestHandlers;
88
-    }
85
+public function getRequestHandlers(): array
86
+{
87
+return $this->aRequestHandlers;
88
+}
89 89
 
90
-    /**
90
+/**
91 91
      * Register a plugin
92 92
      *
93 93
      * @param class-string $sClassName    The plugin class
@@ -97,40 +97,40 @@  discard block
 block discarded – undo
97 97
      * @return int
98 98
      * @throws SetupException
99 99
      */
100
-    private function _registerPlugin(string $sClassName, string $sPluginName, array $aInterfaces): int
101
-    {
102
-        // Any plugin must implement the PluginInterface interface.
103
-        if(!in_array(PluginInterface::class, $aInterfaces))
104
-        {
105
-            $sMessage = $this->xTranslator->trans('errors.register.invalid', [
106
-                'name' => $sClassName,
107
-            ]);
108
-            throw new SetupException($sMessage);
109
-        }
110
-
111
-        // Response plugin.
112
-        if(in_array(ResponsePluginInterface::class, $aInterfaces))
113
-        {
114
-            $this->aResponsePlugins[$sPluginName] = $sClassName;
115
-            return 1;
116
-        }
117
-
118
-        // Request plugin.
119
-        $nCount = 0;
120
-        if(in_array(CallableRegistryInterface::class, $aInterfaces))
121
-        {
122
-            $this->aRegistryPlugins[$sPluginName] = $sClassName;
123
-            $nCount++;
124
-        }
125
-        if(in_array(RequestHandlerInterface::class, $aInterfaces))
126
-        {
127
-            $this->aRequestHandlers[$sPluginName] = $sClassName;
128
-            $nCount++;
129
-        }
130
-        return $nCount;
131
-    }
132
-
133
-    /**
100
+private function _registerPlugin(string $sClassName, string $sPluginName, array $aInterfaces): int
101
+{
102
+// Any plugin must implement the PluginInterface interface.
103
+if(!in_array(PluginInterface::class, $aInterfaces))
104
+{
105
+$sMessage = $this->xTranslator->trans('errors.register.invalid', [
106
+    'name' => $sClassName,
107
+]);
108
+throw new SetupException($sMessage);
109
+}
110
+
111
+// Response plugin.
112
+if(in_array(ResponsePluginInterface::class, $aInterfaces))
113
+{
114
+$this->aResponsePlugins[$sPluginName] = $sClassName;
115
+return 1;
116
+}
117
+
118
+// Request plugin.
119
+$nCount = 0;
120
+if(in_array(CallableRegistryInterface::class, $aInterfaces))
121
+{
122
+$this->aRegistryPlugins[$sPluginName] = $sClassName;
123
+$nCount++;
124
+}
125
+if(in_array(RequestHandlerInterface::class, $aInterfaces))
126
+{
127
+$this->aRequestHandlers[$sPluginName] = $sClassName;
128
+$nCount++;
129
+}
130
+return $nCount;
131
+}
132
+
133
+/**
134 134
      * Register a plugin
135 135
      *
136 136
      * Below is a table for priorities and their description:
@@ -145,34 +145,34 @@  discard block
 block discarded – undo
145 145
      * @return void
146 146
      * @throws SetupException
147 147
      */
148
-    public function registerPlugin(string $sClassName, string $sPluginName, int $nPriority = 1000): void
149
-    {
150
-        $aInterfaces = class_implements($sClassName);
151
-        $nCount = $this->_registerPlugin($sClassName, $sPluginName, $aInterfaces);
152
-
153
-        // Any plugin can implement the CodeGeneratorInterface interface.
154
-        if(in_array(CodeGeneratorInterface::class, $aInterfaces))
155
-        {
156
-            $this->xCodeGenerator->addCodeGenerator($sClassName, $nPriority);
157
-            $nCount++;
158
-        }
159
-        // The class is not a valid plugin.
160
-        if($nCount === 0)
161
-        {
162
-            $sMessage = $this->xTranslator->trans('errors.register.invalid', [
163
-                'name' => $sClassName,
164
-            ]);
165
-            throw new SetupException($sMessage);
166
-        }
167
-
168
-        // Register the plugin in the DI container, if necessary
169
-        if(!$this->di->has($sClassName))
170
-        {
171
-            $this->di->auto($sClassName);
172
-        }
173
-    }
174
-
175
-    /**
148
+public function registerPlugin(string $sClassName, string $sPluginName, int $nPriority = 1000): void
149
+{
150
+$aInterfaces = class_implements($sClassName);
151
+$nCount = $this->_registerPlugin($sClassName, $sPluginName, $aInterfaces);
152
+
153
+// Any plugin can implement the CodeGeneratorInterface interface.
154
+if(in_array(CodeGeneratorInterface::class, $aInterfaces))
155
+{
156
+$this->xCodeGenerator->addCodeGenerator($sClassName, $nPriority);
157
+$nCount++;
158
+}
159
+// The class is not a valid plugin.
160
+if($nCount === 0)
161
+{
162
+$sMessage = $this->xTranslator->trans('errors.register.invalid', [
163
+    'name' => $sClassName,
164
+]);
165
+throw new SetupException($sMessage);
166
+}
167
+
168
+// Register the plugin in the DI container, if necessary
169
+if(!$this->di->has($sClassName))
170
+{
171
+$this->di->auto($sClassName);
172
+}
173
+}
174
+
175
+/**
176 176
      * Find the specified response plugin by name or class name
177 177
      *
178 178
      * @template R of ResponsePluginInterface
@@ -180,14 +180,14 @@  discard block
 block discarded – undo
180 180
      *
181 181
      * @return ($sName is class-string ? R : ResponsePluginInterface)|null
182 182
      */
183
-    public function getResponsePlugin(string $sName): ?ResponsePluginInterface
184
-    {
185
-        return $this->di->h($sName) ? $this->di->g($sName) :
186
-            (!isset($this->aResponsePlugins[$sName]) ? null :
187
-            $this->di->g($this->aResponsePlugins[$sName]));
188
-    }
189
-
190
-    /**
183
+public function getResponsePlugin(string $sName): ?ResponsePluginInterface
184
+{
185
+return $this->di->h($sName) ? $this->di->g($sName) :
186
+(!isset($this->aResponsePlugins[$sName]) ? null :
187
+$this->di->g($this->aResponsePlugins[$sName]));
188
+}
189
+
190
+/**
191 191
      * Register a callable function or class
192 192
      *
193 193
      * Call the request plugin with the $sType defined as name.
@@ -199,46 +199,46 @@  discard block
 block discarded – undo
199 199
      * @return void
200 200
      * @throws SetupException
201 201
      */
202
-    public function registerCallable(string $sType, string $sCallable, $xOptions = []): void
203
-    {
204
-        if(isset($this->aRegistryPlugins[$sType]) &&
205
-            ($xPlugin = $this->di->g($this->aRegistryPlugins[$sType])))
206
-        {
207
-            $xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions));
208
-            return;
209
-        }
210
-        throw new SetupException($this->xTranslator->trans('errors.register.plugin',
211
-            ['name' => $sType, 'callable' => $sCallable]));
212
-    }
213
-
214
-    /**
202
+public function registerCallable(string $sType, string $sCallable, $xOptions = []): void
203
+{
204
+if(isset($this->aRegistryPlugins[$sType]) &&
205
+($xPlugin = $this->di->g($this->aRegistryPlugins[$sType])))
206
+{
207
+$xPlugin->register($sType, $sCallable, $xPlugin->checkOptions($sCallable, $xOptions));
208
+return;
209
+}
210
+throw new SetupException($this->xTranslator->trans('errors.register.plugin',
211
+['name' => $sType, 'callable' => $sCallable]));
212
+}
213
+
214
+/**
215 215
      * Register the Jaxon request plugins
216 216
      *
217 217
      * @return void
218 218
      * @throws SetupException
219 219
      */
220
-    public function registerPlugins(): void
221
-    {
222
-        // Request plugins
223
-        $this->registerPlugin(CallableClassPlugin::class, Jaxon::CALLABLE_CLASS, 101);
224
-        $this->registerPlugin(CallableFunctionPlugin::class, Jaxon::CALLABLE_FUNCTION, 102);
225
-        $this->registerPlugin(CallableDirPlugin::class, Jaxon::CALLABLE_DIR, 103);
226
-
227
-        // Response plugins
228
-        $this->registerPlugin(ScriptPlugin::class, ScriptPlugin::NAME, 700);
229
-        $this->registerPlugin(DatabagPlugin::class, DatabagPlugin::NAME, 700);
230
-        $this->registerPlugin(DialogPlugin::class, DialogPlugin::NAME, 750);
231
-        $this->registerPlugin(PaginatorPlugin::class, PaginatorPlugin::NAME, 800);
232
-        $this->registerPlugin(PsrPlugin::class, PsrPlugin::NAME, 850);
233
-    }
234
-
235
-    /**
220
+public function registerPlugins(): void
221
+{
222
+// Request plugins
223
+$this->registerPlugin(CallableClassPlugin::class, Jaxon::CALLABLE_CLASS, 101);
224
+$this->registerPlugin(CallableFunctionPlugin::class, Jaxon::CALLABLE_FUNCTION, 102);
225
+$this->registerPlugin(CallableDirPlugin::class, Jaxon::CALLABLE_DIR, 103);
226
+
227
+// Response plugins
228
+$this->registerPlugin(ScriptPlugin::class, ScriptPlugin::NAME, 700);
229
+$this->registerPlugin(DatabagPlugin::class, DatabagPlugin::NAME, 700);
230
+$this->registerPlugin(DialogPlugin::class, DialogPlugin::NAME, 750);
231
+$this->registerPlugin(PaginatorPlugin::class, PaginatorPlugin::NAME, 800);
232
+$this->registerPlugin(PsrPlugin::class, PsrPlugin::NAME, 850);
233
+}
234
+
235
+/**
236 236
      * Get the parameter reader
237 237
      *
238 238
      * @return ParameterReader
239 239
      */
240
-    public function getParameterReader(): ParameterReader
241
-    {
242
-        return $this->di->g(ParameterReader::class);
243
-    }
240
+public function getParameterReader(): ParameterReader
241
+{
242
+return $this->di->g(ParameterReader::class);
243
+}
244 244
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/CallableTrait.php 1 patch
Switch Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -15,81 +15,81 @@
 block discarded – undo
15 15
 
16 16
 trait CallableTrait
17 17
 {
18
-    /**
18
+/**
19 19
      * Register the values into the container
20 20
      *
21 21
      * @return void
22 22
      */
23
-    private function registerCallables(): void
24
-    {
25
-        // Validator
26
-        $this->set(Validator::class, function($di) {
27
-            return new Validator($di->g(ConfigManager::class), $di->g(Translator::class));
28
-        });
29
-        // Callable objects registry
30
-        $this->set(ComponentRegistry::class, function($di) {
31
-            return new ComponentRegistry($di->g(ComponentContainer::class));
32
-        });
33
-        // Callable class plugin
34
-        $this->set(CallableClassPlugin::class, function($di) {
35
-            $sPrefix = $di->g(ConfigManager::class)->getOption('core.prefix.class');
36
-            return new CallableClassPlugin($sPrefix, $di->getLogger(),
37
-                $di->g(ComponentContainer::class), $di->g(ComponentRegistry::class),
38
-                $di->g(Translator::class), $di->g(TemplateEngine::class),
39
-                $di->g(Validator::class));
40
-        });
41
-        // Callable dir plugin
42
-        $this->set(CallableDirPlugin::class, function($di) {
43
-            return new CallableDirPlugin($di->g(ComponentContainer::class),
44
-                $di->g(ComponentRegistry::class), $di->g(Translator::class));
45
-        });
46
-        // Callable function plugin
47
-        $this->set(CallableFunctionPlugin::class, function($di) {
48
-            $sPrefix = $di->g(ConfigManager::class)->getOption('core.prefix.function');
49
-            $bDebug = $di->g(ConfigManager::class)->getOption('core.debug.on', false);
50
-            return new CallableFunctionPlugin($sPrefix, $bDebug,
51
-                $di->g(Container::class), $di->g(TemplateEngine::class),
52
-                $di->g(Translator::class), $di->g(Validator::class));
53
-        });
54
-    }
23
+private function registerCallables(): void
24
+{
25
+// Validator
26
+$this->set(Validator::class, function($di) {
27
+return new Validator($di->g(ConfigManager::class), $di->g(Translator::class));
28
+});
29
+// Callable objects registry
30
+$this->set(ComponentRegistry::class, function($di) {
31
+return new ComponentRegistry($di->g(ComponentContainer::class));
32
+});
33
+// Callable class plugin
34
+$this->set(CallableClassPlugin::class, function($di) {
35
+$sPrefix = $di->g(ConfigManager::class)->getOption('core.prefix.class');
36
+return new CallableClassPlugin($sPrefix, $di->getLogger(),
37
+    $di->g(ComponentContainer::class), $di->g(ComponentRegistry::class),
38
+    $di->g(Translator::class), $di->g(TemplateEngine::class),
39
+    $di->g(Validator::class));
40
+});
41
+// Callable dir plugin
42
+$this->set(CallableDirPlugin::class, function($di) {
43
+return new CallableDirPlugin($di->g(ComponentContainer::class),
44
+    $di->g(ComponentRegistry::class), $di->g(Translator::class));
45
+});
46
+// Callable function plugin
47
+$this->set(CallableFunctionPlugin::class, function($di) {
48
+$sPrefix = $di->g(ConfigManager::class)->getOption('core.prefix.function');
49
+$bDebug = $di->g(ConfigManager::class)->getOption('core.debug.on', false);
50
+return new CallableFunctionPlugin($sPrefix, $bDebug,
51
+    $di->g(Container::class), $di->g(TemplateEngine::class),
52
+    $di->g(Translator::class), $di->g(Validator::class));
53
+});
54
+}
55 55
 
56
-    /**
56
+/**
57 57
      * Get the callable registry
58 58
      *
59 59
      * @return ComponentRegistry
60 60
      */
61
-    public function getComponentRegistry(): ComponentRegistry
62
-    {
63
-        return $this->g(ComponentRegistry::class);
64
-    }
61
+public function getComponentRegistry(): ComponentRegistry
62
+{
63
+return $this->g(ComponentRegistry::class);
64
+}
65 65
 
66
-    /**
66
+/**
67 67
      * Get the callable function plugin
68 68
      *
69 69
      * @return CallableFunctionPlugin
70 70
      */
71
-    public function getCallableFunctionPlugin(): CallableFunctionPlugin
72
-    {
73
-        return $this->g(CallableFunctionPlugin::class);
74
-    }
71
+public function getCallableFunctionPlugin(): CallableFunctionPlugin
72
+{
73
+return $this->g(CallableFunctionPlugin::class);
74
+}
75 75
 
76
-    /**
76
+/**
77 77
      * Get the callable class plugin
78 78
      *
79 79
      * @return CallableClassPlugin
80 80
      */
81
-    public function getCallableClassPlugin(): CallableClassPlugin
82
-    {
83
-        return $this->g(CallableClassPlugin::class);
84
-    }
81
+public function getCallableClassPlugin(): CallableClassPlugin
82
+{
83
+return $this->g(CallableClassPlugin::class);
84
+}
85 85
 
86
-    /**
86
+/**
87 87
      * Get the callable dir plugin
88 88
      *
89 89
      * @return CallableDirPlugin
90 90
      */
91
-    public function getCallableDirPlugin(): CallableDirPlugin
92
-    {
93
-        return $this->g(CallableDirPlugin::class);
94
-    }
91
+public function getCallableDirPlugin(): CallableDirPlugin
92
+{
93
+return $this->g(CallableDirPlugin::class);
94
+}
95 95
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/MetadataTrait.php 1 patch
Switch Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -9,50 +9,50 @@
 block discarded – undo
9 9
 
10 10
 trait MetadataTrait
11 11
 {
12
-    /**
12
+/**
13 13
      * Register the values into the container
14 14
      *
15 15
      * @return void
16 16
      */
17
-    private function registerMetadataReader(): void
18
-    {
19
-        // Metadata cache
20
-        $this->set(MetadataCache::class, fn($di) =>
21
-            new MetadataCache($di->g('jaxon_metadata_cache_dir')));
17
+private function registerMetadataReader(): void
18
+{
19
+// Metadata cache
20
+$this->set(MetadataCache::class, fn($di) =>
21
+new MetadataCache($di->g('jaxon_metadata_cache_dir')));
22 22
 
23
-        // By default, register a fake metadata reader.
24
-        $this->set('metadata_reader_null', function() {
25
-            return new class implements MetadataReaderInterface
26
-            {
27
-                public function getAttributes(InputData $xInputData): Metadata
28
-                {
29
-                    return new Metadata();
30
-                }
31
-            };
32
-        });
23
+// By default, register a fake metadata reader.
24
+$this->set('metadata_reader_null', function() {
25
+return new class implements MetadataReaderInterface
26
+{
27
+    public function getAttributes(InputData $xInputData): Metadata
28
+    {
29
+        return new Metadata();
33 30
     }
31
+};
32
+});
33
+}
34 34
 
35
-    /**
35
+/**
36 36
      * Get the metadata cache
37 37
      *
38 38
      * @return MetadataCache
39 39
      */
40
-    public function getMetadataCache(): MetadataCache
41
-    {
42
-        return $this->g(MetadataCache::class);
43
-    }
40
+public function getMetadataCache(): MetadataCache
41
+{
42
+return $this->g(MetadataCache::class);
43
+}
44 44
 
45
-    /**
45
+/**
46 46
      * Get the metadata reader with the given id
47 47
      *
48 48
      * @param string $sReaderId
49 49
      *
50 50
      * @return MetadataReaderInterface
51 51
      */
52
-    public function getMetadataReader(string $sReaderId): MetadataReaderInterface
53
-    {
54
-        return $this->h("metadata_reader_$sReaderId") ?
55
-            $this->g("metadata_reader_$sReaderId") :
56
-            $this->g('metadata_reader_null');
57
-    }
52
+public function getMetadataReader(string $sReaderId): MetadataReaderInterface
53
+{
54
+return $this->h("metadata_reader_$sReaderId") ?
55
+$this->g("metadata_reader_$sReaderId") :
56
+$this->g('metadata_reader_null');
57
+}
58 58
 }
Please login to merge, or discard this patch.
jaxon-core/src/Di/Traits/PsrTrait.php 1 patch
Switch Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -20,152 +20,152 @@
 block discarded – undo
20 20
 
21 21
 trait PsrTrait
22 22
 {
23
-    /**
23
+/**
24 24
      * @var string
25 25
      */
26
-    private $sPsrConfig = 'jaxon.psr.config.file';
26
+private $sPsrConfig = 'jaxon.psr.config.file';
27 27
 
28
-    /**
28
+/**
29 29
      * @var string
30 30
      */
31
-    private $sPsrServerRequest = 'jaxon.psr.server.request';
31
+private $sPsrServerRequest = 'jaxon.psr.server.request';
32 32
 
33
-    /**
33
+/**
34 34
      * Register the values into the container
35 35
      *
36 36
      * @return void
37 37
      */
38
-    private function registerPsr(): void
39
-    {
40
-        // The server request
41
-        $this->set(Psr17Factory::class, function() {
42
-            return new Psr17Factory();
43
-        });
44
-        $this->set(ServerRequestCreator::class, function($di) {
45
-            $xPsr17Factory = $di->g(Psr17Factory::class);
46
-            return new ServerRequestCreator(
47
-                $xPsr17Factory, // ServerRequestFactory
48
-                $xPsr17Factory, // UriFactory
49
-                $xPsr17Factory, // UploadedFileFactory
50
-                $xPsr17Factory, // StreamFactory
51
-            );
52
-        });
53
-        $this->set(ServerRequestInterface::class, function($di) {
54
-            return $di->g(ServerRequestCreator::class)->fromGlobals();
55
-        });
56
-        // Server request with the Jaxon request parameter as attribute
57
-        $this->set($this->sPsrServerRequest, function($di) {
58
-            $xParameterReader = $di->g(ParameterReader::class);
59
-            $xRequest = $di->g(ServerRequestInterface::class);
60
-            $aRequestParameter = $xParameterReader->getRequestParameter($xRequest);
61
-            return !is_array($aRequestParameter) ? $xRequest :
62
-                $xRequest->withAttribute('jxncall', $aRequestParameter);
63
-        });
64
-        // PSR factory
65
-        $this->set(PsrFactory::class, function($di) {
66
-            return new PsrFactory($di->g(Container::class));
67
-        });
68
-        // PSR request handler
69
-        $this->set(PsrRequestHandler::class, function($di) {
70
-            return new PsrRequestHandler($di->g(Container::class), $di->g(RequestHandler::class),
71
-                $di->g(ResponseManager::class), $di->g(Translator::class));
72
-        });
73
-        // PSR config middleware
74
-        $this->set(PsrConfigMiddleware::class, function($di) {
75
-            return new PsrConfigMiddleware($di->g(Container::class), $di->g($this->sPsrConfig));
76
-        });
77
-        // PSR ajax middleware
78
-        $this->set(PsrAjaxMiddleware::class, function($di) {
79
-            return new PsrAjaxMiddleware($di->g(Container::class), $di->g(RequestHandler::class),
80
-                $di->g(ResponseManager::class));
81
-        });
82
-        // The PSR response plugin
83
-        $this->set(PsrPlugin::class, function($di) {
84
-            return new PsrPlugin($di->g(Psr17Factory::class), $di->g(ServerRequestInterface::class));
85
-        });
86
-    }
38
+private function registerPsr(): void
39
+{
40
+// The server request
41
+$this->set(Psr17Factory::class, function() {
42
+return new Psr17Factory();
43
+});
44
+$this->set(ServerRequestCreator::class, function($di) {
45
+$xPsr17Factory = $di->g(Psr17Factory::class);
46
+return new ServerRequestCreator(
47
+    $xPsr17Factory, // ServerRequestFactory
48
+    $xPsr17Factory, // UriFactory
49
+    $xPsr17Factory, // UploadedFileFactory
50
+    $xPsr17Factory, // StreamFactory
51
+);
52
+});
53
+$this->set(ServerRequestInterface::class, function($di) {
54
+return $di->g(ServerRequestCreator::class)->fromGlobals();
55
+});
56
+// Server request with the Jaxon request parameter as attribute
57
+$this->set($this->sPsrServerRequest, function($di) {
58
+$xParameterReader = $di->g(ParameterReader::class);
59
+$xRequest = $di->g(ServerRequestInterface::class);
60
+$aRequestParameter = $xParameterReader->getRequestParameter($xRequest);
61
+return !is_array($aRequestParameter) ? $xRequest :
62
+    $xRequest->withAttribute('jxncall', $aRequestParameter);
63
+});
64
+// PSR factory
65
+$this->set(PsrFactory::class, function($di) {
66
+return new PsrFactory($di->g(Container::class));
67
+});
68
+// PSR request handler
69
+$this->set(PsrRequestHandler::class, function($di) {
70
+return new PsrRequestHandler($di->g(Container::class), $di->g(RequestHandler::class),
71
+    $di->g(ResponseManager::class), $di->g(Translator::class));
72
+});
73
+// PSR config middleware
74
+$this->set(PsrConfigMiddleware::class, function($di) {
75
+return new PsrConfigMiddleware($di->g(Container::class), $di->g($this->sPsrConfig));
76
+});
77
+// PSR ajax middleware
78
+$this->set(PsrAjaxMiddleware::class, function($di) {
79
+return new PsrAjaxMiddleware($di->g(Container::class), $di->g(RequestHandler::class),
80
+    $di->g(ResponseManager::class));
81
+});
82
+// The PSR response plugin
83
+$this->set(PsrPlugin::class, function($di) {
84
+return new PsrPlugin($di->g(Psr17Factory::class), $di->g(ServerRequestInterface::class));
85
+});
86
+}
87 87
 
88
-    /**
88
+/**
89 89
      * Get the request
90 90
      *
91 91
      * @return array
92 92
      */
93
-    public function getServerParams(): array
94
-    {
95
-        $xRequest = $this->g(ServerRequestInterface::class);
96
-        return $xRequest->getServerParams();
97
-    }
93
+public function getServerParams(): array
94
+{
95
+$xRequest = $this->g(ServerRequestInterface::class);
96
+return $xRequest->getServerParams();
97
+}
98 98
 
99
-    /**
99
+/**
100 100
      * Get the request with Jaxon parameter as attribute
101 101
      *
102 102
      * @return ServerRequestInterface
103 103
      */
104
-    public function getRequest(): ServerRequestInterface
105
-    {
106
-        return $this->g($this->sPsrServerRequest);
107
-    }
104
+public function getRequest(): ServerRequestInterface
105
+{
106
+return $this->g($this->sPsrServerRequest);
107
+}
108 108
 
109
-    /**
109
+/**
110 110
      * Return the array of arguments from the GET or POST data
111 111
      *
112 112
      * @return array
113 113
      */
114
-    public function getRequestArguments(): array
115
-    {
116
-        return $this->getRequest()->getAttribute('jxncall')['args'] ?? [];
117
-    }
114
+public function getRequestArguments(): array
115
+{
116
+return $this->getRequest()->getAttribute('jxncall')['args'] ?? [];
117
+}
118 118
 
119
-    /**
119
+/**
120 120
      * Get the PSR factory
121 121
      *
122 122
      * @return PsrFactory
123 123
      */
124
-    public function getPsrFactory(): PsrFactory
125
-    {
126
-        return $this->g(PsrFactory::class);
127
-    }
124
+public function getPsrFactory(): PsrFactory
125
+{
126
+return $this->g(PsrFactory::class);
127
+}
128 128
 
129
-    /**
129
+/**
130 130
      * Get the Psr17 factory
131 131
      *
132 132
      * @return Psr17Factory
133 133
      */
134
-    public function getPsr17Factory(): Psr17Factory
135
-    {
136
-        return $this->g(Psr17Factory::class);
137
-    }
134
+public function getPsr17Factory(): Psr17Factory
135
+{
136
+return $this->g(Psr17Factory::class);
137
+}
138 138
 
139
-    /**
139
+/**
140 140
      * Get the PSR request handler
141 141
      *
142 142
      * @return PsrRequestHandler
143 143
      */
144
-    public function getPsrRequestHandler(): PsrRequestHandler
145
-    {
146
-        return $this->g(PsrRequestHandler::class);
147
-    }
144
+public function getPsrRequestHandler(): PsrRequestHandler
145
+{
146
+return $this->g(PsrRequestHandler::class);
147
+}
148 148
 
149
-    /**
149
+/**
150 150
      * Get the PSR config middleware
151 151
      *
152 152
      * @param string $sConfigFile
153 153
      *
154 154
      * @return PsrConfigMiddleware
155 155
      */
156
-    public function getPsrConfigMiddleware(string $sConfigFile): PsrConfigMiddleware
157
-    {
158
-        !$this->h($this->sPsrConfig) && $this->val($this->sPsrConfig, $sConfigFile);
159
-        return $this->g(PsrConfigMiddleware::class);
160
-    }
156
+public function getPsrConfigMiddleware(string $sConfigFile): PsrConfigMiddleware
157
+{
158
+!$this->h($this->sPsrConfig) && $this->val($this->sPsrConfig, $sConfigFile);
159
+return $this->g(PsrConfigMiddleware::class);
160
+}
161 161
 
162
-    /**
162
+/**
163 163
      * Get the PSR ajax request middleware
164 164
      *
165 165
      * @return PsrAjaxMiddleware
166 166
      */
167
-    public function getPsrAjaxMiddleware(): PsrAjaxMiddleware
168
-    {
169
-        return $this->g(PsrAjaxMiddleware::class);
170
-    }
167
+public function getPsrAjaxMiddleware(): PsrAjaxMiddleware
168
+{
169
+return $this->g(PsrAjaxMiddleware::class);
170
+}
171 171
 }
Please login to merge, or discard this patch.