Passed
Push — main ( 5ca287...d84479 )
by Thierry
05:24
created
jaxon-config/src/ConfigReader.php 1 patch
Switch Indentation   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@  discard block
 block discarded – undo
19 19
 
20 20
 class ConfigReader
21 21
 {
22
-    /**
22
+/**
23 23
      * @param ConfigSetter $xConfigSetter
24 24
      */
25
-    public function __construct(private ConfigSetter $xConfigSetter)
26
-    {}
25
+public function __construct(private ConfigSetter $xConfigSetter)
26
+{}
27 27
 
28
-    /**
28
+/**
29 29
      * Read options from a config file to an array
30 30
      *
31 31
      * @param string $sConfigFile The full path to the config file
@@ -36,29 +36,29 @@  discard block
 block discarded – undo
36 36
      * @throws Exception\FileContent
37 37
      * @throws Exception\YamlExtension
38 38
      */
39
-    public function read(string $sConfigFile): array
40
-    {
41
-        if(!($sConfigFile = trim($sConfigFile)))
42
-        {
43
-            return [];
44
-        }
39
+public function read(string $sConfigFile): array
40
+{
41
+if(!($sConfigFile = trim($sConfigFile)))
42
+{
43
+return [];
44
+}
45 45
 
46
-        $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION);
47
-        switch($sExt)
48
-        {
49
-        case 'php':
50
-            $aConfigOptions = Reader\PhpReader::read($sConfigFile);
51
-            break;
52
-        case 'yaml':
53
-        case 'yml':
54
-            $aConfigOptions = Reader\YamlReader::read($sConfigFile);
55
-            break;
56
-        case 'json':
57
-            $aConfigOptions = Reader\JsonReader::read($sConfigFile);
58
-            break;
59
-        default:
60
-            throw new Exception\FileExtension($sConfigFile);
61
-        }
46
+$sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION);
47
+switch($sExt)
48
+{
49
+case 'php':
50
+$aConfigOptions = Reader\PhpReader::read($sConfigFile);
51
+break;
52
+case 'yaml':
53
+case 'yml':
54
+$aConfigOptions = Reader\YamlReader::read($sConfigFile);
55
+break;
56
+case 'json':
57
+$aConfigOptions = Reader\JsonReader::read($sConfigFile);
58
+break;
59
+default:
60
+throw new Exception\FileExtension($sConfigFile);
61
+}
62 62
 
63 63
         return $aConfigOptions;
64 64
     }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/InputData.php 1 patch
Switch Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -20,50 +20,50 @@
 block discarded – undo
20 20
 
21 21
 class InputData
22 22
 {
23
-    /**
23
+/**
24 24
      * @var ReflectionClass
25 25
      */
26
-    private $xReflectionClass;
26
+private $xReflectionClass;
27 27
 
28
-    /**
28
+/**
29 29
      * @param ReflectionClass|string $xClass
30 30
      * @param array $aMethods
31 31
      * @param array $aProperties
32 32
      */
33
-    public function __construct(ReflectionClass|string $xClass,
34
-        private array $aMethods = [], private array $aProperties = [])
35
-    {
36
-        $this->xReflectionClass = is_string($xClass) ?
37
-            new ReflectionClass($xClass) : $xClass;
38
-    }
33
+public function __construct(ReflectionClass|string $xClass,
34
+private array $aMethods = [], private array $aProperties = [])
35
+{
36
+$this->xReflectionClass = is_string($xClass) ?
37
+new ReflectionClass($xClass) : $xClass;
38
+}
39 39
 
40
-    /**
40
+/**
41 41
      * Get the reflection class
42 42
      *
43 43
      * @return ReflectionClass
44 44
      */
45
-    public function getReflectionClass(): ReflectionClass
46
-    {
47
-        return $this->xReflectionClass;
48
-    }
45
+public function getReflectionClass(): ReflectionClass
46
+{
47
+return $this->xReflectionClass;
48
+}
49 49
 
50
-    /**
50
+/**
51 51
      * The methods to check for metadata
52 52
      *
53 53
      * @return array
54 54
      */
55
-    public function getMethods(): array
56
-    {
57
-        return $this->aMethods;
58
-    }
55
+public function getMethods(): array
56
+{
57
+return $this->aMethods;
58
+}
59 59
 
60
-    /**
60
+/**
61 61
      * The properties to check for metadata
62 62
      *
63 63
      * @return array
64 64
      */
65
-    public function getProperties(): array
66
-    {
67
-        return $this->aProperties;
68
-    }
65
+public function getProperties(): array
66
+{
67
+return $this->aProperties;
68
+}
69 69
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/ExcludeData.php 1 patch
Switch Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,42 +16,42 @@
 block discarded – undo
16 16
 
17 17
 class ExcludeData extends AbstractData
18 18
 {
19
-    /**
19
+/**
20 20
      * @var bool
21 21
      */
22
-    private bool $bValue = true;
22
+private bool $bValue = true;
23 23
 
24
-    /**
24
+/**
25 25
      * @return string
26 26
      */
27
-    public function getName(): string
28
-    {
29
-        return 'protected';
30
-    }
27
+public function getName(): string
28
+{
29
+return 'protected';
30
+}
31 31
 
32
-    /**
32
+/**
33 33
      * @return mixed
34 34
      */
35
-    public function getValue(): mixed
36
-    {
37
-        return $this->bValue;
38
-    }
35
+public function getValue(): mixed
36
+{
37
+return $this->bValue;
38
+}
39 39
 
40
-    /**
40
+/**
41 41
      * @param bool $bValue
42 42
      *
43 43
      * @return void
44 44
      */
45
-    public function setValue(bool $bValue): void
46
-    {
47
-        $this->bValue = $bValue;
48
-    }
45
+public function setValue(bool $bValue): void
46
+{
47
+$this->bValue = $bValue;
48
+}
49 49
 
50
-    /**
50
+/**
51 51
      * @inheritDoc
52 52
      */
53
-    public function encode(string $sVarName): array
54
-    {
55
-        return ["{$sVarName}->setValue(" . ($this->bValue ? 'true' : 'false') . ");"];
56
-    }
53
+public function encode(string $sVarName): array
54
+{
55
+return ["{$sVarName}->setValue(" . ($this->bValue ? 'true' : 'false') . ");"];
56
+}
57 57
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/Data/UploadData.php 1 patch
Switch Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -20,61 +20,61 @@
 block discarded – undo
20 20
 
21 21
 class UploadData extends AbstractData
22 22
 {
23
-    /**
23
+/**
24 24
      * The id of the upload field
25 25
      *
26 26
      * @var string
27 27
      */
28
-    protected $sField = '';
28
+protected $sField = '';
29 29
 
30
-    /**
30
+/**
31 31
      * @return string
32 32
      */
33
-    public function getName(): string
34
-    {
35
-        return 'upload';
36
-    }
33
+public function getName(): string
34
+{
35
+return 'upload';
36
+}
37 37
 
38
-    /**
38
+/**
39 39
      * @return mixed
40 40
      */
41
-    public function getValue(): mixed
42
-    {
43
-        // The field id is surrounded with simple quotes.
44
-        return "'{$this->sField}'";
45
-    }
41
+public function getValue(): mixed
42
+{
43
+// The field id is surrounded with simple quotes.
44
+return "'{$this->sField}'";
45
+}
46 46
 
47
-    /**
47
+/**
48 48
      * @param string $sField
49 49
      *
50 50
      * @return void
51 51
      */
52
-    protected function validateField(string $sField): void
53
-    {
54
-        if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sField) > 0)
55
-        {
56
-            return;
57
-        }
58
-        throw new SetupException("$sField is not a valid \"field\" value for upload");
59
-    }
52
+protected function validateField(string $sField): void
53
+{
54
+if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sField) > 0)
55
+{
56
+return;
57
+}
58
+throw new SetupException("$sField is not a valid \"field\" value for upload");
59
+}
60 60
 
61
-    /**
61
+/**
62 62
      * @param string $sField
63 63
      *
64 64
      * @return void
65 65
      */
66
-    public function setValue(string $sField): void
67
-    {
68
-        $this->validateField($sField);
66
+public function setValue(string $sField): void
67
+{
68
+$this->validateField($sField);
69 69
 
70
-        $this->sField = $sField;
71
-    }
70
+$this->sField = $sField;
71
+}
72 72
 
73
-    /**
73
+/**
74 74
      * @inheritDoc
75 75
      */
76
-    public function encode(string $sVarName): array
77
-    {
78
-        return ["{$sVarName}->setValue('{$this->sField}');"];
79
-    }
76
+public function encode(string $sVarName): array
77
+{
78
+return ["{$sVarName}->setValue('{$this->sField}');"];
79
+}
80 80
 }
Please login to merge, or discard this patch.
jaxon-core/src/App/Metadata/MetadataCache.php 1 patch
Switch Indentation   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -28,60 +28,60 @@  discard block
 block discarded – undo
28 28
 
29 29
 class MetadataCache
30 30
 {
31
-    /**
31
+/**
32 32
      * @param string $sCacheDir
33 33
      */
34
-    public function __construct(private string $sCacheDir)
35
-    {}
34
+public function __construct(private string $sCacheDir)
35
+{}
36 36
 
37
-    /**
37
+/**
38 38
      * @param string $sClass
39 39
      *
40 40
      * @return string
41 41
      */
42
-    private function filepath(string $sClass): string
43
-    {
44
-        $sFilename = trim(str_replace(['\\', '.'], DIRECTORY_SEPARATOR,
45
-            strtolower($sClass)), DIRECTORY_SEPARATOR);
46
-        return rtrim($this->sCacheDir, "/\\") . DIRECTORY_SEPARATOR .
47
-            "metadata" . DIRECTORY_SEPARATOR . "{$sFilename}.php";
48
-    }
42
+private function filepath(string $sClass): string
43
+{
44
+$sFilename = trim(str_replace(['\\', '.'], DIRECTORY_SEPARATOR,
45
+strtolower($sClass)), DIRECTORY_SEPARATOR);
46
+return rtrim($this->sCacheDir, "/\\") . DIRECTORY_SEPARATOR .
47
+"metadata" . DIRECTORY_SEPARATOR . "{$sFilename}.php";
48
+}
49 49
 
50
-    /**
50
+/**
51 51
      * Generate the PHP code to create a metadata object.
52 52
      *
53 53
      * @return array
54 54
      */
55
-    private function encode(Metadata $xMetadata): array
55
+private function encode(Metadata $xMetadata): array
56
+{
57
+$sMetadataVar = '$xMetadata';
58
+$sDataVar = '$xData';
59
+$aCalls = ["$sMetadataVar = new " . Metadata::class . '();'];
60
+foreach($xMetadata->getAttributes() as $sType => $aValues)
61
+{
62
+foreach($aValues as $sMethod => $xData)
63
+{
64
+    $aCalls[] = "$sDataVar = {$sMetadataVar}->{$sType}('{$sMethod}');";
65
+    foreach($xData->encode($sDataVar) as $sCall)
56 66
     {
57
-        $sMetadataVar = '$xMetadata';
58
-        $sDataVar = '$xData';
59
-        $aCalls = ["$sMetadataVar = new " . Metadata::class . '();'];
60
-        foreach($xMetadata->getAttributes() as $sType => $aValues)
61
-        {
62
-            foreach($aValues as $sMethod => $xData)
63
-            {
64
-                $aCalls[] = "$sDataVar = {$sMetadataVar}->{$sType}('{$sMethod}');";
65
-                foreach($xData->encode($sDataVar) as $sCall)
66
-                {
67
-                    $aCalls[] = $sCall;
68
-                }
69
-            }
70
-        }
71
-        $aCalls[] = "return $sMetadataVar;";
72
-        return $aCalls;
67
+        $aCalls[] = $sCall;
73 68
     }
69
+}
70
+}
71
+$aCalls[] = "return $sMetadataVar;";
72
+return $aCalls;
73
+}
74 74
 
75
-    /**
75
+/**
76 76
      * @param string $sClass
77 77
      * @param Metadata $xMetadata
78 78
      *
79 79
      * @return void
80 80
      */
81
-    public function save(string $sClass, Metadata $xMetadata): void
82
-    {
83
-        $sDataCode = implode("\n    ", $this->encode($xMetadata));
84
-        $sPhpCode = <<<CODE
81
+public function save(string $sClass, Metadata $xMetadata): void
82
+{
83
+$sDataCode = implode("\n    ", $this->encode($xMetadata));
84
+$sPhpCode = <<<CODE
85 85
 <?php
86 86
 
87 87
 return function() {
@@ -89,21 +89,21 @@  discard block
 block discarded – undo
89 89
 };
90 90
 
91 91
 CODE;
92
-        // Recursively create the directories.
93
-        $sPath = $this->filepath($sClass);
94
-        @mkdir(dirname($sPath), 0755, true);
95
-        file_put_contents($sPath, $sPhpCode);
96
-    }
92
+// Recursively create the directories.
93
+$sPath = $this->filepath($sClass);
94
+@mkdir(dirname($sPath), 0755, true);
95
+file_put_contents($sPath, $sPhpCode);
96
+}
97 97
 
98
-    /**
98
+/**
99 99
      * @param string $sClass
100 100
      *
101 101
      * @return Metadata|null
102 102
      */
103
-    public function read(string $sClass): ?Metadata
104
-    {
105
-        $sPath = $this->filepath($sClass);
106
-        $fCreator = file_exists($sPath) ? require $sPath : null;
107
-        return $fCreator instanceof Closure ? $fCreator() : null;
108
-    }
103
+public function read(string $sClass): ?Metadata
104
+{
105
+$sPath = $this->filepath($sClass);
106
+$fCreator = file_exists($sPath) ? require $sPath : null;
107
+return $fCreator instanceof Closure ? $fCreator() : null;
108
+}
109 109
 }
Please login to merge, or discard this patch.
jaxon-core/src/Request/Upload/UploadHandlerInterface.php 1 patch
Switch Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -20,45 +20,45 @@
 block discarded – undo
20 20
 
21 21
 interface UploadHandlerInterface
22 22
 {
23
-    /**
23
+/**
24 24
      * Set the uploaded file name sanitizer
25 25
      *
26 26
      * @param Closure $cSanitizer    The closure
27 27
      *
28 28
      * @return void
29 29
      */
30
-    public function sanitizer(Closure $cSanitizer);
30
+public function sanitizer(Closure $cSanitizer);
31 31
 
32
-    /**
32
+/**
33 33
      * Get the uploaded files
34 34
      *
35 35
      * @return FileInterface[]
36 36
      */
37
-    public function files(): array;
37
+public function files(): array;
38 38
 
39
-    /**
39
+/**
40 40
      * Check if the current request contains uploaded files
41 41
      *
42 42
      * @param ServerRequestInterface $xRequest
43 43
      *
44 44
      * @return bool
45 45
      */
46
-    public function canProcessRequest(ServerRequestInterface $xRequest): bool;
46
+public function canProcessRequest(ServerRequestInterface $xRequest): bool;
47 47
 
48
-    /**
48
+/**
49 49
      * Process the uploaded files in the HTTP request
50 50
      *
51 51
      * @param ServerRequestInterface $xRequest
52 52
      *
53 53
      * @return bool
54 54
      */
55
-    public function processRequest(ServerRequestInterface $xRequest): bool;
55
+public function processRequest(ServerRequestInterface $xRequest): bool;
56 56
 
57
-    /**
57
+/**
58 58
      * @param string $sStorage
59 59
      * @param Closure $cFactory
60 60
      *
61 61
      * @return void
62 62
      */
63
-    public function registerStorageAdapter(string $sStorage, Closure $cFactory);
63
+public function registerStorageAdapter(string $sStorage, Closure $cFactory);
64 64
 }
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.