Passed
Push — main ( 273db0...683317 )
by Thierry
03:54
created
jaxon-upload/src/Manager/FileStorage.php 1 patch
Switch Indentation   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -28,146 +28,146 @@
 block discarded – undo
28 28
 
29 29
 class FileStorage
30 30
 {
31
-    /**
31
+/**
32 32
      * @var ConfigManager
33 33
      */
34
-    protected $xConfigManager;
34
+protected $xConfigManager;
35 35
 
36
-    /**
36
+/**
37 37
      * @var Translator
38 38
      */
39
-    protected $xTranslator;
39
+protected $xTranslator;
40 40
 
41
-    /**
41
+/**
42 42
      * @var array
43 43
      */
44
-    protected $aAdapters = [];
44
+protected $aAdapters = [];
45 45
 
46
-    /**
46
+/**
47 47
      * @var array
48 48
      */
49
-    protected $aFilesystems = [];
49
+protected $aFilesystems = [];
50 50
 
51
-    /**
51
+/**
52 52
      * The constructor
53 53
      *
54 54
      * @param ConfigManager $xConfigManager
55 55
      * @param Translator $xTranslator
56 56
      */
57
-    public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
58
-    {
59
-        $this->xConfigManager = $xConfigManager;
60
-        $this->xTranslator = $xTranslator;
61
-        $this->registerAdapters();
62
-    }
63
-
64
-    /**
57
+public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
58
+{
59
+$this->xConfigManager = $xConfigManager;
60
+$this->xTranslator = $xTranslator;
61
+$this->registerAdapters();
62
+}
63
+
64
+/**
65 65
      * @param string $sStorage
66 66
      * @param Closure $cFactory
67 67
      *
68 68
      * @return void
69 69
      */
70
-    public function registerAdapter(string $sStorage, Closure $cFactory)
71
-    {
72
-        $this->aAdapters[$sStorage] = $cFactory;
73
-    }
70
+public function registerAdapter(string $sStorage, Closure $cFactory)
71
+{
72
+$this->aAdapters[$sStorage] = $cFactory;
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * Register the file storage adapters
77 77
      *
78 78
      * @return void
79 79
      */
80
-    private function registerAdapters()
81
-    {
82
-        // Local file system adapter
83
-        $this->registerAdapter('local', function(string $sRootDir, $xOptions) {
84
-            return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) :
85
-                new LocalFilesystemAdapter($sRootDir, $xOptions);
86
-        });
87
-
88
-        // AWS S3 file system adapter
89
-        $this->registerAdapter('aws-s3', function(string $sRootDir, array $aOptions) {
90
-            /** @var \Aws\S3\S3ClientInterface $client */
91
-            $client = new \Aws\S3\S3Client($aOptions['client'] ?? []);
92
-            return new \League\Flysystem\AwsS3V3\AwsS3V3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir);
93
-        });
94
-
95
-        // Async AWS S3 file system adapter
96
-        $this->registerAdapter('async-aws-s3', function(string $sRootDir, array $aOptions) {
97
-            $client = isset($aOptions['client']) ? new \AsyncAws\S3\S3Client($aOptions['client']) : new \AsyncAws\S3\S3Client();
98
-            return new \League\Flysystem\AsyncAwsS3\AsyncAwsS3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir);
99
-        });
100
-
101
-        // Google Cloud file system adapter
102
-        $this->registerAdapter('google-cloud', function(string $sRootDir, array $aOptions) {
103
-            $storageClient = new \Google\Cloud\Storage\StorageClient($aOptions['client'] ?? []);
104
-            $bucket = $storageClient->bucket($aOptions['bucket'] ?? '');
105
-            return new \League\Flysystem\AzureBlobStorage\GoogleCloudStorageAdapter($bucket, $sRootDir);
106
-        });
107
-
108
-        // Microsoft Azure file system adapter
109
-        $this->registerAdapter('azure-blob', function(string $sRootDir, array $aOptions) {
110
-            $client = \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobService($aOptions['dsn']);
111
-            return new \League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter($client, $aOptions['container'], $sRootDir);
112
-        });
113
-
114
-        // FTP file system adapter
115
-        $this->registerAdapter('ftp', function(string $sRootDir, array $aOptions) {
116
-            $aOptions['root'] = $sRootDir;
117
-            $xOptions = \League\Flysystem\Ftp\FtpConnectionOptions::fromArray($aOptions);
118
-            return new \League\Flysystem\Ftp\FtpAdapter($xOptions);
119
-        });
120
-
121
-        // SFTP V2 file system adapter
122
-        $this->registerAdapter('sftp-v2', function(string $sRootDir, array $aOptions) {
123
-            $provider = new \League\Flysystem\PhpseclibV2\SftpConnectionProvider(...$aOptions);
124
-            return new \League\Flysystem\PhpseclibV2\SftpAdapter($provider, $sRootDir);
125
-        });
126
-
127
-        // SFTP V3 file system adapter
128
-        $this->registerAdapter('sftp-v3', function(string $sRootDir, array $aOptions) {
129
-            $provider = new \League\Flysystem\PhpseclibV3\SftpConnectionProvider(...$aOptions);
130
-            return new \League\Flysystem\PhpseclibV3\SftpAdapter($provider, $sRootDir);
131
-        });
132
-    }
133
-
134
-    /**
80
+private function registerAdapters()
81
+{
82
+// Local file system adapter
83
+$this->registerAdapter('local', function(string $sRootDir, $xOptions) {
84
+return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) :
85
+    new LocalFilesystemAdapter($sRootDir, $xOptions);
86
+});
87
+
88
+// AWS S3 file system adapter
89
+$this->registerAdapter('aws-s3', function(string $sRootDir, array $aOptions) {
90
+/** @var \Aws\S3\S3ClientInterface $client */
91
+$client = new \Aws\S3\S3Client($aOptions['client'] ?? []);
92
+return new \League\Flysystem\AwsS3V3\AwsS3V3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir);
93
+});
94
+
95
+// Async AWS S3 file system adapter
96
+$this->registerAdapter('async-aws-s3', function(string $sRootDir, array $aOptions) {
97
+$client = isset($aOptions['client']) ? new \AsyncAws\S3\S3Client($aOptions['client']) : new \AsyncAws\S3\S3Client();
98
+return new \League\Flysystem\AsyncAwsS3\AsyncAwsS3Adapter($client, $aOptions['bucket'] ?? '', $sRootDir);
99
+});
100
+
101
+// Google Cloud file system adapter
102
+$this->registerAdapter('google-cloud', function(string $sRootDir, array $aOptions) {
103
+$storageClient = new \Google\Cloud\Storage\StorageClient($aOptions['client'] ?? []);
104
+$bucket = $storageClient->bucket($aOptions['bucket'] ?? '');
105
+return new \League\Flysystem\AzureBlobStorage\GoogleCloudStorageAdapter($bucket, $sRootDir);
106
+});
107
+
108
+// Microsoft Azure file system adapter
109
+$this->registerAdapter('azure-blob', function(string $sRootDir, array $aOptions) {
110
+$client = \MicrosoftAzure\Storage\Blob\BlobRestProxy::createBlobService($aOptions['dsn']);
111
+return new \League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter($client, $aOptions['container'], $sRootDir);
112
+});
113
+
114
+// FTP file system adapter
115
+$this->registerAdapter('ftp', function(string $sRootDir, array $aOptions) {
116
+$aOptions['root'] = $sRootDir;
117
+$xOptions = \League\Flysystem\Ftp\FtpConnectionOptions::fromArray($aOptions);
118
+return new \League\Flysystem\Ftp\FtpAdapter($xOptions);
119
+});
120
+
121
+// SFTP V2 file system adapter
122
+$this->registerAdapter('sftp-v2', function(string $sRootDir, array $aOptions) {
123
+$provider = new \League\Flysystem\PhpseclibV2\SftpConnectionProvider(...$aOptions);
124
+return new \League\Flysystem\PhpseclibV2\SftpAdapter($provider, $sRootDir);
125
+});
126
+
127
+// SFTP V3 file system adapter
128
+$this->registerAdapter('sftp-v3', function(string $sRootDir, array $aOptions) {
129
+$provider = new \League\Flysystem\PhpseclibV3\SftpConnectionProvider(...$aOptions);
130
+return new \League\Flysystem\PhpseclibV3\SftpAdapter($provider, $sRootDir);
131
+});
132
+}
133
+
134
+/**
135 135
      * @param string $sField
136 136
      *
137 137
      * @return Filesystem
138 138
      * @throws RequestException
139 139
      */
140
-    public function filesystem(string $sField = ''): Filesystem
141
-    {
142
-        $sField = trim($sField);
143
-        if(isset($this->aFilesystems[$sField]))
144
-        {
145
-            return $this->aFilesystems[$sField];
146
-        }
147
-
148
-        // Default upload dir
149
-        $sStorage = $this->xConfigManager->getOption('upload.default.storage', 'local');
150
-        $sRootDir = $this->xConfigManager->getOption('upload.default.dir', '');
151
-        $aOptions = $this->xConfigManager->getOption('upload.default.options');
152
-        $sConfigKey = "upload.files.$sField";
153
-        if($sField !== '' && $this->xConfigManager->hasOption($sConfigKey))
154
-        {
155
-            $sStorage = $this->xConfigManager->getOption("$sConfigKey.storage", $sStorage);
156
-            $sRootDir = $this->xConfigManager->getOption("$sConfigKey.dir", $sRootDir);
157
-            $aOptions = $this->xConfigManager->getOption("$sConfigKey.options", $aOptions);
158
-        }
159
-
160
-        if(!is_string($sRootDir))
161
-        {
162
-            throw new RequestException($this->xTranslator->trans('errors.upload.dir'));
163
-        }
164
-        if(!isset($this->aAdapters[$sStorage]))
165
-        {
166
-            throw new RequestException($this->xTranslator->trans('errors.upload.adapter'));
167
-        }
168
-
169
-        $xAdapter = call_user_func($this->aAdapters[$sStorage], $sRootDir, $aOptions);
170
-        $this->aFilesystems[$sField] = new Filesystem($xAdapter);
171
-        return $this->aFilesystems[$sField];
172
-    }
140
+public function filesystem(string $sField = ''): Filesystem
141
+{
142
+$sField = trim($sField);
143
+if(isset($this->aFilesystems[$sField]))
144
+{
145
+return $this->aFilesystems[$sField];
146
+}
147
+
148
+// Default upload dir
149
+$sStorage = $this->xConfigManager->getOption('upload.default.storage', 'local');
150
+$sRootDir = $this->xConfigManager->getOption('upload.default.dir', '');
151
+$aOptions = $this->xConfigManager->getOption('upload.default.options');
152
+$sConfigKey = "upload.files.$sField";
153
+if($sField !== '' && $this->xConfigManager->hasOption($sConfigKey))
154
+{
155
+$sStorage = $this->xConfigManager->getOption("$sConfigKey.storage", $sStorage);
156
+$sRootDir = $this->xConfigManager->getOption("$sConfigKey.dir", $sRootDir);
157
+$aOptions = $this->xConfigManager->getOption("$sConfigKey.options", $aOptions);
158
+}
159
+
160
+if(!is_string($sRootDir))
161
+{
162
+throw new RequestException($this->xTranslator->trans('errors.upload.dir'));
163
+}
164
+if(!isset($this->aAdapters[$sStorage]))
165
+{
166
+throw new RequestException($this->xTranslator->trans('errors.upload.adapter'));
167
+}
168
+
169
+$xAdapter = call_user_func($this->aAdapters[$sStorage], $sRootDir, $aOptions);
170
+$this->aFilesystems[$sField] = new Filesystem($xAdapter);
171
+return $this->aFilesystems[$sField];
172
+}
173 173
 }
Please login to merge, or discard this patch.
jaxon-upload/src/Manager/Validator.php 1 patch
Switch Indentation   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -30,46 +30,46 @@  discard block
 block discarded – undo
30 30
 
31 31
 class Validator
32 32
 {
33
-    /**
33
+/**
34 34
      * The config manager
35 35
      *
36 36
      * @var ConfigManager
37 37
      */
38
-    protected $xConfigManager;
38
+protected $xConfigManager;
39 39
 
40
-    /**
40
+/**
41 41
      * The translator
42 42
      *
43 43
      * @var Translator
44 44
      */
45
-    protected $xTranslator;
45
+protected $xTranslator;
46 46
 
47
-    /**
47
+/**
48 48
      * The last error message
49 49
      *
50 50
      * @var string
51 51
      */
52
-    protected $sErrorMessage;
52
+protected $sErrorMessage;
53 53
 
54
-    public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
55
-    {
56
-        // Set the config manager
57
-        $this->xConfigManager = $xConfigManager;
58
-        // Set the translator
59
-        $this->xTranslator = $xTranslator;
60
-    }
54
+public function __construct(ConfigManager $xConfigManager, Translator $xTranslator)
55
+{
56
+// Set the config manager
57
+$this->xConfigManager = $xConfigManager;
58
+// Set the translator
59
+$this->xTranslator = $xTranslator;
60
+}
61 61
 
62
-    /**
62
+/**
63 63
      * Get the last error message
64 64
      *
65 65
      * @return string
66 66
      */
67
-    public function getErrorMessage(): string
68
-    {
69
-        return $this->sErrorMessage;
70
-    }
67
+public function getErrorMessage(): string
68
+{
69
+return $this->sErrorMessage;
70
+}
71 71
 
72
-    /**
72
+/**
73 73
      * Validate a property of an uploaded file
74 74
      *
75 75
      * @param string $sVarName    The uploaded file variable name
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
      *
80 80
      * @return bool
81 81
      */
82
-    private function validateFileProperty(string $sVarName, string $sValue, string $sProperty, string $sField): bool
83
-    {
84
-        $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty);
85
-        $aAllowed = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
86
-        if(is_array($aAllowed) && !in_array($sValue, $aAllowed))
87
-        {
88
-            $this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sField, [$sField => $sValue]);
89
-            return false;
90
-        }
91
-        return true;
92
-    }
93
-
94
-    /**
82
+private function validateFileProperty(string $sVarName, string $sValue, string $sProperty, string $sField): bool
83
+{
84
+$xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty);
85
+$aAllowed = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
86
+if(is_array($aAllowed) && !in_array($sValue, $aAllowed))
87
+{
88
+$this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sField, [$sField => $sValue]);
89
+return false;
90
+}
91
+return true;
92
+}
93
+
94
+/**
95 95
      * Validate the size of an uploaded file
96 96
      *
97 97
      * @param string $sVarName    The uploaded file variable name
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
      *
101 101
      * @return bool
102 102
      */
103
-    private function validateFileSize(string $sVarName, int $nFileSize, string $sProperty): bool
104
-    {
105
-        $xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty, 0);
106
-        $nSize = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
107
-        if($nSize > 0 && (
108
-            ($sProperty == 'max-size' && $nFileSize > $nSize) ||
109
-            ($sProperty == 'min-size' && $nFileSize < $nSize)))
110
-        {
111
-            $this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sProperty, ['size' => $nFileSize]);
112
-            return false;
113
-        }
114
-        return true;
115
-    }
116
-
117
-    /**
103
+private function validateFileSize(string $sVarName, int $nFileSize, string $sProperty): bool
104
+{
105
+$xDefault = $this->xConfigManager->getOption('upload.default.' . $sProperty, 0);
106
+$nSize = $this->xConfigManager->getOption('upload.files.' . $sVarName . '.' . $sProperty, $xDefault);
107
+if($nSize > 0 && (
108
+($sProperty == 'max-size' && $nFileSize > $nSize) ||
109
+($sProperty == 'min-size' && $nFileSize < $nSize)))
110
+{
111
+$this->sErrorMessage = $this->xTranslator->trans('errors.upload.' . $sProperty, ['size' => $nFileSize]);
112
+return false;
113
+}
114
+return true;
115
+}
116
+
117
+/**
118 118
      * Validate an uploaded file
119 119
      *
120 120
      * @param string $sVarName    The uploaded file variable name
@@ -122,33 +122,33 @@  discard block
 block discarded – undo
122 122
      *
123 123
      * @return bool
124 124
      */
125
-    public function validateUploadedFile(string $sVarName, File $xFile): bool
126
-    {
127
-        $this->sErrorMessage = '';
128
-        // Verify the file extension
129
-        if(!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type'))
130
-        {
131
-            return false;
132
-        }
133
-
134
-        // Verify the file extension
135
-        if(!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension'))
136
-        {
137
-            return false;
138
-        }
139
-
140
-        // Verify the max size
141
-        if(!$this->validateFileSize($sVarName, $xFile->size(), 'max-size'))
142
-        {
143
-            return false;
144
-        }
145
-
146
-        // Verify the min size
147
-        if(!$this->validateFileSize($sVarName, $xFile->size(), 'min-size'))
148
-        {
149
-            return false;
150
-        }
151
-
152
-        return true;
153
-    }
125
+public function validateUploadedFile(string $sVarName, File $xFile): bool
126
+{
127
+$this->sErrorMessage = '';
128
+// Verify the file extension
129
+if(!$this->validateFileProperty($sVarName, $xFile->type(), 'types', 'type'))
130
+{
131
+return false;
132
+}
133
+
134
+// Verify the file extension
135
+if(!$this->validateFileProperty($sVarName, $xFile->extension(), 'extensions', 'extension'))
136
+{
137
+return false;
138
+}
139
+
140
+// Verify the max size
141
+if(!$this->validateFileSize($sVarName, $xFile->size(), 'max-size'))
142
+{
143
+return false;
144
+}
145
+
146
+// Verify the min size
147
+if(!$this->validateFileSize($sVarName, $xFile->size(), 'min-size'))
148
+{
149
+return false;
150
+}
151
+
152
+return true;
153
+}
154 154
 }
Please login to merge, or discard this patch.
jaxon-core/src/Jaxon.php 1 patch
Switch Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
 
17 17
 class Jaxon
18 18
 {
19
-    /**
19
+/**
20 20
      * @const string
21 21
      */
22
-    public const VERSION = 'Jaxon 5.x';
22
+public const VERSION = 'Jaxon 5.x';
23 23
 
24
-    /**
24
+/**
25 25
      * @const string
26 26
      */
27
-    public const CALLABLE_CLASS = 'CallableClass';
27
+public const CALLABLE_CLASS = 'CallableClass';
28 28
 
29
-    /**
29
+/**
30 30
      * @const string
31 31
      */
32
-    public const CALLABLE_DIR = 'CallableDir';
32
+public const CALLABLE_DIR = 'CallableDir';
33 33
 
34
-    /**
34
+/**
35 35
      * @const string
36 36
      */
37
-    public const CALLABLE_FUNCTION = 'CallableFunction';
37
+public const CALLABLE_FUNCTION = 'CallableFunction';
38 38
 }
Please login to merge, or discard this patch.
jaxon-core/src/Request/Target.php 1 patch
Switch Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -17,56 +17,56 @@  discard block
 block discarded – undo
17 17
 
18 18
 class Target implements TargetInterface
19 19
 {
20
-    /**
20
+/**
21 21
      * The target type for function.
22 22
      *
23 23
      * @var string
24 24
      */
25
-    const TYPE_FUNCTION = 'TargetFunction';
25
+const TYPE_FUNCTION = 'TargetFunction';
26 26
 
27
-    /**
27
+/**
28 28
      * The target type for class.
29 29
      *
30 30
      * @var string
31 31
      */
32
-    const TYPE_CLASS = 'TargetClass';
32
+const TYPE_CLASS = 'TargetClass';
33 33
 
34
-    /**
34
+/**
35 35
      * The target type.
36 36
      *
37 37
      * @var string
38 38
      */
39
-    private $sType = '';
39
+private $sType = '';
40 40
 
41
-    /**
41
+/**
42 42
      * The target function name.
43 43
      *
44 44
      * @var string
45 45
      */
46
-    private $sFunctionName = '';
46
+private $sFunctionName = '';
47 47
 
48
-    /**
48
+/**
49 49
      * The target class name.
50 50
      *
51 51
      * @var string
52 52
      */
53
-    private $sClassName = '';
53
+private $sClassName = '';
54 54
 
55
-    /**
55
+/**
56 56
      * The target method name.
57 57
      *
58 58
      * @var string
59 59
      */
60
-    private $sMethodName = '';
60
+private $sMethodName = '';
61 61
 
62
-    /**
62
+/**
63 63
      * The target method args.
64 64
      *
65 65
      * @var array
66 66
      */
67
-    private $aMethodArgs = [];
67
+private $aMethodArgs = [];
68 68
 
69
-    /**
69
+/**
70 70
      * The constructor
71 71
      *
72 72
      * @param string $sType    The target type
@@ -75,116 +75,116 @@  discard block
 block discarded – undo
75 75
      * @param string $sMethodName    The method name
76 76
      * @param array $aMethodArgs    The method args
77 77
      */
78
-    private function __construct(string $sType, string $sFunctionName, string $sClassName, string $sMethodName, array $aMethodArgs = [])
79
-    {
80
-        $this->sType = $sType;
81
-        $this->sFunctionName = $sFunctionName;
82
-        $this->sClassName = $sClassName;
83
-        $this->sMethodName = $sMethodName;
84
-        $this->aMethodArgs = $aMethodArgs;
85
-    }
78
+private function __construct(string $sType, string $sFunctionName, string $sClassName, string $sMethodName, array $aMethodArgs = [])
79
+{
80
+$this->sType = $sType;
81
+$this->sFunctionName = $sFunctionName;
82
+$this->sClassName = $sClassName;
83
+$this->sMethodName = $sMethodName;
84
+$this->aMethodArgs = $aMethodArgs;
85
+}
86 86
 
87
-    /**
87
+/**
88 88
      * Create a target of type Function
89 89
      *
90 90
      * @param string $sFunctionName    The function name
91 91
      *
92 92
      * @return Target
93 93
      */
94
-    public static function makeFunction(string $sFunctionName): Target
95
-    {
96
-        return new Target(self::TYPE_FUNCTION, $sFunctionName, '', '');
97
-    }
94
+public static function makeFunction(string $sFunctionName): Target
95
+{
96
+return new Target(self::TYPE_FUNCTION, $sFunctionName, '', '');
97
+}
98 98
 
99
-    /**
99
+/**
100 100
      * Create a target of type Class
101 101
      *
102 102
      * @param array $aCall
103 103
      *
104 104
      * @return Target
105 105
      */
106
-    public static function makeClass(array $aCall): Target
107
-    {
108
-        return new Target(self::TYPE_CLASS, '', trim($aCall['name']), trim($aCall['method']));
109
-    }
106
+public static function makeClass(array $aCall): Target
107
+{
108
+return new Target(self::TYPE_CLASS, '', trim($aCall['name']), trim($aCall['method']));
109
+}
110 110
 
111
-    /**
111
+/**
112 112
      * Check if the target type is Function.
113 113
      *
114 114
      * @return bool
115 115
      */
116
-    public function isFunction(): bool
117
-    {
118
-        return $this->sType === self::TYPE_FUNCTION;
119
-    }
116
+public function isFunction(): bool
117
+{
118
+return $this->sType === self::TYPE_FUNCTION;
119
+}
120 120
 
121
-    /**
121
+/**
122 122
      * Check if the target type is Class.
123 123
      *
124 124
      * @return bool
125 125
      */
126
-    public function isClass(): bool
127
-    {
128
-        return $this->sType === self::TYPE_CLASS;
129
-    }
126
+public function isClass(): bool
127
+{
128
+return $this->sType === self::TYPE_CLASS;
129
+}
130 130
 
131
-    /**
131
+/**
132 132
      * The target function name.
133 133
      *
134 134
      * @return string
135 135
      */
136
-    public function getFunctionName(): string
137
-    {
138
-        return $this->sFunctionName;
139
-    }
136
+public function getFunctionName(): string
137
+{
138
+return $this->sFunctionName;
139
+}
140 140
 
141
-    /**
141
+/**
142 142
      * The target class name.
143 143
      *
144 144
      * @return string
145 145
      */
146
-    public function getClassName(): string
147
-    {
148
-        return $this->sClassName;
149
-    }
146
+public function getClassName(): string
147
+{
148
+return $this->sClassName;
149
+}
150 150
 
151
-    /**
151
+/**
152 152
      * The target method name.
153 153
      *
154 154
      * @return string
155 155
      */
156
-    public function getMethodName(): string
157
-    {
158
-        return $this->sMethodName;
159
-    }
156
+public function getMethodName(): string
157
+{
158
+return $this->sMethodName;
159
+}
160 160
 
161
-    /**
161
+/**
162 162
      * Set the target method name.
163 163
      *
164 164
      * @param array $aMethodArgs
165 165
      */
166
-    public function setMethodArgs(array $aMethodArgs): void
167
-    {
168
-        $this->aMethodArgs = $aMethodArgs;
169
-    }
166
+public function setMethodArgs(array $aMethodArgs): void
167
+{
168
+$this->aMethodArgs = $aMethodArgs;
169
+}
170 170
 
171
-    /**
171
+/**
172 172
      * The target method name.
173 173
      *
174 174
      * @return string
175 175
      */
176
-    public function method(): string
177
-    {
178
-        return $this->sMethodName;
179
-    }
176
+public function method(): string
177
+{
178
+return $this->sMethodName;
179
+}
180 180
 
181
-    /**
181
+/**
182 182
      * The target method args.
183 183
      *
184 184
      * @return array
185 185
      */
186
-    public function args(): array
187
-    {
188
-        return $this->aMethodArgs;
189
-    }
186
+public function args(): array
187
+{
188
+return $this->aMethodArgs;
189
+}
190 190
 }
Please login to merge, or discard this patch.
jaxon-core/src/Plugin/Response/Databag/DatabagPlugin.php 1 patch
Switch Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -13,94 +13,94 @@
 block discarded – undo
13 13
 
14 14
 class DatabagPlugin extends AbstractResponsePlugin
15 15
 {
16
-    /**
16
+/**
17 17
      * @const The plugin name
18 18
      */
19
-    public const NAME = 'bags';
19
+public const NAME = 'bags';
20 20
 
21
-    /**
21
+/**
22 22
      * @var Databag
23 23
      */
24
-    protected $xDatabag = null;
24
+protected $xDatabag = null;
25 25
 
26
-    /**
26
+/**
27 27
      * The constructor
28 28
      */
29
-    public function __construct(protected Container $di)
30
-    {}
29
+public function __construct(protected Container $di)
30
+{}
31 31
 
32
-    /**
32
+/**
33 33
      * @return void
34 34
      */
35
-    private function initDatabag(): void
36
-    {
37
-        if($this->xDatabag !== null)
38
-        {
39
-            return;
40
-        }
35
+private function initDatabag(): void
36
+{
37
+if($this->xDatabag !== null)
38
+{
39
+return;
40
+}
41 41
 
42
-        // Get the databag contents from the HTTP request parameters.
43
-        $xRequest = $this->di->getRequest();
44
-        $aBody = $xRequest->getParsedBody();
45
-        $aParams = $xRequest->getQueryParams();
46
-        $aData = is_array($aBody) ?
47
-            $this->readData($aBody['jxnbags'] ?? []) :
48
-            $this->readData($aParams['jxnbags'] ?? []);
49
-        $this->xDatabag = new Databag($this, $aData);
50
-    }
42
+// Get the databag contents from the HTTP request parameters.
43
+$xRequest = $this->di->getRequest();
44
+$aBody = $xRequest->getParsedBody();
45
+$aParams = $xRequest->getQueryParams();
46
+$aData = is_array($aBody) ?
47
+$this->readData($aBody['jxnbags'] ?? []) :
48
+$this->readData($aParams['jxnbags'] ?? []);
49
+$this->xDatabag = new Databag($this, $aData);
50
+}
51 51
 
52
-    /**
52
+/**
53 53
      * @inheritDoc
54 54
      */
55
-    public function getName(): string
56
-    {
57
-        return self::NAME;
58
-    }
55
+public function getName(): string
56
+{
57
+return self::NAME;
58
+}
59 59
 
60
-    /**
60
+/**
61 61
      * @param mixed $xData
62 62
      *
63 63
      * @return array
64 64
      */
65
-    private function readData($xData): array
66
-    {
67
-        // Todo: clean input data.
68
-        // Todo: verify the checksums.
69
-        return is_string($xData) ?
70
-            (json_decode($xData, true) ?: []) :
71
-            (is_array($xData) ? $xData : []);
72
-    }
65
+private function readData($xData): array
66
+{
67
+// Todo: clean input data.
68
+// Todo: verify the checksums.
69
+return is_string($xData) ?
70
+(json_decode($xData, true) ?: []) :
71
+(is_array($xData) ? $xData : []);
72
+}
73 73
 
74
-    /**
74
+/**
75 75
      * @inheritDoc
76 76
      */
77
-    public function getHash(): string
78
-    {
79
-        // Use the version number as hash
80
-        return '4.0.0';
81
-    }
77
+public function getHash(): string
78
+{
79
+// Use the version number as hash
80
+return '4.0.0';
81
+}
82 82
 
83
-    /**
83
+/**
84 84
      * @return void
85 85
      */
86
-    public function writeCommand(): void
87
-    {
88
-        $this->initDatabag();
89
-        if($this->xDatabag->touched())
90
-        {
91
-            // Todo: calculate the checksums.
92
-            $this->addCommand('databag.set', ['values' => $this->xDatabag]);
93
-        }
94
-    }
86
+public function writeCommand(): void
87
+{
88
+$this->initDatabag();
89
+if($this->xDatabag->touched())
90
+{
91
+// Todo: calculate the checksums.
92
+$this->addCommand('databag.set', ['values' => $this->xDatabag]);
93
+}
94
+}
95 95
 
96
-    /**
96
+/**
97 97
      * @param string $sName
98 98
      *
99 99
      * @return DatabagContext
100 100
      */
101
-    public function bag(string $sName): DatabagContext
102
-    {
103
-        $this->initDatabag();
104
-        return new DatabagContext($this->xDatabag, $sName);
105
-    }
101
+public function bag(string $sName): DatabagContext
102
+{
103
+$this->initDatabag();
104
+return new DatabagContext($this->xDatabag, $sName);
105
+}
106 106
 }
Please login to merge, or discard this patch.
jaxon-annotations/src/Annotation/DatabagAnnotation.php 1 patch
Switch Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -28,40 +28,40 @@
 block discarded – undo
28 28
  */
29 29
 class DatabagAnnotation extends AbstractAnnotation
30 30
 {
31
-    /**
31
+/**
32 32
      * The data bag name
33 33
      *
34 34
      * @var string
35 35
      */
36
-    protected $sName = '';
36
+protected $sName = '';
37 37
 
38
-    /**
38
+/**
39 39
      * @inheritDoc
40 40
      */
41
-    public static function parseAnnotation($value)
42
-    {
43
-        $aParams = preg_split('/[\s]+/', $value, 2);
44
-        return count($aParams) === 1 ? ['name' => $aParams[0]] : ['name' => $aParams[0], 'extra' => $aParams[1]];
45
-    }
41
+public static function parseAnnotation($value)
42
+{
43
+$aParams = preg_split('/[\s]+/', $value, 2);
44
+return count($aParams) === 1 ? ['name' => $aParams[0]] : ['name' => $aParams[0], 'extra' => $aParams[1]];
45
+}
46 46
 
47
-    /**
47
+/**
48 48
      * @inheritDoc
49 49
      * @throws AnnotationException
50 50
      */
51
-    public function initAnnotation(array $properties)
52
-    {
53
-        if(count($properties) !== 1 || !isset($properties['name']) || !is_string($properties['name']))
54
-        {
55
-            throw new AnnotationException('The @databag annotation requires a property "name" of type string');
56
-        }
57
-        $this->sName = $properties['name'];
58
-    }
51
+public function initAnnotation(array $properties)
52
+{
53
+if(count($properties) !== 1 || !isset($properties['name']) || !is_string($properties['name']))
54
+{
55
+throw new AnnotationException('The @databag annotation requires a property "name" of type string');
56
+}
57
+$this->sName = $properties['name'];
58
+}
59 59
 
60
-    /**
60
+/**
61 61
      * @inheritDoc
62 62
      */
63
-    public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
64
-    {
65
-        $xMetadata->databag($sMethod)->addValue($this->sName);
66
-    }
63
+public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void
64
+{
65
+$xMetadata->databag($sMethod)->addValue($this->sName);
66
+}
67 67
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Databag/DatabagContext.php 1 patch
Switch Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -4,58 +4,58 @@
 block discarded – undo
4 4
 
5 5
 class DatabagContext
6 6
 {
7
-    /**
7
+/**
8 8
      * @var Databag
9 9
      */
10
-    protected $xDatabag;
10
+protected $xDatabag;
11 11
 
12
-    /**
12
+/**
13 13
      * @var string
14 14
      */
15
-    protected $sName;
15
+protected $sName;
16 16
 
17
-    /**
17
+/**
18 18
      * The constructor
19 19
      *
20 20
      * @param Databag $xDatabag
21 21
      * @param string $sName
22 22
      */
23
-    public function __construct(Databag $xDatabag, string $sName)
24
-    {
25
-        $this->xDatabag = $xDatabag;
26
-        $this->sName = $sName;
27
-    }
23
+public function __construct(Databag $xDatabag, string $sName)
24
+{
25
+$this->xDatabag = $xDatabag;
26
+$this->sName = $sName;
27
+}
28 28
 
29
-    /**
29
+/**
30 30
      * @param string $sKey
31 31
      * @param mixed $xValue
32 32
      *
33 33
      * @return void
34 34
      */
35
-    public function set(string $sKey, $xValue): void
36
-    {
37
-        $this->xDatabag->set($this->sName, $sKey, $xValue);
38
-    }
35
+public function set(string $sKey, $xValue): void
36
+{
37
+$this->xDatabag->set($this->sName, $sKey, $xValue);
38
+}
39 39
 
40
-    /**
40
+/**
41 41
      * @param string $sKey
42 42
      * @param mixed $xValue
43 43
      *
44 44
      * @return void
45 45
      */
46
-    public function new(string $sKey, $xValue): void
47
-    {
48
-        $this->xDatabag->new($this->sName, $sKey, $xValue);
49
-    }
46
+public function new(string $sKey, $xValue): void
47
+{
48
+$this->xDatabag->new($this->sName, $sKey, $xValue);
49
+}
50 50
 
51
-    /**
51
+/**
52 52
      * @param string $sKey
53 53
      * @param mixed $xValue
54 54
      *
55 55
      * @return mixed
56 56
      */
57
-    public function get(string $sKey, $xValue = null): mixed
58
-    {
59
-        return $this->xDatabag->get($this->sName, $sKey, $xValue);
60
-    }
57
+public function get(string $sKey, $xValue = null): mixed
58
+{
59
+return $this->xDatabag->get($this->sName, $sKey, $xValue);
60
+}
61 61
 }
Please login to merge, or discard this patch.
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/Plugin/Request/CallableClass/ComponentOptions.php 1 patch
Switch Indentation   +169 added lines, -169 removed lines patch added patch discarded remove patch
@@ -34,224 +34,224 @@  discard block
 block discarded – undo
34 34
 
35 35
 class ComponentOptions
36 36
 {
37
-    /**
37
+/**
38 38
      * Check if the js code for this object must be generated
39 39
      *
40 40
      * @var bool
41 41
      */
42
-    private $bExcluded = false;
42
+private $bExcluded = false;
43 43
 
44
-    /**
44
+/**
45 45
      * The character to use as separator in javascript class names
46 46
      *
47 47
      * @var string
48 48
      */
49
-    private $sSeparator = '.';
49
+private $sSeparator = '.';
50 50
 
51
-    /**
51
+/**
52 52
      * A list of methods of the user registered callable object the library can export to javascript
53 53
      *
54 54
      * @var array
55 55
      */
56
-    private $aPublicMethods = [];
56
+private $aPublicMethods = [];
57 57
 
58
-    /**
58
+/**
59 59
      * The methods in the export attributes
60 60
      *
61 61
      * @var array
62 62
      */
63
-    private $aExportMethods = ['except' => []];
63
+private $aExportMethods = ['except' => []];
64 64
 
65
-    /**
65
+/**
66 66
      * A list of methods to call before processing the request
67 67
      *
68 68
      * @var array
69 69
      */
70
-    private $aBeforeMethods = [];
70
+private $aBeforeMethods = [];
71 71
 
72
-    /**
72
+/**
73 73
      * A list of methods to call after processing the request
74 74
      *
75 75
      * @var array
76 76
      */
77
-    private $aAfterMethods = [];
77
+private $aAfterMethods = [];
78 78
 
79
-    /**
79
+/**
80 80
      * The javascript class options
81 81
      *
82 82
      * @var array
83 83
      */
84
-    private $aJsOptions = [];
84
+private $aJsOptions = [];
85 85
 
86
-    /**
86
+/**
87 87
      * The DI options
88 88
      *
89 89
      * @var array
90 90
      */
91
-    private $aDiOptions = [];
91
+private $aDiOptions = [];
92 92
 
93
-    /**
93
+/**
94 94
      * The constructor
95 95
      *
96 96
      * @param array $aMethods
97 97
      * @param array $aOptions
98 98
      * @param Metadata|null $xMetadata
99 99
      */
100
-    public function __construct(array $aMethods, array $aOptions, Metadata|null $xMetadata)
101
-    {
102
-        $this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
103
-            (bool)($aOptions['excluded'] ?? false);
104
-
105
-        // Options from the config.
106
-        $sSeparator = $aOptions['separator'] ?? '.';
107
-        $this->sSeparator = $sSeparator === '_' ? '_' : '.';
108
-        $this->addProtectedMethods($aOptions['protected'] ?? []);
109
-        foreach($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
110
-        {
111
-            // Names are in a comma-separated list.
112
-            $aFunctionNames = explode(',', $sNames);
113
-            foreach($aFunctionNames as $sFunctionName)
114
-            {
115
-                $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
116
-            }
117
-        }
100
+public function __construct(array $aMethods, array $aOptions, Metadata|null $xMetadata)
101
+{
102
+$this->bExcluded = ($xMetadata?->isExcluded() ?? false) ||
103
+(bool)($aOptions['excluded'] ?? false);
104
+
105
+// Options from the config.
106
+$sSeparator = $aOptions['separator'] ?? '.';
107
+$this->sSeparator = $sSeparator === '_' ? '_' : '.';
108
+$this->addProtectedMethods($aOptions['protected'] ?? []);
109
+foreach($aOptions['functions'] ?? [] as $sNames => $aFunctionOptions)
110
+{
111
+// Names are in a comma-separated list.
112
+$aFunctionNames = explode(',', $sNames);
113
+foreach($aFunctionNames as $sFunctionName)
114
+{
115
+    $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
116
+}
117
+}
118 118
 
119
-        // Options from the attributes or annotations.
120
-        if($xMetadata !== null)
121
-        {
122
-            $this->readMetadataOptions($xMetadata);
123
-        }
119
+// Options from the attributes or annotations.
120
+if($xMetadata !== null)
121
+{
122
+$this->readMetadataOptions($xMetadata);
123
+}
124 124
 
125
-        $this->aPublicMethods = $this->filterPublicMethods($aMethods);
126
-    }
125
+$this->aPublicMethods = $this->filterPublicMethods($aMethods);
126
+}
127 127
 
128
-    /**
128
+/**
129 129
      * @param array|string $xMethods
130 130
      *
131 131
      * @return void
132 132
      */
133
-    private function addProtectedMethods(array|string $xMethods): void
134
-    {
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));
138
-    }
133
+private function addProtectedMethods(array|string $xMethods): void
134
+{
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));
138
+}
139 139
 
140
-    /**
140
+/**
141 141
      * @param Metadata $xMetadata
142 142
      *
143 143
      * @return void
144 144
      */
145
-    private function readMetadataOptions(Metadata $xMetadata): void
146
-    {
147
-        // Excluded methods must be merged with the existing ones.
148
-        $aExportMethods = $xMetadata->getExportMethods();
149
-        $aExportMethods['except'] = array_unique(array_merge(
150
-            $aExportMethods['except'] ?? [], $this->aExportMethods['except']));
151
-        $this->aExportMethods = $aExportMethods;
152
-        foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
153
-        {
154
-            $this->addFunctionOptions($sFunctionName, $aFunctionOptions);
155
-        }
156
-    }
145
+private function readMetadataOptions(Metadata $xMetadata): void
146
+{
147
+// Excluded methods must be merged with the existing ones.
148
+$aExportMethods = $xMetadata->getExportMethods();
149
+$aExportMethods['except'] = array_unique(array_merge(
150
+$aExportMethods['except'] ?? [], $this->aExportMethods['except']));
151
+$this->aExportMethods = $aExportMethods;
152
+foreach($xMetadata->getProperties() as $sFunctionName => $aFunctionOptions)
153
+{
154
+$this->addFunctionOptions($sFunctionName, $aFunctionOptions);
155
+}
156
+}
157 157
 
158
-    /**
158
+/**
159 159
      * @param array $aMethods
160 160
      *
161 161
      * @return array
162 162
      */
163
-    private function filterPublicMethods(array $aMethods): array
164
-    {
165
-        if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
166
-        {
167
-            return [];
168
-        }
163
+private function filterPublicMethods(array $aMethods): array
164
+{
165
+if($this->bExcluded || in_array('*', $this->aExportMethods['except']))
166
+{
167
+return [];
168
+}
169 169
 
170
-        $aBaseMethods = $aMethods[1];
171
-        $aNoMethods = $aMethods[2];
172
-        $aMethods = $aMethods[0];
173
-        if(isset($this->aExportMethods['only']))
174
-        {
175
-            $aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
176
-        }
177
-        $aMethods = array_diff($aMethods, $this->aExportMethods['except']);
178
-        if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
179
-        {
180
-            $aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
181
-        }
170
+$aBaseMethods = $aMethods[1];
171
+$aNoMethods = $aMethods[2];
172
+$aMethods = $aMethods[0];
173
+if(isset($this->aExportMethods['only']))
174
+{
175
+$aMethods = array_intersect($aMethods, $this->aExportMethods['only']);
176
+}
177
+$aMethods = array_diff($aMethods, $this->aExportMethods['except']);
178
+if(count($aBaseMethods) > 0 && isset($this->aExportMethods['base']))
179
+{
180
+$aBaseMethods = array_diff($aBaseMethods, $this->aExportMethods['base']);
181
+}
182 182
 
183
-        return array_values(array_diff($aMethods, $aBaseMethods, $aNoMethods));
184
-    }
183
+return array_values(array_diff($aMethods, $aBaseMethods, $aNoMethods));
184
+}
185 185
 
186
-    /**
186
+/**
187 187
      * @return array
188 188
      */
189
-    public function getPublicMethods(): array
190
-    {
191
-        return $this->aPublicMethods;
192
-    }
189
+public function getPublicMethods(): array
190
+{
191
+return $this->aPublicMethods;
192
+}
193 193
 
194
-    /**
194
+/**
195 195
      * @param string $sMethodName
196 196
      *
197 197
      * @return bool
198 198
      */
199
-    public function isPublicMethod(string $sMethodName): bool
200
-    {
201
-        return in_array($sMethodName, $this->aPublicMethods);
202
-    }
199
+public function isPublicMethod(string $sMethodName): bool
200
+{
201
+return in_array($sMethodName, $this->aPublicMethods);
202
+}
203 203
 
204
-    /**
204
+/**
205 205
      * Check if the js code for this object must be generated
206 206
      *
207 207
      * @return bool
208 208
      */
209
-    public function excluded(): bool
210
-    {
211
-        return $this->bExcluded;
212
-    }
209
+public function excluded(): bool
210
+{
211
+return $this->bExcluded;
212
+}
213 213
 
214
-    /**
214
+/**
215 215
      * @return string
216 216
      */
217
-    public function separator(): string
218
-    {
219
-        return $this->sSeparator;
220
-    }
217
+public function separator(): string
218
+{
219
+return $this->sSeparator;
220
+}
221 221
 
222
-    /**
222
+/**
223 223
      * @return array
224 224
      */
225
-    public function beforeMethods(): array
226
-    {
227
-        return $this->aBeforeMethods;
228
-    }
225
+public function beforeMethods(): array
226
+{
227
+return $this->aBeforeMethods;
228
+}
229 229
 
230
-    /**
230
+/**
231 231
      * @return array
232 232
      */
233
-    public function afterMethods(): array
234
-    {
235
-        return $this->aAfterMethods;
236
-    }
233
+public function afterMethods(): array
234
+{
235
+return $this->aAfterMethods;
236
+}
237 237
 
238
-    /**
238
+/**
239 239
      * @return array
240 240
      */
241
-    public function diOptions(): array
242
-    {
243
-        return $this->aDiOptions;
244
-    }
241
+public function diOptions(): array
242
+{
243
+return $this->aDiOptions;
244
+}
245 245
 
246
-    /**
246
+/**
247 247
      * @return array
248 248
      */
249
-    public function jsOptions(): array
250
-    {
251
-        return $this->aJsOptions;
252
-    }
249
+public function jsOptions(): array
250
+{
251
+return $this->aJsOptions;
252
+}
253 253
 
254
-    /**
254
+/**
255 255
      * Set hook methods
256 256
      *
257 257
      * @param array $aHookMethods    The array of hook methods
@@ -259,36 +259,36 @@  discard block
 block discarded – undo
259 259
      *
260 260
      * @return void
261 261
      */
262
-    private function setHookMethods(array &$aHookMethods, $xValue): void
263
-    {
264
-        foreach($xValue as $sCalledMethod => $xMethodToCall)
265
-        {
266
-            if(!isset($aHookMethods[$sCalledMethod]))
267
-            {
268
-                $aHookMethods[$sCalledMethod] = [];
269
-            }
270
-            if(is_array($xMethodToCall))
271
-            {
272
-                $aHookMethods[$sCalledMethod] =
273
-                    array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
274
-                continue;
275
-            }
276
-            if(is_string($xMethodToCall))
277
-            {
278
-                $aHookMethods[$sCalledMethod][] = $xMethodToCall;
279
-            }
280
-        }
281
-    }
262
+private function setHookMethods(array &$aHookMethods, $xValue): void
263
+{
264
+foreach($xValue as $sCalledMethod => $xMethodToCall)
265
+{
266
+if(!isset($aHookMethods[$sCalledMethod]))
267
+{
268
+    $aHookMethods[$sCalledMethod] = [];
269
+}
270
+if(is_array($xMethodToCall))
271
+{
272
+    $aHookMethods[$sCalledMethod] =
273
+        array_merge($aHookMethods[$sCalledMethod], $xMethodToCall);
274
+    continue;
275
+}
276
+if(is_string($xMethodToCall))
277
+{
278
+    $aHookMethods[$sCalledMethod][] = $xMethodToCall;
279
+}
280
+}
281
+}
282 282
 
283
-    /**
283
+/**
284 284
      * @param array $aDiOptions
285 285
      */
286
-    private function addDiOption(array $aDiOptions): void
287
-    {
288
-        $this->aDiOptions = array_merge($this->aDiOptions, $aDiOptions);
289
-    }
286
+private function addDiOption(array $aDiOptions): void
287
+{
288
+$this->aDiOptions = array_merge($this->aDiOptions, $aDiOptions);
289
+}
290 290
 
291
-    /**
291
+/**
292 292
      * Set configuration options / call options for each method
293 293
      *
294 294
      * @param string $sName    The name of the configuration option
@@ -296,25 +296,25 @@  discard block
 block discarded – undo
296 296
      *
297 297
      * @return void
298 298
      */
299
-    private function addOption(string $sName, $xValue): void
300
-    {
301
-        switch($sName)
302
-        {
303
-        // Set the methods to call before processing the request
304
-        case '__before':
305
-            $this->setHookMethods($this->aBeforeMethods, $xValue);
306
-            break;
307
-        // Set the methods to call after processing the request
308
-        case '__after':
309
-            $this->setHookMethods($this->aAfterMethods, $xValue);
310
-            break;
311
-        // Set the attributes to inject in the callable object
312
-        case '__di':
313
-            $this->addDiOption($xValue);
314
-            break;
315
-        default:
316
-            break;
317
-        }
299
+private function addOption(string $sName, $xValue): void
300
+{
301
+switch($sName)
302
+{
303
+// Set the methods to call before processing the request
304
+case '__before':
305
+$this->setHookMethods($this->aBeforeMethods, $xValue);
306
+break;
307
+// Set the methods to call after processing the request
308
+case '__after':
309
+$this->setHookMethods($this->aAfterMethods, $xValue);
310
+break;
311
+// Set the attributes to inject in the callable object
312
+case '__di':
313
+$this->addDiOption($xValue);
314
+break;
315
+default:
316
+break;
317
+}
318 318
     }
319 319
 
320 320
     /**
Please login to merge, or discard this patch.