Passed
Push — main ( 8fa9e1...957ef0 )
by Thierry
06:37
created
jaxon-core/src/App/Ajax/AppInterface.php 1 patch
Switch Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -22,58 +22,58 @@  discard block
 block discarded – undo
22 22
 
23 23
 interface AppInterface
24 24
 {
25
-    /**
25
+/**
26 26
      * Set the logger.
27 27
      *
28 28
      * @param LoggerInterface|Closure $xLogger
29 29
      *
30 30
      * @return void
31 31
      */
32
-    public function setLogger(LoggerInterface|Closure $xLogger): void;
32
+public function setLogger(LoggerInterface|Closure $xLogger): void;
33 33
 
34
-    /**
34
+/**
35 35
      * Get the configured character encoding
36 36
      *
37 37
      * @return string
38 38
      */
39
-    public function getCharacterEncoding(): string;
39
+public function getCharacterEncoding(): string;
40 40
 
41
-    /**
41
+/**
42 42
      * Get the content type of the HTTP response
43 43
      *
44 44
      * @return string
45 45
      */
46
-    public function getContentType(): string;
46
+public function getContentType(): string;
47 47
 
48
-    /**
48
+/**
49 49
      * Get the HTML tags to include Jaxon javascript files into the page.
50 50
      *
51 51
      * @return string
52 52
      */
53
-    public function getJs(): string;
53
+public function getJs(): string;
54 54
 
55
-    /**
55
+/**
56 56
      * Get the HTML tags to include Jaxon javascript files into the page.
57 57
      *
58 58
      * @return string  the javascript code
59 59
      */
60
-    public function js(): string;
60
+public function js(): string;
61 61
 
62
-    /**
62
+/**
63 63
      * Get the HTML tags to include Jaxon CSS code and files into the page.
64 64
      *
65 65
      * @return string
66 66
      */
67
-    public function getCss(): string;
67
+public function getCss(): string;
68 68
 
69
-    /**
69
+/**
70 70
      * Get the HTML tags to include Jaxon CSS code and files into the page.
71 71
      *
72 72
      * @return string  the javascript code
73 73
      */
74
-    public function css(): string;
74
+public function css(): string;
75 75
 
76
-    /**
76
+/**
77 77
      * Returns the js header and wrapper code to be printed into the page
78 78
      *
79 79
      * The javascript code returned by this function is dependent on the plugins
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
      *
85 85
      * @return string
86 86
      */
87
-    public function getScript(bool $bIncludeJs = false, bool $bIncludeCss = false): string;
87
+public function getScript(bool $bIncludeJs = false, bool $bIncludeCss = false): string;
88 88
 
89
-    /**
89
+/**
90 90
      * Returns the js header and wrapper code to be printed into the page
91 91
      *
92 92
      * @param bool $bIncludeJs    Also get the JS files
@@ -95,46 +95,46 @@  discard block
 block discarded – undo
95 95
      * @return string  the javascript code
96 96
      * @throws UriException
97 97
      */
98
-    public function script(bool $bIncludeJs = false, bool $bIncludeCss = false): string;
98
+public function script(bool $bIncludeJs = false, bool $bIncludeCss = false): string;
99 99
 
100
-    /**
100
+/**
101 101
      * Determine if a call is a jaxon request or a page load request
102 102
      *
103 103
      * @return bool
104 104
      */
105
-    public function canProcessRequest(): bool;
105
+public function canProcessRequest(): bool;
106 106
 
107
-    /**
107
+/**
108 108
      * Process an incoming Jaxon request, and return the response.
109 109
      *
110 110
      * @return mixed
111 111
      */
112
-    public function processRequest(): mixed;
112
+public function processRequest(): mixed;
113 113
 
114
-    /**
114
+/**
115 115
      * Get the Jaxon ajax response
116 116
      *
117 117
      * @return AjaxResponse
118 118
      */
119
-    public function ajaxResponse(): AjaxResponse;
119
+public function ajaxResponse(): AjaxResponse;
120 120
 
121
-    /**
121
+/**
122 122
      * @param Closure $xClosure    A closure to create the session manager instance
123 123
      *
124 124
      * @return void
125 125
      */
126
-    public function setSessionManager(Closure $xClosure);
126
+public function setSessionManager(Closure $xClosure);
127 127
 
128
-    /**
128
+/**
129 129
      * Set the container provided by the integrated framework
130 130
      *
131 131
      * @param ContainerInterface $xContainer    The container implementation
132 132
      *
133 133
      * @return void
134 134
      */
135
-    public function setContainer(ContainerInterface $xContainer);
135
+public function setContainer(ContainerInterface $xContainer);
136 136
 
137
-    /**
137
+/**
138 138
      * Add a view renderer with an id
139 139
      *
140 140
      * @param string $sRenderer    The renderer name
@@ -143,9 +143,9 @@  discard block
 block discarded – undo
143 143
      *
144 144
      * @return void
145 145
      */
146
-    public function addViewRenderer(string $sRenderer, string $sExtension, Closure $xClosure);
146
+public function addViewRenderer(string $sRenderer, string $sExtension, Closure $xClosure);
147 147
 
148
-    /**
148
+/**
149 149
      * Set the javascript asset
150 150
      *
151 151
      * @param bool $bExport    Whether to export the js code in a file
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
      *
156 156
      * @return void
157 157
      */
158
-    public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): void;
158
+public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): void;
159 159
 
160
-    /**
160
+/**
161 161
      * Read config options from a config file and set up the library
162 162
      *
163 163
      * @param string $sConfigFile    The full path to the config file
164 164
      *
165 165
      * @return void
166 166
      */
167
-    public function setup(string $sConfigFile = ''): void;
167
+public function setup(string $sConfigFile = ''): void;
168 168
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Ajax/AbstractApp.php 1 patch
Switch Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -20,32 +20,32 @@  discard block
 block discarded – undo
20 20
 
21 21
 abstract class AbstractApp implements AppInterface
22 22
 {
23
-    use Traits\ServicesTrait;
24
-    use Traits\PluginTrait;
25
-    use Traits\RequestTrait;
26
-    use Traits\ResponseTrait;
23
+use Traits\ServicesTrait;
24
+use Traits\PluginTrait;
25
+use Traits\RequestTrait;
26
+use Traits\ResponseTrait;
27 27
 
28
-    /**
28
+/**
29 29
      * The class constructor
30 30
      */
31
-    public function __construct()
32
-    {
33
-        // Declared in DiTrait.
34
-        $this->xContainer = Jaxon::getInstance()->di();
35
-        $this->xComponentContainer = Jaxon::getInstance()->cdi();
36
-    }
31
+public function __construct()
32
+{
33
+// Declared in DiTrait.
34
+$this->xContainer = Jaxon::getInstance()->di();
35
+$this->xComponentContainer = Jaxon::getInstance()->cdi();
36
+}
37 37
 
38
-    /**
38
+/**
39 39
      * Get the Jaxon application bootstrapper.
40 40
      *
41 41
      * @return Bootstrap
42 42
      */
43
-    protected function bootstrap(): Bootstrap
44
-    {
45
-        return $this->xContainer->getBootstrap();
46
-    }
43
+protected function bootstrap(): Bootstrap
44
+{
45
+return $this->xContainer->getBootstrap();
46
+}
47 47
 
48
-    /**
48
+/**
49 49
      * Set the javascript asset
50 50
      *
51 51
      * @param bool $bExport    Whether to export the js code in a file
@@ -55,26 +55,26 @@  discard block
 block discarded – undo
55 55
      *
56 56
      * @return void
57 57
      */
58
-    public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): void
59
-    {
60
-        $this->bootstrap()->asset($bExport, $bMinify, $sUri, $sDir);
61
-    }
58
+public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): void
59
+{
60
+$this->bootstrap()->asset($bExport, $bMinify, $sUri, $sDir);
61
+}
62 62
 
63
-    /**
63
+/**
64 64
      * Set the container provided by the integrated framework
65 65
      *
66 66
      * @param ContainerInterface $xContainer    The container implementation
67 67
      *
68 68
      * @return void
69 69
      */
70
-    public function setContainer(ContainerInterface $xContainer): void
71
-    {
72
-        $this->di()->setContainer($xContainer);
73
-    }
70
+public function setContainer(ContainerInterface $xContainer): void
71
+{
72
+$this->di()->setContainer($xContainer);
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * @inheritDoc
77 77
      */
78
-    public function setup(string $sConfigFile = ''): void
79
-    {}
78
+public function setup(string $sConfigFile = ''): void
79
+{}
80 80
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/View/ViewInterface.php 1 patch
Switch Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 
5 5
 interface ViewInterface
6 6
 {
7
-    /**
7
+/**
8 8
      * Add a namespace to the view renderer
9 9
      *
10 10
      * @param string $sNamespace    The namespace name
@@ -13,14 +13,14 @@  discard block
 block discarded – undo
13 13
      *
14 14
      * @return void
15 15
      */
16
-    public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): void;
16
+public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): void;
17 17
 
18
-    /**
18
+/**
19 19
      * Render a view
20 20
      *
21 21
      * @param Store $store    A store populated with the view data
22 22
      *
23 23
      * @return string
24 24
      */
25
-    public function render(Store $store): string;
25
+public function render(Store $store): string;
26 26
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/CallableObject.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -73,8 +73,7 @@  discard block
 block discarded – undo
73 73
      */
74 74
     public function excluded(?string $sMethodName = null): bool
75 75
     {
76
-        return $sMethodName === null ? $this->xOptions->excluded() :
77
-            !$this->xOptions->isPublicMethod($sMethodName);
76
+        return $sMethodName === null ? $this->xOptions->excluded() : !$this->xOptions->isPublicMethod($sMethodName);
78 77
     }
79 78
 
80 79
     /**
@@ -160,11 +159,11 @@  discard block
 block discarded – undo
160 159
         $sMethod = $this->xTarget->getMethodName();
161 160
         // The hooks defined at method level are merged with those defined at class level.
162 161
         $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []);
163
-        foreach($aMethods as $xKey => $xValue)
162
+        foreach ($aMethods as $xKey => $xValue)
164 163
         {
165 164
             $sHookName = $xValue;
166 165
             $aHookArgs = [];
167
-            if(is_string($xKey))
166
+            if (is_string($xKey))
168 167
             {
169 168
                 $sHookName = $xKey;
170 169
                 $aHookArgs = is_array($xValue) ? $xValue : [$xValue];
@@ -202,7 +201,7 @@  discard block
 block discarded – undo
202 201
             // Warning: dynamic properties will be deprecated in PHP8.2.
203 202
             $this->$sAttr = $xDiValue;
204 203
         };
205
-        foreach($aDiOptions as $sAttr => $sClass)
204
+        foreach ($aDiOptions as $sAttr => $sClass)
206 205
         {
207 206
             $this->setDiAttribute($xComponent, $sAttr, $this->di->get($sClass), $cSetter);
208 207
         }
Please login to merge, or discard this patch.
jaxon-attributes/src/Attribute/Export.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@
 block discarded – undo
38 38
     public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
39 39
     {
40 40
         $aMethods = [];
41
-        foreach(['base', 'only', 'except'] as $key)
41
+        foreach (['base', 'only', 'except'] as $key)
42 42
         {
43
-            if($this->$key !== null && count($this->$key) > 0)
43
+            if ($this->$key !== null && count($this->$key) > 0)
44 44
             {
45 45
                 $aMethods[$key] = $this->$key;
46 46
             }
Please login to merge, or discard this patch.
jaxon-annotations/src/Annotation/ExportAnnotation.php 2 patches
Switch Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -26,41 +26,41 @@
 block discarded – undo
26 26
  */
27 27
 class ExportAnnotation extends AbstractAnnotation
28 28
 {
29
-    /**
29
+/**
30 30
      * @var array
31 31
      */
32
-    private $aMethods = [];
32
+private $aMethods = [];
33 33
 
34
-    /**
34
+/**
35 35
      * @inheritDoc
36 36
      */
37
-    public static function parseAnnotation($value)
38
-    {
39
-        $aParams = json_decode($value, true);
40
-        return is_array($aParams) ? $aParams : [];
41
-    }
37
+public static function parseAnnotation($value)
38
+{
39
+$aParams = json_decode($value, true);
40
+return is_array($aParams) ? $aParams : [];
41
+}
42 42
 
43
-    /**
43
+/**
44 44
      * @inheritDoc
45 45
      * @throws AnnotationException
46 46
      */
47
-    public function initAnnotation(array $properties)
48
-    {
49
-        foreach(['base', 'only', 'except'] as $key)
50
-        {
51
-            if(isset($properties[$key]) && is_array($properties[$key]) &&
52
-                count($properties[$key]) > 0)
53
-            {
54
-                $this->aMethods[$key] = $properties[$key];
55
-            }
56
-        }
57
-    }
47
+public function initAnnotation(array $properties)
48
+{
49
+foreach(['base', 'only', 'except'] as $key)
50
+{
51
+if(isset($properties[$key]) && is_array($properties[$key]) &&
52
+    count($properties[$key]) > 0)
53
+{
54
+    $this->aMethods[$key] = $properties[$key];
55
+}
56
+}
57
+}
58 58
 
59
-    /**
59
+/**
60 60
      * @inheritDoc
61 61
      */
62
-    public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
63
-    {
64
-        $xMetadata->export($sMethod)->setMethods($this->aMethods);
65
-    }
62
+public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
63
+{
64
+$xMetadata->export($sMethod)->setMethods($this->aMethods);
65
+}
66 66
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -46,9 +46,9 @@
 block discarded – undo
46 46
      */
47 47
     public function initAnnotation(array $properties)
48 48
     {
49
-        foreach(['base', 'only', 'except'] as $key)
49
+        foreach (['base', 'only', 'except'] as $key)
50 50
         {
51
-            if(isset($properties[$key]) && is_array($properties[$key]) &&
51
+            if (isset($properties[$key]) && is_array($properties[$key]) &&
52 52
                 count($properties[$key]) > 0)
53 53
             {
54 54
                 $this->aMethods[$key] = $properties[$key];
Please login to merge, or discard this patch.
jaxon-annotations/tests/TestAnnotation/ExtendAnnotationTest.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@
 block discarded – undo
45 45
         $aFiles = scandir($this->sCacheDir);
46 46
         foreach ($aFiles as $sFile)
47 47
         {
48
-            if($sFile !== '.' && $sFile !== '..')
48
+            if ($sFile !== '.' && $sFile !== '..')
49 49
             {
50 50
                 @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
51 51
             }
Please login to merge, or discard this patch.
Switch Indentation   +301 added lines, -301 removed lines patch added patch discarded remove patch
@@ -14,346 +14,346 @@
 block discarded – undo
14 14
 
15 15
 class ExtendAnnotationTest extends TestCase
16 16
 {
17
-    use AnnotationTrait;
17
+use AnnotationTrait;
18 18
 
19
-    /**
19
+/**
20 20
      * @var string
21 21
      */
22
-    protected $sCacheDir;
22
+protected $sCacheDir;
23 23
 
24
-    /**
24
+/**
25 25
      * @throws SetupException
26 26
      */
27
-    public function setUp(): void
28
-    {
29
-        $this->sCacheDir = __DIR__ . '/../tmp';
30
-        @mkdir($this->sCacheDir);
27
+public function setUp(): void
28
+{
29
+$this->sCacheDir = __DIR__ . '/../tmp';
30
+@mkdir($this->sCacheDir);
31 31
 
32
-        jaxon()->di()->getPluginManager()->registerPlugins();
33
-        _register();
32
+jaxon()->di()->getPluginManager()->registerPlugins();
33
+_register();
34 34
 
35
-        jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir);
36
-    }
35
+jaxon()->di()->val('jaxon_annotations_cache_dir', $this->sCacheDir);
36
+}
37 37
 
38
-    /**
38
+/**
39 39
      * @throws SetupException
40 40
      */
41
-    public function tearDown(): void
42
-    {
43
-        jaxon()->reset();
44
-        parent::tearDown();
45
-
46
-        // Delete the temp dir and all its content
47
-        $aFiles = scandir($this->sCacheDir);
48
-        foreach ($aFiles as $sFile)
49
-        {
50
-            if($sFile !== '.' && $sFile !== '..')
51
-            {
52
-                @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
53
-            }
54
-        }
55
-        @rmdir($this->sCacheDir);
56
-    }
57
-
58
-    /**
41
+public function tearDown(): void
42
+{
43
+jaxon()->reset();
44
+parent::tearDown();
45
+
46
+// Delete the temp dir and all its content
47
+$aFiles = scandir($this->sCacheDir);
48
+foreach ($aFiles as $sFile)
49
+{
50
+if($sFile !== '.' && $sFile !== '..')
51
+{
52
+    @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile);
53
+}
54
+}
55
+@rmdir($this->sCacheDir);
56
+}
57
+
58
+/**
59 59
      * @throws SetupException
60 60
      */
61
-    public function testUploadAndExcludeAnnotation()
62
-    {
63
-        $xMetadata = $this->getAttributes(ExtendAnnotated::class, ['saveFiles', 'doNot']);
64
-        $bExcluded = $xMetadata->isExcluded();
65
-        $aProperties = $xMetadata->getProperties();
66
-        $aExcluded = $xMetadata->getExceptMethods();
61
+public function testUploadAndExcludeAnnotation()
62
+{
63
+$xMetadata = $this->getAttributes(ExtendAnnotated::class, ['saveFiles', 'doNot']);
64
+$bExcluded = $xMetadata->isExcluded();
65
+$aProperties = $xMetadata->getProperties();
66
+$aExcluded = $xMetadata->getExceptMethods();
67 67
 
68
-        $this->assertFalse($bExcluded);
68
+$this->assertFalse($bExcluded);
69 69
 
70
-        $this->assertCount(1, $aProperties);
71
-        $this->assertArrayHasKey('saveFiles', $aProperties);
72
-        $this->assertCount(1, $aProperties['saveFiles']);
73
-        $this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']);
70
+$this->assertCount(1, $aProperties);
71
+$this->assertArrayHasKey('saveFiles', $aProperties);
72
+$this->assertCount(1, $aProperties['saveFiles']);
73
+$this->assertEquals("'user-files'", $aProperties['saveFiles']['upload']);
74 74
 
75
-        $this->assertCount(1, $aExcluded);
76
-        $this->assertEquals('doNot', $aExcluded[0]);
77
-    }
75
+$this->assertCount(1, $aExcluded);
76
+$this->assertEquals('doNot', $aExcluded[0]);
77
+}
78 78
 
79
-    /**
79
+/**
80 80
      * @throws SetupException
81 81
      */
82
-    public function testDatabagAnnotation()
83
-    {
84
-        $xMetadata = $this->getAttributes(ExtendAnnotated::class, ['withBags']);
85
-        $bExcluded = $xMetadata->isExcluded();
86
-        $aProperties = $xMetadata->getProperties();
87
-
88
-        $this->assertFalse($bExcluded);
89
-
90
-        $this->assertCount(1, $aProperties);
91
-        $this->assertArrayHasKey('withBags', $aProperties);
92
-        $this->assertCount(1, $aProperties['withBags']);
93
-        $this->assertCount(2, $aProperties['withBags']['bags']);
94
-        $this->assertEquals('user.name', $aProperties['withBags']['bags'][0]);
95
-        $this->assertEquals('page.number', $aProperties['withBags']['bags'][1]);
96
-    }
97
-
98
-    /**
82
+public function testDatabagAnnotation()
83
+{
84
+$xMetadata = $this->getAttributes(ExtendAnnotated::class, ['withBags']);
85
+$bExcluded = $xMetadata->isExcluded();
86
+$aProperties = $xMetadata->getProperties();
87
+
88
+$this->assertFalse($bExcluded);
89
+
90
+$this->assertCount(1, $aProperties);
91
+$this->assertArrayHasKey('withBags', $aProperties);
92
+$this->assertCount(1, $aProperties['withBags']);
93
+$this->assertCount(2, $aProperties['withBags']['bags']);
94
+$this->assertEquals('user.name', $aProperties['withBags']['bags'][0]);
95
+$this->assertEquals('page.number', $aProperties['withBags']['bags'][1]);
96
+}
97
+
98
+/**
99 99
      * @throws SetupException
100 100
      */
101
-    public function testServerCallbacksAnnotation()
102
-    {
103
-        $xMetadata = $this->getAttributes(ExtendAnnotated::class,
104
-            ['cbSingle', 'cbMultiple', 'cbParams']);
105
-        $bExcluded = $xMetadata->isExcluded();
106
-        $aProperties = $xMetadata->getProperties();
107
-
108
-        $this->assertFalse($bExcluded);
109
-
110
-        $this->assertCount(3, $aProperties);
111
-        $this->assertArrayHasKey('cbSingle', $aProperties);
112
-        $this->assertArrayHasKey('cbMultiple', $aProperties);
113
-        $this->assertArrayHasKey('cbParams', $aProperties);
114
-
115
-        $this->assertCount(1, $aProperties['cbSingle']['__before']);
116
-        $this->assertCount(2, $aProperties['cbMultiple']['__before']);
117
-        $this->assertCount(2, $aProperties['cbParams']['__before']);
118
-        $this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']);
119
-        $this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']);
120
-        $this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']);
121
-        $this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']);
122
-        $this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']);
123
-        $this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']);
124
-        $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']);
125
-        $this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']);
126
-        $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']);
127
-        $this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']);
128
-
129
-        $this->assertCount(1, $aProperties['cbSingle']['__after']);
130
-        $this->assertCount(3, $aProperties['cbMultiple']['__after']);
131
-        $this->assertCount(1, $aProperties['cbParams']['__after']);
132
-        $this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']);
133
-        $this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']);
134
-        $this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']);
135
-        $this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']);
136
-        $this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']);
137
-        $this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']);
138
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']);
139
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']);
140
-        $this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']);
141
-        $this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']);
142
-    }
143
-
144
-    /**
101
+public function testServerCallbacksAnnotation()
102
+{
103
+$xMetadata = $this->getAttributes(ExtendAnnotated::class,
104
+['cbSingle', 'cbMultiple', 'cbParams']);
105
+$bExcluded = $xMetadata->isExcluded();
106
+$aProperties = $xMetadata->getProperties();
107
+
108
+$this->assertFalse($bExcluded);
109
+
110
+$this->assertCount(3, $aProperties);
111
+$this->assertArrayHasKey('cbSingle', $aProperties);
112
+$this->assertArrayHasKey('cbMultiple', $aProperties);
113
+$this->assertArrayHasKey('cbParams', $aProperties);
114
+
115
+$this->assertCount(1, $aProperties['cbSingle']['__before']);
116
+$this->assertCount(2, $aProperties['cbMultiple']['__before']);
117
+$this->assertCount(2, $aProperties['cbParams']['__before']);
118
+$this->assertArrayHasKey('funcBefore', $aProperties['cbSingle']['__before']);
119
+$this->assertArrayHasKey('funcBefore1', $aProperties['cbMultiple']['__before']);
120
+$this->assertArrayHasKey('funcBefore2', $aProperties['cbMultiple']['__before']);
121
+$this->assertArrayHasKey('funcBefore1', $aProperties['cbParams']['__before']);
122
+$this->assertArrayHasKey('funcBefore2', $aProperties['cbParams']['__before']);
123
+$this->assertIsArray($aProperties['cbSingle']['__before']['funcBefore']);
124
+$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore1']);
125
+$this->assertIsArray($aProperties['cbMultiple']['__before']['funcBefore2']);
126
+$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore1']);
127
+$this->assertIsArray($aProperties['cbParams']['__before']['funcBefore2']);
128
+
129
+$this->assertCount(1, $aProperties['cbSingle']['__after']);
130
+$this->assertCount(3, $aProperties['cbMultiple']['__after']);
131
+$this->assertCount(1, $aProperties['cbParams']['__after']);
132
+$this->assertArrayHasKey('funcAfter', $aProperties['cbSingle']['__after']);
133
+$this->assertArrayHasKey('funcAfter1', $aProperties['cbMultiple']['__after']);
134
+$this->assertArrayHasKey('funcAfter2', $aProperties['cbMultiple']['__after']);
135
+$this->assertArrayHasKey('funcAfter3', $aProperties['cbMultiple']['__after']);
136
+$this->assertArrayHasKey('funcAfter1', $aProperties['cbParams']['__after']);
137
+$this->assertIsArray($aProperties['cbSingle']['__after']['funcAfter']);
138
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter1']);
139
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter2']);
140
+$this->assertIsArray($aProperties['cbMultiple']['__after']['funcAfter3']);
141
+$this->assertIsArray($aProperties['cbParams']['__after']['funcAfter1']);
142
+}
143
+
144
+/**
145 145
      * @throws SetupException
146 146
      */
147
-    public function testContainerAnnotation()
148
-    {
149
-        $xMetadata = $this->getAttributes(ExtendAnnotated::class, ['di1', 'di2']);
150
-        $bExcluded = $xMetadata->isExcluded();
151
-        $aProperties = $xMetadata->getProperties();
152
-
153
-        $this->assertFalse($bExcluded);
154
-
155
-        $this->assertCount(2, $aProperties);
156
-        $this->assertArrayHasKey('di1', $aProperties);
157
-        $this->assertArrayHasKey('di2', $aProperties);
158
-        $this->assertCount(2, $aProperties['di1']['__di']);
159
-        $this->assertCount(2, $aProperties['di2']['__di']);
160
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']);
161
-        $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']);
162
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']);
163
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']);
164
-    }
165
-
166
-    /**
147
+public function testContainerAnnotation()
148
+{
149
+$xMetadata = $this->getAttributes(ExtendAnnotated::class, ['di1', 'di2']);
150
+$bExcluded = $xMetadata->isExcluded();
151
+$aProperties = $xMetadata->getProperties();
152
+
153
+$this->assertFalse($bExcluded);
154
+
155
+$this->assertCount(2, $aProperties);
156
+$this->assertArrayHasKey('di1', $aProperties);
157
+$this->assertArrayHasKey('di2', $aProperties);
158
+$this->assertCount(2, $aProperties['di1']['__di']);
159
+$this->assertCount(2, $aProperties['di2']['__di']);
160
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di1']['__di']['colorService']);
161
+$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['di1']['__di']['fontService']);
162
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['di2']['__di']['colorService']);
163
+$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['di2']['__di']['textService']);
164
+}
165
+
166
+/**
167 167
      * @throws SetupException
168 168
      */
169
-    public function testClassAnnotation()
170
-    {
171
-        $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
172
-        $bExcluded = $xMetadata->isExcluded();
173
-        $aProperties = $xMetadata->getProperties();
174
-
175
-        $this->assertFalse($bExcluded);
176
-
177
-        $this->assertCount(1, $aProperties);
178
-        $this->assertArrayHasKey('*', $aProperties);
179
-        $this->assertCount(5, $aProperties['*']);
180
-        $this->assertArrayHasKey('bags', $aProperties['*']);
181
-        $this->assertArrayHasKey('callback', $aProperties['*']);
182
-        $this->assertArrayHasKey('__before', $aProperties['*']);
183
-        $this->assertArrayHasKey('__after', $aProperties['*']);
184
-    }
185
-
186
-    /**
169
+public function testClassAnnotation()
170
+{
171
+$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
172
+$bExcluded = $xMetadata->isExcluded();
173
+$aProperties = $xMetadata->getProperties();
174
+
175
+$this->assertFalse($bExcluded);
176
+
177
+$this->assertCount(1, $aProperties);
178
+$this->assertArrayHasKey('*', $aProperties);
179
+$this->assertCount(5, $aProperties['*']);
180
+$this->assertArrayHasKey('bags', $aProperties['*']);
181
+$this->assertArrayHasKey('callback', $aProperties['*']);
182
+$this->assertArrayHasKey('__before', $aProperties['*']);
183
+$this->assertArrayHasKey('__after', $aProperties['*']);
184
+}
185
+
186
+/**
187 187
      * @throws SetupException
188 188
      */
189
-    public function testClassBagsAnnotation()
190
-    {
191
-        $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
192
-        $aProperties = $xMetadata->getProperties();
189
+public function testClassBagsAnnotation()
190
+{
191
+$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
192
+$aProperties = $xMetadata->getProperties();
193 193
 
194
-        $this->assertCount(2, $aProperties['*']['bags']);
195
-        $this->assertEquals('user.name', $aProperties['*']['bags'][0]);
196
-        $this->assertEquals('page.number', $aProperties['*']['bags'][1]);
197
-    }
194
+$this->assertCount(2, $aProperties['*']['bags']);
195
+$this->assertEquals('user.name', $aProperties['*']['bags'][0]);
196
+$this->assertEquals('page.number', $aProperties['*']['bags'][1]);
197
+}
198 198
 
199
-    /**
199
+/**
200 200
      * @throws SetupException
201 201
      */
202
-    public function testClassCallbackAnnotation()
203
-    {
204
-        $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
205
-        $aProperties = $xMetadata->getProperties();
202
+public function testClassCallbackAnnotation()
203
+{
204
+$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
205
+$aProperties = $xMetadata->getProperties();
206 206
 
207
-        $this->assertIsArray($aProperties['*']['callback']);
208
-        $this->assertEquals('jaxon.callback.global', $aProperties['*']['callback'][0]);
209
-    }
207
+$this->assertIsArray($aProperties['*']['callback']);
208
+$this->assertEquals('jaxon.callback.global', $aProperties['*']['callback'][0]);
209
+}
210 210
 
211
-    /**
211
+/**
212 212
      * @throws SetupException
213 213
      */
214
-    public function testClassBeforeAnnotation()
215
-    {
216
-        $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
217
-        $aProperties = $xMetadata->getProperties();
218
-
219
-        $this->assertCount(2, $aProperties['*']['__before']);
220
-        $this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']);
221
-        $this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']);
222
-        $this->assertIsArray($aProperties['*']['__before']['funcBefore1']);
223
-        $this->assertIsArray($aProperties['*']['__before']['funcBefore2']);
224
-    }
225
-
226
-    /**
214
+public function testClassBeforeAnnotation()
215
+{
216
+$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
217
+$aProperties = $xMetadata->getProperties();
218
+
219
+$this->assertCount(2, $aProperties['*']['__before']);
220
+$this->assertArrayHasKey('funcBefore1', $aProperties['*']['__before']);
221
+$this->assertArrayHasKey('funcBefore2', $aProperties['*']['__before']);
222
+$this->assertIsArray($aProperties['*']['__before']['funcBefore1']);
223
+$this->assertIsArray($aProperties['*']['__before']['funcBefore2']);
224
+}
225
+
226
+/**
227 227
      * @throws SetupException
228 228
      */
229
-    public function testClassAfterAnnotation()
230
-    {
231
-        $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
232
-        $aProperties = $xMetadata->getProperties();
233
-
234
-        $this->assertCount(3, $aProperties['*']['__after']);
235
-        $this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']);
236
-        $this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']);
237
-        $this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']);
238
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter1']);
239
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter2']);
240
-        $this->assertIsArray($aProperties['*']['__after']['funcAfter3']);
241
-    }
242
-
243
-    /**
229
+public function testClassAfterAnnotation()
230
+{
231
+$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
232
+$aProperties = $xMetadata->getProperties();
233
+
234
+$this->assertCount(3, $aProperties['*']['__after']);
235
+$this->assertArrayHasKey('funcAfter1', $aProperties['*']['__after']);
236
+$this->assertArrayHasKey('funcAfter2', $aProperties['*']['__after']);
237
+$this->assertArrayHasKey('funcAfter3', $aProperties['*']['__after']);
238
+$this->assertIsArray($aProperties['*']['__after']['funcAfter1']);
239
+$this->assertIsArray($aProperties['*']['__after']['funcAfter2']);
240
+$this->assertIsArray($aProperties['*']['__after']['funcAfter3']);
241
+}
242
+
243
+/**
244 244
      * @throws SetupException
245 245
      */
246
-    public function testClassDiAnnotation()
247
-    {
248
-        $xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
249
-        $aProperties = $xMetadata->getProperties();
250
-
251
-        $this->assertCount(3, $aProperties['*']['__di']);
252
-        $this->assertArrayHasKey('colorService', $aProperties['*']['__di']);
253
-        $this->assertArrayHasKey('textService', $aProperties['*']['__di']);
254
-        $this->assertArrayHasKey('fontService', $aProperties['*']['__di']);
255
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']);
256
-        $this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']);
257
-        $this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']);
258
-    }
259
-
260
-    /**
246
+public function testClassDiAnnotation()
247
+{
248
+$xMetadata = $this->getAttributes(ExtendClassAnnotated::class, []);
249
+$aProperties = $xMetadata->getProperties();
250
+
251
+$this->assertCount(3, $aProperties['*']['__di']);
252
+$this->assertArrayHasKey('colorService', $aProperties['*']['__di']);
253
+$this->assertArrayHasKey('textService', $aProperties['*']['__di']);
254
+$this->assertArrayHasKey('fontService', $aProperties['*']['__di']);
255
+$this->assertEquals('Jaxon\Annotations\Tests\Service\ColorService', $aProperties['*']['__di']['colorService']);
256
+$this->assertEquals('Jaxon\Annotations\Tests\Service\TextService', $aProperties['*']['__di']['textService']);
257
+$this->assertEquals('Jaxon\Annotations\Tests\Attr\Ajax\FontService', $aProperties['*']['__di']['fontService']);
258
+}
259
+
260
+/**
261 261
      * @throws SetupException
262 262
      */
263
-    public function testClassExcludeAnnotation()
264
-    {
265
-        $xMetadata = $this->getAttributes(ClassExcluded::class,
266
-            ['doNot', 'withBags', 'cbSingle']);
267
-        $bExcluded = $xMetadata->isExcluded();
268
-        $aProperties = $xMetadata->getProperties();
269
-        $aExcluded = $xMetadata->getExceptMethods();
270
-
271
-        $this->assertTrue($bExcluded);
272
-        $this->assertEmpty($aProperties);
273
-        $this->assertEmpty($aExcluded);
274
-    }
275
-
276
-    public function testExcludeAnnotationError()
277
-    {
278
-        $this->expectException(SetupException::class);
279
-        $this->getAttributes(ExtendAnnotated::class, ['doNotError']);
280
-    }
281
-
282
-    public function testDatabagAnnotationError()
283
-    {
284
-        $this->expectException(SetupException::class);
285
-        $this->getAttributes(ExtendAnnotated::class, ['withBagsError']);
286
-    }
287
-
288
-    public function testUploadAnnotationWrongName()
289
-    {
290
-        $this->expectException(SetupException::class);
291
-        $this->getAttributes(ExtendAnnotated::class, ['saveFilesWrongName']);
292
-    }
293
-
294
-    public function testUploadAnnotationMultiple()
295
-    {
296
-        $this->expectException(SetupException::class);
297
-        $this->getAttributes(ExtendAnnotated::class, ['saveFilesMultiple']);
298
-    }
299
-
300
-    public function testCallbacksBeforeAnnotationNoCall()
301
-    {
302
-        $this->expectException(SetupException::class);
303
-        $this->getAttributes(ExtendAnnotated::class, ['cbBeforeNoCall']);
304
-    }
305
-
306
-    public function testCallbacksBeforeAnnotationUnknownAttr()
307
-    {
308
-        $this->expectException(SetupException::class);
309
-        $this->getAttributes(ExtendAnnotated::class, ['cbBeforeUnknownAttr']);
310
-    }
311
-
312
-    public function testCallbacksBeforeAnnotationWrongAttrType()
313
-    {
314
-        $this->expectException(SetupException::class);
315
-        $this->getAttributes(ExtendAnnotated::class, ['cbBeforeWrongAttrType']);
316
-    }
317
-
318
-    public function testCallbacksAfterAnnotationNoCall()
319
-    {
320
-        $this->expectException(SetupException::class);
321
-        $this->getAttributes(ExtendAnnotated::class, ['cbAfterNoCall']);
322
-    }
323
-
324
-    public function testCallbacksAfterAnnotationUnknownAttr()
325
-    {
326
-        $this->expectException(SetupException::class);
327
-        $this->getAttributes(ExtendAnnotated::class, ['cbAfterUnknownAttr']);
328
-    }
329
-
330
-    public function testCallbacksAfterAnnotationWrongAttrType()
331
-    {
332
-        $this->expectException(SetupException::class);
333
-        $this->getAttributes(ExtendAnnotated::class, ['cbAfterWrongAttrType']);
334
-    }
335
-
336
-    public function testContainerAnnotationUnknownAttr()
337
-    {
338
-        $this->expectException(SetupException::class);
339
-        $this->getAttributes(ExtendAnnotated::class, ['diUnknownAttr']);
340
-    }
341
-
342
-    public function testContainerAnnotationWrongAttrType()
343
-    {
344
-        $this->expectException(SetupException::class);
345
-        $this->getAttributes(ExtendAnnotated::class, ['diWrongAttrType']);
346
-    }
347
-
348
-    public function testContainerAnnotationWrongClassType()
349
-    {
350
-        $this->expectException(SetupException::class);
351
-        $this->getAttributes(ExtendAnnotated::class, ['diWrongClassType']);
352
-    }
353
-
354
-    public function testContainerAnnotationWrongVarCount()
355
-    {
356
-        $this->expectException(SetupException::class);
357
-        $this->getAttributes(ExtendAnnotated::class, ['diWrongVarCount']);
358
-    }
263
+public function testClassExcludeAnnotation()
264
+{
265
+$xMetadata = $this->getAttributes(ClassExcluded::class,
266
+['doNot', 'withBags', 'cbSingle']);
267
+$bExcluded = $xMetadata->isExcluded();
268
+$aProperties = $xMetadata->getProperties();
269
+$aExcluded = $xMetadata->getExceptMethods();
270
+
271
+$this->assertTrue($bExcluded);
272
+$this->assertEmpty($aProperties);
273
+$this->assertEmpty($aExcluded);
274
+}
275
+
276
+public function testExcludeAnnotationError()
277
+{
278
+$this->expectException(SetupException::class);
279
+$this->getAttributes(ExtendAnnotated::class, ['doNotError']);
280
+}
281
+
282
+public function testDatabagAnnotationError()
283
+{
284
+$this->expectException(SetupException::class);
285
+$this->getAttributes(ExtendAnnotated::class, ['withBagsError']);
286
+}
287
+
288
+public function testUploadAnnotationWrongName()
289
+{
290
+$this->expectException(SetupException::class);
291
+$this->getAttributes(ExtendAnnotated::class, ['saveFilesWrongName']);
292
+}
293
+
294
+public function testUploadAnnotationMultiple()
295
+{
296
+$this->expectException(SetupException::class);
297
+$this->getAttributes(ExtendAnnotated::class, ['saveFilesMultiple']);
298
+}
299
+
300
+public function testCallbacksBeforeAnnotationNoCall()
301
+{
302
+$this->expectException(SetupException::class);
303
+$this->getAttributes(ExtendAnnotated::class, ['cbBeforeNoCall']);
304
+}
305
+
306
+public function testCallbacksBeforeAnnotationUnknownAttr()
307
+{
308
+$this->expectException(SetupException::class);
309
+$this->getAttributes(ExtendAnnotated::class, ['cbBeforeUnknownAttr']);
310
+}
311
+
312
+public function testCallbacksBeforeAnnotationWrongAttrType()
313
+{
314
+$this->expectException(SetupException::class);
315
+$this->getAttributes(ExtendAnnotated::class, ['cbBeforeWrongAttrType']);
316
+}
317
+
318
+public function testCallbacksAfterAnnotationNoCall()
319
+{
320
+$this->expectException(SetupException::class);
321
+$this->getAttributes(ExtendAnnotated::class, ['cbAfterNoCall']);
322
+}
323
+
324
+public function testCallbacksAfterAnnotationUnknownAttr()
325
+{
326
+$this->expectException(SetupException::class);
327
+$this->getAttributes(ExtendAnnotated::class, ['cbAfterUnknownAttr']);
328
+}
329
+
330
+public function testCallbacksAfterAnnotationWrongAttrType()
331
+{
332
+$this->expectException(SetupException::class);
333
+$this->getAttributes(ExtendAnnotated::class, ['cbAfterWrongAttrType']);
334
+}
335
+
336
+public function testContainerAnnotationUnknownAttr()
337
+{
338
+$this->expectException(SetupException::class);
339
+$this->getAttributes(ExtendAnnotated::class, ['diUnknownAttr']);
340
+}
341
+
342
+public function testContainerAnnotationWrongAttrType()
343
+{
344
+$this->expectException(SetupException::class);
345
+$this->getAttributes(ExtendAnnotated::class, ['diWrongAttrType']);
346
+}
347
+
348
+public function testContainerAnnotationWrongClassType()
349
+{
350
+$this->expectException(SetupException::class);
351
+$this->getAttributes(ExtendAnnotated::class, ['diWrongClassType']);
352
+}
353
+
354
+public function testContainerAnnotationWrongVarCount()
355
+{
356
+$this->expectException(SetupException::class);
357
+$this->getAttributes(ExtendAnnotated::class, ['diWrongVarCount']);
358
+}
359 359
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/ExportData.php 2 patches
Switch Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -22,53 +22,53 @@
 block discarded – undo
22 22
 
23 23
 class ExportData extends AbstractData
24 24
 {
25
-    /**
25
+/**
26 26
      * @var array<string, array<string>>
27 27
      */
28
-    private array $aMethods = [];
28
+private array $aMethods = [];
29 29
 
30
-    /**
30
+/**
31 31
      * @return string
32 32
      */
33
-    public function getName(): string
34
-    {
35
-        return 'export';
36
-    }
33
+public function getName(): string
34
+{
35
+return 'export';
36
+}
37 37
 
38
-    /**
38
+/**
39 39
      * @return mixed
40 40
      */
41
-    public function getValue(): mixed
42
-    {
43
-        return $this->aMethods;
44
-    }
41
+public function getValue(): mixed
42
+{
43
+return $this->aMethods;
44
+}
45 45
 
46
-    /**
46
+/**
47 47
      * @param array $aMethods
48 48
      *
49 49
      * @return void
50 50
      */
51
-    public function setMethods(array $aMethods): void
51
+public function setMethods(array $aMethods): void
52
+{
53
+foreach(['base', 'only', 'except'] as $sKey)
54
+{
55
+foreach($aMethods[$sKey] ?? [] as $sMethod)
56
+{
57
+    if(!is_string($sMethod) || !$this->validateMethod($sMethod))
52 58
     {
53
-        foreach(['base', 'only', 'except'] as $sKey)
54
-        {
55
-            foreach($aMethods[$sKey] ?? [] as $sMethod)
56
-            {
57
-                if(!is_string($sMethod) || !$this->validateMethod($sMethod))
58
-                {
59
-                    throw new SetupException("'$sMethod' is not a valid method name.");
60
-                }
61
-            }
62
-        }
63
-        $this->aMethods = $aMethods;
59
+        throw new SetupException("'$sMethod' is not a valid method name.");
64 60
     }
61
+}
62
+}
63
+$this->aMethods = $aMethods;
64
+}
65 65
 
66
-    /**
66
+/**
67 67
      * @inheritDoc
68 68
      */
69
-    public function encode(string $sVarName): array
70
-    {
71
-        $sMethods = addslashes(json_encode($this->aMethods));
72
-        return ["{$sVarName}->setMethods(json_decode(\"$sMethods\", true));"];
73
-    }
69
+public function encode(string $sVarName): array
70
+{
71
+$sMethods = addslashes(json_encode($this->aMethods));
72
+return ["{$sVarName}->setMethods(json_decode(\"$sMethods\", true));"];
73
+}
74 74
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,11 +50,11 @@
 block discarded – undo
50 50
      */
51 51
     public function setMethods(array $aMethods): void
52 52
     {
53
-        foreach(['base', 'only', 'except'] as $sKey)
53
+        foreach (['base', 'only', 'except'] as $sKey)
54 54
         {
55
-            foreach($aMethods[$sKey] ?? [] as $sMethod)
55
+            foreach ($aMethods[$sKey] ?? [] as $sMethod)
56 56
             {
57
-                if(!is_string($sMethod) || !$this->validateMethod($sMethod))
57
+                if (!is_string($sMethod) || !$this->validateMethod($sMethod))
58 58
                 {
59 59
                     throw new SetupException("'$sMethod' is not a valid method name.");
60 60
                 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Request/CallableClass/ComponentOptions.php 1 patch
Spacing   +22 added lines, -25 removed lines patch added patch discarded remove patch
@@ -106,18 +106,18 @@  discard block
 block discarded – undo
106 106
         $sSeparator = $aOptions['separator'] ?? '.';
107 107
         $this->sSeparator = $sSeparator === '_' ? '_' : '.';
108 108
         $this->addProtectedMethods($aOptions['protected'] ?? []);
109
-        foreach($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
109
+        foreach ($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
110 110
         {
111 111
             // Names are in a comma-separated list.
112 112
             $aFunctionNames = explode(',', $sNames);
113
-            foreach($aFunctionNames as $sFunctionName)
113
+            foreach ($aFunctionNames as $sFunctionName)
114 114
             {
115 115
                 $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
116 116
             }
117 117
         }
118 118
 
119 119
         // Options from the attributes or annotations.
120
-        if($xMetadata !== null)
120
+        if ($xMetadata !== null)
121 121
         {
122 122
             $this->readMetadataOptions($xMetadata);
123 123
         }
@@ -133,8 +133,7 @@  discard block
 block discarded – undo
133 133
     private function addProtectedMethods(array|string $xMethods): void
134 134
     {
135 135
         $this->aExportMethods['except'] = array_merge($this->aExportMethods['except'],
136
-            !is_array($xMethods) ? [trim((string)$xMethods)] :
137
-            array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
136
+            !is_array($xMethods) ? [trim((string)$xMethods)] : array_map(fn($sMethod) => trim((string)$sMethod), $xMethods));
138 137
     }
139 138
 
140 139
     /**
@@ -149,7 +148,7 @@  discard block
 block discarded – undo
149 148
         $aExportMethods['except'] = array_unique(array_merge(
150 149
             $aExportMethods['except'] ?? [], $this->aExportMethods['except']));
151 150
         $this->aExportMethods = $aExportMethods;
152
-        foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
151
+        foreach ($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
153 152
         {
154 153
             $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
155 154
         }
@@ -162,7 +161,7 @@  discard block
 block discarded – undo
162 161
      */
163 162
     private function filterPublicMethods(array $aMethods): array
164 163
     {
165
-        if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
164
+        if ($this->bExcluded || in_array('*', $this->aExportMethods['except']))
166 165
         {
167 166
             return [];
168 167
         }
@@ -170,12 +169,12 @@  discard block
 block discarded – undo
170 169
         $aBaseMethods = $aMethods[1];
171 170
         $aNoMethods = $aMethods[2];
172 171
         $aMethods = $aMethods[0];
173
-        if(isset($this->aExportMethods['only']))
172
+        if (isset($this->aExportMethods['only']))
174 173
         {
175 174
             $aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
176 175
         }
177 176
         $aMethods = array_diff($aMethods, $this->aExportMethods['except']);
178
-        if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
177
+        if (count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
179 178
         {
180 179
             $aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
181 180
         }
@@ -261,19 +260,19 @@  discard block
 block discarded – undo
261 260
      */
262 261
     private function setHookMethods(array &$aHookMethods, $xValue): void
263 262
     {
264
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
263
+        foreach ($xValue as $sCalledMethod => $xMethodToCall)
265 264
         {
266
-            if(!isset($aHookMethods[$sCalledMethod]))
265
+            if (!isset($aHookMethods[$sCalledMethod]))
267 266
             {
268 267
                 $aHookMethods[$sCalledMethod] = [];
269 268
             }
270
-            if(is_array($xMethodToCall))
269
+            if (is_array($xMethodToCall))
271 270
             {
272 271
                 $aHookMethods[$sCalledMethod] =
273 272
                     array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
274 273
                 continue;
275 274
             }
276
-            if(is_string($xMethodToCall))
275
+            if (is_string($xMethodToCall))
277 276
             {
278 277
                 $aHookMethods[$sCalledMethod][] = $xMethodToCall;
279 278
             }
@@ -298,7 +297,7 @@  discard block
 block discarded – undo
298 297
      */
299 298
     private function addOption(string $sName, $xValue): void
300 299
     {
301
-        switch($sName)
300
+        switch ($sName)
302 301
         {
303 302
         // Set the methods to call before processing the request
304 303
         case '__before':
@@ -326,11 +325,11 @@  discard block
 block discarded – undo
326 325
      */
327 326
     private function _addJsArrayOption(string $sFunctionName, string $sOptionName, $xOptionValue): void
328 327
     {
329
-        if(is_string($xOptionValue))
328
+        if (is_string($xOptionValue))
330 329
         {
331 330
             $xOptionValue = [$xOptionValue];
332 331
         }
333
-        if(!is_array($xOptionValue))
332
+        if (!is_array($xOptionValue))
334 333
         {
335 334
             return; // Do not save.
336 335
         }
@@ -360,10 +359,10 @@  discard block
 block discarded – undo
360 359
      */
361 360
     private function addJsOption(string $sFunctionName, string $sOptionName, $xOptionValue): void
362 361
     {
363
-        switch($sOptionName)
362
+        switch ($sOptionName)
364 363
         {
365 364
         case 'excluded':
366
-            if((bool)$xOptionValue)
365
+            if ((bool)$xOptionValue)
367 366
             {
368 367
                 $this->addProtectedMethods($sFunctionName);
369 368
             }
@@ -387,12 +386,11 @@  discard block
 block discarded – undo
387 386
      */
388 387
     private function addFunctionOptions(string $sFunctionName, array $aFunctionOptions): void
389 388
     {
390
-        foreach($aFunctionOptions as $sOptionName => $xOptionValue)
389
+        foreach ($aFunctionOptions as $sOptionName => $xOptionValue)
391 390
         {
392 391
             substr($sOptionName, 0, 2) === '__' ?
393 392
                 // Options for PHP classes. They start with "__".
394
-                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) :
395
-                // Options for javascript code.
393
+                $this->addOption($sOptionName, [$sFunctionName => $xOptionValue]) : // Options for javascript code.
396 394
                 $this->addJsOption($sFunctionName, $sOptionName, $xOptionValue);
397 395
         }
398 396
     }
@@ -408,16 +406,15 @@  discard block
 block discarded – undo
408 406
         $aOptions = array_merge($this->aJsOptions['*'] ?? []); // Clone the array
409 407
         // Then add the method options.
410 408
         $aMethodOptions = $this->aJsOptions[$sMethodName] ?? [];
411
-        foreach($aMethodOptions as $sOptionName => $xOptionValue)
409
+        foreach ($aMethodOptions as $sOptionName => $xOptionValue)
412 410
         {
413 411
             // For databags and callbacks, merge the values in a single array.
414 412
             // For all the other options, keep the last value.
415 413
             $aOptions[$sOptionName] = !in_array($sOptionName, ['bags', 'callback']) ?
416
-                $xOptionValue :
417
-                array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
414
+                $xOptionValue : array_unique(array_merge($aOptions[$sOptionName] ?? [], $xOptionValue));
418 415
         }
419 416
         // Since callbacks are js object names, they need a special formatting.
420
-        if(isset($aOptions['callback']))
417
+        if (isset($aOptions['callback']))
421 418
         {
422 419
             $aOptions['callback'] = str_replace('"', '', json_encode($aOptions['callback']));
423 420
         }
Please login to merge, or discard this patch.