@@ -20,34 +20,34 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | class MetadataCache |
| 22 | 22 | { |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * @param string $sCacheDir |
| 25 | 25 | */ |
| 26 | - public function __construct(private string $sCacheDir) |
|
| 27 | - {} |
|
| 26 | +public function __construct(private string $sCacheDir) |
|
| 27 | +{} |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * @param string $sClass |
| 31 | 31 | * |
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - private function filename(string $sClass): string |
|
| 35 | - { |
|
| 36 | - $sName = str_replace(['\\', '.'], '_', strtolower($sClass)); |
|
| 37 | - return "{$this->sCacheDir}/{$sName}.php"; |
|
| 38 | - } |
|
| 34 | +private function filename(string $sClass): string |
|
| 35 | +{ |
|
| 36 | +$sName = str_replace(['\\', '.'], '_', strtolower($sClass)); |
|
| 37 | +return "{$this->sCacheDir}/{$sName}.php"; |
|
| 38 | +} |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @param string $sClass |
| 42 | 42 | * @param Metadata $xMetadata |
| 43 | 43 | * |
| 44 | 44 | * @return void |
| 45 | 45 | */ |
| 46 | - public function save(string $sClass, Metadata $xMetadata): void |
|
| 47 | - { |
|
| 48 | - $sFilename = $this->filename($sClass); |
|
| 49 | - $sDataCode = implode("\n ", $xMetadata->encode()); |
|
| 50 | - $sPhpCode = <<<CODE |
|
| 46 | +public function save(string $sClass, Metadata $xMetadata): void |
|
| 47 | +{ |
|
| 48 | +$sFilename = $this->filename($sClass); |
|
| 49 | +$sDataCode = implode("\n ", $xMetadata->encode()); |
|
| 50 | +$sPhpCode = <<<CODE |
|
| 51 | 51 | <?php |
| 52 | 52 | |
| 53 | 53 | return function() { |
@@ -55,17 +55,17 @@ discard block |
||
| 55 | 55 | }; |
| 56 | 56 | |
| 57 | 57 | CODE; |
| 58 | - file_put_contents($sFilename, $sPhpCode); |
|
| 59 | - } |
|
| 58 | +file_put_contents($sFilename, $sPhpCode); |
|
| 59 | +} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * @param string $sClass |
| 63 | 63 | * |
| 64 | 64 | * @return Metadata|null |
| 65 | 65 | */ |
| 66 | - public function read(string $sClass): ?Metadata |
|
| 67 | - { |
|
| 68 | - $fFunction = require $this->filename($sClass); |
|
| 69 | - return !is_callable($fFunction) ? null : $fFunction(); |
|
| 70 | - } |
|
| 66 | +public function read(string $sClass): ?Metadata |
|
| 67 | +{ |
|
| 68 | +$fFunction = require $this->filename($sClass); |
|
| 69 | +return !is_callable($fFunction) ? null : $fFunction(); |
|
| 70 | +} |
|
| 71 | 71 | } |
@@ -21,239 +21,239 @@ |
||
| 21 | 21 | |
| 22 | 22 | class Metadata implements MetadataInterface |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @var array<Data\ExcludeData> |
| 26 | 26 | */ |
| 27 | - private array $aExcludes = []; |
|
| 27 | +private array $aExcludes = []; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * @var array<Data\ContainerData> |
| 31 | 31 | */ |
| 32 | - private array $aContainers = []; |
|
| 32 | +private array $aContainers = []; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @var array<Data\DatabagData> |
| 36 | 36 | */ |
| 37 | - private array $aDatabags = []; |
|
| 37 | +private array $aDatabags = []; |
|
| 38 | 38 | |
| 39 | - /** |
|
| 39 | +/** |
|
| 40 | 40 | * @var array<Data\CallbackData> |
| 41 | 41 | */ |
| 42 | - private array $aCallbacks = []; |
|
| 42 | +private array $aCallbacks = []; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | +/** |
|
| 45 | 45 | * @var array<Data\BeforeData> |
| 46 | 46 | */ |
| 47 | - private array $aBefores = []; |
|
| 47 | +private array $aBefores = []; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 49 | +/** |
|
| 50 | 50 | * @var array<Data\AfterData> |
| 51 | 51 | */ |
| 52 | - private array $aAfters = []; |
|
| 52 | +private array $aAfters = []; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 54 | +/** |
|
| 55 | 55 | * @var array<Data\UploadData> |
| 56 | 56 | */ |
| 57 | - private array $aUploads = []; |
|
| 57 | +private array $aUploads = []; |
|
| 58 | 58 | |
| 59 | - // /** |
|
| 60 | - // * @param bool $bIsExcluded |
|
| 61 | - // * @param array $aProperties |
|
| 62 | - // * @param array $aProtectedMethods |
|
| 63 | - // */ |
|
| 64 | - // public function __construct(private bool $bIsExcluded, |
|
| 65 | - // private array $aProperties, private array $aProtectedMethods) |
|
| 66 | - // {} |
|
| 59 | +// /** |
|
| 60 | +// * @param bool $bIsExcluded |
|
| 61 | +// * @param array $aProperties |
|
| 62 | +// * @param array $aProtectedMethods |
|
| 63 | +// */ |
|
| 64 | +// public function __construct(private bool $bIsExcluded, |
|
| 65 | +// private array $aProperties, private array $aProtectedMethods) |
|
| 66 | +// {} |
|
| 67 | 67 | |
| 68 | - /** |
|
| 68 | +/** |
|
| 69 | 69 | * @param string $sMethod |
| 70 | 70 | * |
| 71 | 71 | * @return Data\ExcludeData |
| 72 | 72 | */ |
| 73 | - public function exclude(string $sMethod = '*'): Data\ExcludeData |
|
| 74 | - { |
|
| 75 | - if(!isset($this->aExcludes[$sMethod])) |
|
| 76 | - { |
|
| 77 | - $this->aExcludes[$sMethod] = new Data\ExcludeData(); |
|
| 78 | - } |
|
| 79 | - return $this->aExcludes[$sMethod]; |
|
| 80 | - } |
|
| 73 | +public function exclude(string $sMethod = '*'): Data\ExcludeData |
|
| 74 | +{ |
|
| 75 | +if(!isset($this->aExcludes[$sMethod])) |
|
| 76 | +{ |
|
| 77 | +$this->aExcludes[$sMethod] = new Data\ExcludeData(); |
|
| 78 | +} |
|
| 79 | +return $this->aExcludes[$sMethod]; |
|
| 80 | +} |
|
| 81 | 81 | |
| 82 | - /** |
|
| 82 | +/** |
|
| 83 | 83 | * @param string $sMethod |
| 84 | 84 | * |
| 85 | 85 | * @return Data\ContainerData |
| 86 | 86 | */ |
| 87 | - public function container(string $sMethod = '*'): Data\ContainerData |
|
| 88 | - { |
|
| 89 | - if(!isset($this->aContainers[$sMethod])) |
|
| 90 | - { |
|
| 91 | - $this->aContainers[$sMethod] = new Data\ContainerData(); |
|
| 92 | - } |
|
| 93 | - return $this->aContainers[$sMethod]; |
|
| 94 | - } |
|
| 87 | +public function container(string $sMethod = '*'): Data\ContainerData |
|
| 88 | +{ |
|
| 89 | +if(!isset($this->aContainers[$sMethod])) |
|
| 90 | +{ |
|
| 91 | +$this->aContainers[$sMethod] = new Data\ContainerData(); |
|
| 92 | +} |
|
| 93 | +return $this->aContainers[$sMethod]; |
|
| 94 | +} |
|
| 95 | 95 | |
| 96 | - /** |
|
| 96 | +/** |
|
| 97 | 97 | * @param string $sMethod |
| 98 | 98 | * |
| 99 | 99 | * @return Data\DatabagData |
| 100 | 100 | */ |
| 101 | - public function databag(string $sMethod = '*'): Data\DatabagData |
|
| 102 | - { |
|
| 103 | - if(!isset($this->aDatabags[$sMethod])) |
|
| 104 | - { |
|
| 105 | - $this->aDatabags[$sMethod] = new Data\DatabagData(); |
|
| 106 | - } |
|
| 107 | - return $this->aDatabags[$sMethod]; |
|
| 108 | - } |
|
| 101 | +public function databag(string $sMethod = '*'): Data\DatabagData |
|
| 102 | +{ |
|
| 103 | +if(!isset($this->aDatabags[$sMethod])) |
|
| 104 | +{ |
|
| 105 | +$this->aDatabags[$sMethod] = new Data\DatabagData(); |
|
| 106 | +} |
|
| 107 | +return $this->aDatabags[$sMethod]; |
|
| 108 | +} |
|
| 109 | 109 | |
| 110 | - /** |
|
| 110 | +/** |
|
| 111 | 111 | * @param string $sMethod |
| 112 | 112 | * |
| 113 | 113 | * @return Data\CallbackData |
| 114 | 114 | */ |
| 115 | - public function callback(string $sMethod = '*'): Data\CallbackData |
|
| 116 | - { |
|
| 117 | - if(!isset($this->aCallbacks[$sMethod])) |
|
| 118 | - { |
|
| 119 | - $this->aCallbacks[$sMethod] = new Data\CallbackData(); |
|
| 120 | - } |
|
| 121 | - return $this->aCallbacks[$sMethod]; |
|
| 122 | - } |
|
| 115 | +public function callback(string $sMethod = '*'): Data\CallbackData |
|
| 116 | +{ |
|
| 117 | +if(!isset($this->aCallbacks[$sMethod])) |
|
| 118 | +{ |
|
| 119 | +$this->aCallbacks[$sMethod] = new Data\CallbackData(); |
|
| 120 | +} |
|
| 121 | +return $this->aCallbacks[$sMethod]; |
|
| 122 | +} |
|
| 123 | 123 | |
| 124 | - /** |
|
| 124 | +/** |
|
| 125 | 125 | * @param string $sMethod |
| 126 | 126 | * |
| 127 | 127 | * @return Data\BeforeData |
| 128 | 128 | */ |
| 129 | - public function before(string $sMethod = '*'): Data\BeforeData |
|
| 130 | - { |
|
| 131 | - if(!isset($this->aBefores[$sMethod])) |
|
| 132 | - { |
|
| 133 | - $this->aBefores[$sMethod] = new Data\BeforeData(); |
|
| 134 | - } |
|
| 135 | - return $this->aBefores[$sMethod]; |
|
| 136 | - } |
|
| 129 | +public function before(string $sMethod = '*'): Data\BeforeData |
|
| 130 | +{ |
|
| 131 | +if(!isset($this->aBefores[$sMethod])) |
|
| 132 | +{ |
|
| 133 | +$this->aBefores[$sMethod] = new Data\BeforeData(); |
|
| 134 | +} |
|
| 135 | +return $this->aBefores[$sMethod]; |
|
| 136 | +} |
|
| 137 | 137 | |
| 138 | - /** |
|
| 138 | +/** |
|
| 139 | 139 | * @param string $sMethod |
| 140 | 140 | * |
| 141 | 141 | * @return Data\AfterData |
| 142 | 142 | */ |
| 143 | - public function after(string $sMethod = '*'): Data\AfterData |
|
| 144 | - { |
|
| 145 | - if(!isset($this->aAfters[$sMethod])) |
|
| 146 | - { |
|
| 147 | - $this->aAfters[$sMethod] = new Data\AfterData(); |
|
| 148 | - } |
|
| 149 | - return $this->aAfters[$sMethod]; |
|
| 150 | - } |
|
| 143 | +public function after(string $sMethod = '*'): Data\AfterData |
|
| 144 | +{ |
|
| 145 | +if(!isset($this->aAfters[$sMethod])) |
|
| 146 | +{ |
|
| 147 | +$this->aAfters[$sMethod] = new Data\AfterData(); |
|
| 148 | +} |
|
| 149 | +return $this->aAfters[$sMethod]; |
|
| 150 | +} |
|
| 151 | 151 | |
| 152 | - /** |
|
| 152 | +/** |
|
| 153 | 153 | * @param string $sMethod |
| 154 | 154 | * |
| 155 | 155 | * @return Data\UploadData |
| 156 | 156 | */ |
| 157 | - public function upload(string $sMethod = '*'): Data\UploadData |
|
| 158 | - { |
|
| 159 | - if(!isset($this->aUploads[$sMethod])) |
|
| 160 | - { |
|
| 161 | - $this->aUploads[$sMethod] = new Data\UploadData(); |
|
| 162 | - } |
|
| 163 | - return $this->aUploads[$sMethod]; |
|
| 164 | - } |
|
| 157 | +public function upload(string $sMethod = '*'): Data\UploadData |
|
| 158 | +{ |
|
| 159 | +if(!isset($this->aUploads[$sMethod])) |
|
| 160 | +{ |
|
| 161 | +$this->aUploads[$sMethod] = new Data\UploadData(); |
|
| 162 | +} |
|
| 163 | +return $this->aUploads[$sMethod]; |
|
| 164 | +} |
|
| 165 | 165 | |
| 166 | - /** |
|
| 166 | +/** |
|
| 167 | 167 | * @inheritDoc |
| 168 | 168 | */ |
| 169 | - public function isExcluded(): bool |
|
| 170 | - { |
|
| 171 | - return isset($this->aExcludes['*']) && $this->aExcludes['*']->getValue() === true; |
|
| 172 | - } |
|
| 169 | +public function isExcluded(): bool |
|
| 170 | +{ |
|
| 171 | +return isset($this->aExcludes['*']) && $this->aExcludes['*']->getValue() === true; |
|
| 172 | +} |
|
| 173 | 173 | |
| 174 | - /** |
|
| 174 | +/** |
|
| 175 | 175 | * @inheritDoc |
| 176 | 176 | */ |
| 177 | - public function getProperties(): array |
|
| 178 | - { |
|
| 179 | - $aAttributes = [ |
|
| 180 | - // $this->aExcludes, |
|
| 181 | - $this->aContainers, |
|
| 182 | - $this->aDatabags, |
|
| 183 | - $this->aCallbacks, |
|
| 184 | - $this->aBefores, |
|
| 185 | - $this->aAfters, |
|
| 186 | - $this->aUploads, |
|
| 187 | - ]; |
|
| 188 | - $aProperties = []; |
|
| 189 | - $aClassProperties = []; |
|
| 177 | +public function getProperties(): array |
|
| 178 | +{ |
|
| 179 | +$aAttributes = [ |
|
| 180 | +// $this->aExcludes, |
|
| 181 | +$this->aContainers, |
|
| 182 | +$this->aDatabags, |
|
| 183 | +$this->aCallbacks, |
|
| 184 | +$this->aBefores, |
|
| 185 | +$this->aAfters, |
|
| 186 | +$this->aUploads, |
|
| 187 | +]; |
|
| 188 | +$aProperties = []; |
|
| 189 | +$aClassProperties = []; |
|
| 190 | 190 | |
| 191 | - foreach($aAttributes as $aValues) |
|
| 192 | - { |
|
| 193 | - foreach($aValues as $sMethod => $xData) |
|
| 194 | - { |
|
| 195 | - if($sMethod === '*') |
|
| 196 | - { |
|
| 197 | - $aClassProperties[$xData->getName()] = $xData->getValue(); |
|
| 198 | - continue; |
|
| 199 | - } |
|
| 200 | - $aProperties[$sMethod][$xData->getName()] = $xData->getValue(); |
|
| 201 | - } |
|
| 202 | - } |
|
| 191 | +foreach($aAttributes as $aValues) |
|
| 192 | +{ |
|
| 193 | +foreach($aValues as $sMethod => $xData) |
|
| 194 | +{ |
|
| 195 | + if($sMethod === '*') |
|
| 196 | + { |
|
| 197 | + $aClassProperties[$xData->getName()] = $xData->getValue(); |
|
| 198 | + continue; |
|
| 199 | + } |
|
| 200 | + $aProperties[$sMethod][$xData->getName()] = $xData->getValue(); |
|
| 201 | +} |
|
| 202 | +} |
|
| 203 | 203 | |
| 204 | - if(count($aClassProperties) > 0) |
|
| 205 | - { |
|
| 206 | - $aProperties['*'] = $aClassProperties; |
|
| 207 | - } |
|
| 204 | +if(count($aClassProperties) > 0) |
|
| 205 | +{ |
|
| 206 | +$aProperties['*'] = $aClassProperties; |
|
| 207 | +} |
|
| 208 | 208 | |
| 209 | - return $aProperties; |
|
| 210 | - } |
|
| 209 | +return $aProperties; |
|
| 210 | +} |
|
| 211 | 211 | |
| 212 | - /** |
|
| 212 | +/** |
|
| 213 | 213 | * @inheritDoc |
| 214 | 214 | */ |
| 215 | - public function getProtectedMethods(): array |
|
| 216 | - { |
|
| 217 | - $aMethods = array_keys($this->aExcludes); |
|
| 218 | - return array_values(array_filter($aMethods, fn(string $sName) => |
|
| 219 | - $sName !== '*' && $this->aExcludes[$sName]->getValue() === true)); |
|
| 220 | - } |
|
| 215 | +public function getProtectedMethods(): array |
|
| 216 | +{ |
|
| 217 | +$aMethods = array_keys($this->aExcludes); |
|
| 218 | +return array_values(array_filter($aMethods, fn(string $sName) => |
|
| 219 | +$sName !== '*' && $this->aExcludes[$sName]->getValue() === true)); |
|
| 220 | +} |
|
| 221 | 221 | |
| 222 | - /** |
|
| 222 | +/** |
|
| 223 | 223 | * @return array |
| 224 | 224 | */ |
| 225 | - public function encode(): array |
|
| 226 | - { |
|
| 227 | - $aAttributes = [ |
|
| 228 | - 'exclude' => $this->aExcludes, |
|
| 229 | - 'container' => $this->aContainers, |
|
| 230 | - 'databag' => $this->aDatabags, |
|
| 231 | - 'callback' => $this->aCallbacks, |
|
| 232 | - 'before' => $this->aBefores, |
|
| 233 | - 'after' => $this->aAfters, |
|
| 234 | - 'upload' => $this->aUploads, |
|
| 235 | - ]; |
|
| 225 | +public function encode(): array |
|
| 226 | +{ |
|
| 227 | +$aAttributes = [ |
|
| 228 | +'exclude' => $this->aExcludes, |
|
| 229 | +'container' => $this->aContainers, |
|
| 230 | +'databag' => $this->aDatabags, |
|
| 231 | +'callback' => $this->aCallbacks, |
|
| 232 | +'before' => $this->aBefores, |
|
| 233 | +'after' => $this->aAfters, |
|
| 234 | +'upload' => $this->aUploads, |
|
| 235 | +]; |
|
| 236 | 236 | |
| 237 | - $sVar = '$'; // The dollar car. |
|
| 238 | - $aCalls = [ |
|
| 239 | - "{$sVar}xMetadata = new " . Metadata::class . '();' |
|
| 240 | - ]; |
|
| 241 | - foreach($aAttributes as $sAttr => $aValues) |
|
| 242 | - { |
|
| 243 | - if(count($aValues) === 0) |
|
| 244 | - { |
|
| 245 | - continue; |
|
| 246 | - } |
|
| 247 | - foreach($aValues as $sMethod => $xData) |
|
| 248 | - { |
|
| 249 | - $aCalls[] = "{$sVar}xData = {$sVar}xMetadata->{$sAttr}('$sMethod');"; |
|
| 250 | - foreach($xData->encode("{$sVar}xData") as $sCall) |
|
| 251 | - { |
|
| 252 | - $aCalls[] = $sCall; |
|
| 253 | - } |
|
| 254 | - } |
|
| 255 | - } |
|
| 256 | - $aCalls[] = "return {$sVar}xMetadata;"; |
|
| 257 | - return $aCalls; |
|
| 237 | +$sVar = '$'; // The dollar car. |
|
| 238 | +$aCalls = [ |
|
| 239 | +"{$sVar}xMetadata = new " . Metadata::class . '();' |
|
| 240 | +]; |
|
| 241 | +foreach($aAttributes as $sAttr => $aValues) |
|
| 242 | +{ |
|
| 243 | +if(count($aValues) === 0) |
|
| 244 | +{ |
|
| 245 | + continue; |
|
| 246 | +} |
|
| 247 | +foreach($aValues as $sMethod => $xData) |
|
| 248 | +{ |
|
| 249 | + $aCalls[] = "{$sVar}xData = {$sVar}xMetadata->{$sAttr}('$sMethod');"; |
|
| 250 | + foreach($xData->encode("{$sVar}xData") as $sCall) |
|
| 251 | + { |
|
| 252 | + $aCalls[] = $sCall; |
|
| 258 | 253 | } |
| 259 | 254 | } |
| 255 | +} |
|
| 256 | +$aCalls[] = "return {$sVar}xMetadata;"; |
|
| 257 | +return $aCalls; |
|
| 258 | +} |
|
| 259 | +} |
|
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public function exclude(string $sMethod = '*'): Data\ExcludeData |
| 74 | 74 | { |
| 75 | - if(!isset($this->aExcludes[$sMethod])) |
|
| 75 | + if (!isset($this->aExcludes[$sMethod])) |
|
| 76 | 76 | { |
| 77 | 77 | $this->aExcludes[$sMethod] = new Data\ExcludeData(); |
| 78 | 78 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function container(string $sMethod = '*'): Data\ContainerData |
| 88 | 88 | { |
| 89 | - if(!isset($this->aContainers[$sMethod])) |
|
| 89 | + if (!isset($this->aContainers[$sMethod])) |
|
| 90 | 90 | { |
| 91 | 91 | $this->aContainers[$sMethod] = new Data\ContainerData(); |
| 92 | 92 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | */ |
| 101 | 101 | public function databag(string $sMethod = '*'): Data\DatabagData |
| 102 | 102 | { |
| 103 | - if(!isset($this->aDatabags[$sMethod])) |
|
| 103 | + if (!isset($this->aDatabags[$sMethod])) |
|
| 104 | 104 | { |
| 105 | 105 | $this->aDatabags[$sMethod] = new Data\DatabagData(); |
| 106 | 106 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function callback(string $sMethod = '*'): Data\CallbackData |
| 116 | 116 | { |
| 117 | - if(!isset($this->aCallbacks[$sMethod])) |
|
| 117 | + if (!isset($this->aCallbacks[$sMethod])) |
|
| 118 | 118 | { |
| 119 | 119 | $this->aCallbacks[$sMethod] = new Data\CallbackData(); |
| 120 | 120 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function before(string $sMethod = '*'): Data\BeforeData |
| 130 | 130 | { |
| 131 | - if(!isset($this->aBefores[$sMethod])) |
|
| 131 | + if (!isset($this->aBefores[$sMethod])) |
|
| 132 | 132 | { |
| 133 | 133 | $this->aBefores[$sMethod] = new Data\BeforeData(); |
| 134 | 134 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function after(string $sMethod = '*'): Data\AfterData |
| 144 | 144 | { |
| 145 | - if(!isset($this->aAfters[$sMethod])) |
|
| 145 | + if (!isset($this->aAfters[$sMethod])) |
|
| 146 | 146 | { |
| 147 | 147 | $this->aAfters[$sMethod] = new Data\AfterData(); |
| 148 | 148 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function upload(string $sMethod = '*'): Data\UploadData |
| 158 | 158 | { |
| 159 | - if(!isset($this->aUploads[$sMethod])) |
|
| 159 | + if (!isset($this->aUploads[$sMethod])) |
|
| 160 | 160 | { |
| 161 | 161 | $this->aUploads[$sMethod] = new Data\UploadData(); |
| 162 | 162 | } |
@@ -188,11 +188,11 @@ discard block |
||
| 188 | 188 | $aProperties = []; |
| 189 | 189 | $aClassProperties = []; |
| 190 | 190 | |
| 191 | - foreach($aAttributes as $aValues) |
|
| 191 | + foreach ($aAttributes as $aValues) |
|
| 192 | 192 | { |
| 193 | - foreach($aValues as $sMethod => $xData) |
|
| 193 | + foreach ($aValues as $sMethod => $xData) |
|
| 194 | 194 | { |
| 195 | - if($sMethod === '*') |
|
| 195 | + if ($sMethod === '*') |
|
| 196 | 196 | { |
| 197 | 197 | $aClassProperties[$xData->getName()] = $xData->getValue(); |
| 198 | 198 | continue; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if(count($aClassProperties) > 0) |
|
| 204 | + if (count($aClassProperties) > 0) |
|
| 205 | 205 | { |
| 206 | 206 | $aProperties['*'] = $aClassProperties; |
| 207 | 207 | } |
@@ -238,16 +238,16 @@ discard block |
||
| 238 | 238 | $aCalls = [ |
| 239 | 239 | "{$sVar}xMetadata = new " . Metadata::class . '();' |
| 240 | 240 | ]; |
| 241 | - foreach($aAttributes as $sAttr => $aValues) |
|
| 241 | + foreach ($aAttributes as $sAttr => $aValues) |
|
| 242 | 242 | { |
| 243 | - if(count($aValues) === 0) |
|
| 243 | + if (count($aValues) === 0) |
|
| 244 | 244 | { |
| 245 | 245 | continue; |
| 246 | 246 | } |
| 247 | - foreach($aValues as $sMethod => $xData) |
|
| 247 | + foreach ($aValues as $sMethod => $xData) |
|
| 248 | 248 | { |
| 249 | 249 | $aCalls[] = "{$sVar}xData = {$sVar}xMetadata->{$sAttr}('$sMethod');"; |
| 250 | - foreach($xData->encode("{$sVar}xData") as $sCall) |
|
| 250 | + foreach ($xData->encode("{$sVar}xData") as $sCall) |
|
| 251 | 251 | { |
| 252 | 252 | $aCalls[] = $sCall; |
| 253 | 253 | } |
@@ -16,44 +16,44 @@ |
||
| 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 [ |
|
| 56 | - "{$sVarName}->setValue(" . ($this->bValue ? 'true' : 'false') . ");", |
|
| 57 | - ]; |
|
| 58 | - } |
|
| 53 | +public function encode(string $sVarName): array |
|
| 54 | +{ |
|
| 55 | +return [ |
|
| 56 | +"{$sVarName}->setValue(" . ($this->bValue ? 'true' : 'false') . ");", |
|
| 57 | +]; |
|
| 58 | +} |
|
| 59 | 59 | } |
@@ -21,71 +21,71 @@ |
||
| 21 | 21 | |
| 22 | 22 | abstract class HookData extends AbstractData |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @var array |
| 26 | 26 | */ |
| 27 | - protected $aCalls = []; |
|
| 27 | +protected $aCalls = []; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | - abstract protected function getType(): string; |
|
| 32 | +abstract protected function getType(): string; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @return string |
| 36 | 36 | */ |
| 37 | - public function getName(): string |
|
| 38 | - { |
|
| 39 | - return '__' . $this->getType(); |
|
| 40 | - } |
|
| 37 | +public function getName(): string |
|
| 38 | +{ |
|
| 39 | +return '__' . $this->getType(); |
|
| 40 | +} |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | +/** |
|
| 43 | 43 | * @return mixed |
| 44 | 44 | */ |
| 45 | - public function getValue(): mixed |
|
| 46 | - { |
|
| 47 | - return $this->aCalls; |
|
| 48 | - } |
|
| 45 | +public function getValue(): mixed |
|
| 46 | +{ |
|
| 47 | +return $this->aCalls; |
|
| 48 | +} |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | +/** |
|
| 51 | 51 | * @param string $sMethod |
| 52 | 52 | * |
| 53 | 53 | * @return void |
| 54 | 54 | */ |
| 55 | - protected function validateMethod(string $sMethod): void |
|
| 56 | - { |
|
| 57 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0) |
|
| 58 | - { |
|
| 59 | - return; |
|
| 60 | - } |
|
| 61 | - $sType = $this->getType(); |
|
| 62 | - throw new SetupException("$sMethod is not a valid \"call\" value for $sType."); |
|
| 63 | - } |
|
| 55 | +protected function validateMethod(string $sMethod): void |
|
| 56 | +{ |
|
| 57 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0) |
|
| 58 | +{ |
|
| 59 | +return; |
|
| 60 | +} |
|
| 61 | +$sType = $this->getType(); |
|
| 62 | +throw new SetupException("$sMethod is not a valid \"call\" value for $sType."); |
|
| 63 | +} |
|
| 64 | 64 | |
| 65 | - /** |
|
| 65 | +/** |
|
| 66 | 66 | * @param string $sMethod |
| 67 | 67 | * @param array $aParams |
| 68 | 68 | * |
| 69 | 69 | * @return void |
| 70 | 70 | */ |
| 71 | - public function addCall(string $sMethod, array $aParams): void |
|
| 72 | - { |
|
| 73 | - $this->validateMethod($sMethod); |
|
| 71 | +public function addCall(string $sMethod, array $aParams): void |
|
| 72 | +{ |
|
| 73 | +$this->validateMethod($sMethod); |
|
| 74 | 74 | |
| 75 | - $this->aCalls[$sMethod] = $aParams; |
|
| 76 | - } |
|
| 75 | +$this->aCalls[$sMethod] = $aParams; |
|
| 76 | +} |
|
| 77 | 77 | |
| 78 | - /** |
|
| 78 | +/** |
|
| 79 | 79 | * @inheritDoc |
| 80 | 80 | */ |
| 81 | - public function encode(string $sVarName): array |
|
| 82 | - { |
|
| 83 | - $aCalls = []; |
|
| 84 | - foreach($this->aCalls as $sMethod => $aParams) |
|
| 85 | - { |
|
| 86 | - $sParams = addslashes(json_encode($aParams)); |
|
| 87 | - $aCalls[] = "{$sVarName}->addCall('$sMethod', json_decode(\"$sParams\", true));"; |
|
| 88 | - } |
|
| 89 | - return $aCalls; |
|
| 90 | - } |
|
| 81 | +public function encode(string $sVarName): array |
|
| 82 | +{ |
|
| 83 | +$aCalls = []; |
|
| 84 | +foreach($this->aCalls as $sMethod => $aParams) |
|
| 85 | +{ |
|
| 86 | +$sParams = addslashes(json_encode($aParams)); |
|
| 87 | +$aCalls[] = "{$sVarName}->addCall('$sMethod', json_decode(\"$sParams\", true));"; |
|
| 88 | +} |
|
| 89 | +return $aCalls; |
|
| 90 | +} |
|
| 91 | 91 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | protected function validateMethod(string $sMethod): void |
| 56 | 56 | { |
| 57 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0) |
|
| 57 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sMethod) > 0) |
|
| 58 | 58 | { |
| 59 | 59 | return; |
| 60 | 60 | } |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | public function encode(string $sVarName): array |
| 82 | 82 | { |
| 83 | 83 | $aCalls = []; |
| 84 | - foreach($this->aCalls as $sMethod => $aParams) |
|
| 84 | + foreach ($this->aCalls as $sMethod => $aParams) |
|
| 85 | 85 | { |
| 86 | 86 | $sParams = addslashes(json_encode($aParams)); |
| 87 | 87 | $aCalls[] = "{$sVarName}->addCall('$sMethod', json_decode(\"$sParams\", true));"; |
@@ -21,60 +21,60 @@ |
||
| 21 | 21 | |
| 22 | 22 | class CallbackData extends AbstractData |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * The callback js objects |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $aNames = []; |
|
| 29 | +protected $aNames = []; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - public function getName(): string |
|
| 35 | - { |
|
| 36 | - return 'callback'; |
|
| 37 | - } |
|
| 34 | +public function getName(): string |
|
| 35 | +{ |
|
| 36 | +return 'callback'; |
|
| 37 | +} |
|
| 38 | 38 | |
| 39 | - /** |
|
| 39 | +/** |
|
| 40 | 40 | * @return mixed |
| 41 | 41 | */ |
| 42 | - public function getValue(): mixed |
|
| 43 | - { |
|
| 44 | - return $this->aNames; |
|
| 45 | - } |
|
| 42 | +public function getValue(): mixed |
|
| 43 | +{ |
|
| 44 | +return $this->aNames; |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * @param string $sName |
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - protected function validateObjectName(string $sName): void |
|
| 53 | - { |
|
| 54 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 55 | - { |
|
| 56 | - return; |
|
| 57 | - } |
|
| 58 | - throw new SetupException("$sName is not a valid \"name\" value for callback"); |
|
| 59 | - } |
|
| 52 | +protected function validateObjectName(string $sName): void |
|
| 53 | +{ |
|
| 54 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 55 | +{ |
|
| 56 | +return; |
|
| 57 | +} |
|
| 58 | +throw new SetupException("$sName is not a valid \"name\" value for callback"); |
|
| 59 | +} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * @param string $sName |
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function addValue(string $sName): void |
|
| 67 | - { |
|
| 68 | - $this->validateObjectName($sName); |
|
| 66 | +public function addValue(string $sName): void |
|
| 67 | +{ |
|
| 68 | +$this->validateObjectName($sName); |
|
| 69 | 69 | |
| 70 | - $this->aNames[] = $sName; |
|
| 71 | - } |
|
| 70 | +$this->aNames[] = $sName; |
|
| 71 | +} |
|
| 72 | 72 | |
| 73 | - /** |
|
| 73 | +/** |
|
| 74 | 74 | * @inheritDoc |
| 75 | 75 | */ |
| 76 | - public function encode(string $sVarName): array |
|
| 77 | - { |
|
| 78 | - return array_map(fn($sName) => "{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 79 | - } |
|
| 76 | +public function encode(string $sVarName): array |
|
| 77 | +{ |
|
| 78 | +return array_map(fn($sName) => "{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 79 | +} |
|
| 80 | 80 | } |
@@ -20,63 +20,63 @@ |
||
| 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 [ |
|
| 79 | - "{$sVarName}->setValue('{$this->sField}');", |
|
| 80 | - ]; |
|
| 81 | - } |
|
| 76 | +public function encode(string $sVarName): array |
|
| 77 | +{ |
|
| 78 | +return [ |
|
| 79 | +"{$sVarName}->setValue('{$this->sField}');", |
|
| 80 | +]; |
|
| 81 | +} |
|
| 82 | 82 | } |
@@ -21,83 +21,83 @@ |
||
| 21 | 21 | |
| 22 | 22 | class ContainerData extends AbstractData |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * The properties to get from the container |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $aProperties = []; |
|
| 29 | +protected $aProperties = []; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * @return string |
| 33 | 33 | */ |
| 34 | - public function getName(): string |
|
| 35 | - { |
|
| 36 | - return '__di'; |
|
| 37 | - } |
|
| 34 | +public function getName(): string |
|
| 35 | +{ |
|
| 36 | +return '__di'; |
|
| 37 | +} |
|
| 38 | 38 | |
| 39 | - /** |
|
| 39 | +/** |
|
| 40 | 40 | * @return mixed |
| 41 | 41 | */ |
| 42 | - public function getValue(): mixed |
|
| 43 | - { |
|
| 44 | - return $this->aProperties; |
|
| 45 | - } |
|
| 42 | +public function getValue(): mixed |
|
| 43 | +{ |
|
| 44 | +return $this->aProperties; |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * @param string $sAttr |
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - protected function validateAttr(string $sAttr): void |
|
| 53 | - { |
|
| 54 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0) |
|
| 55 | - { |
|
| 56 | - return; |
|
| 57 | - } |
|
| 58 | - throw new SetupException("$sAttr is not a valid \"attr\" value for di"); |
|
| 59 | - } |
|
| 52 | +protected function validateAttr(string $sAttr): void |
|
| 53 | +{ |
|
| 54 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0) |
|
| 55 | +{ |
|
| 56 | +return; |
|
| 57 | +} |
|
| 58 | +throw new SetupException("$sAttr is not a valid \"attr\" value for di"); |
|
| 59 | +} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * @param string $sClass |
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - protected function validateClass(string $sClass): void |
|
| 67 | - { |
|
| 68 | - if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0) |
|
| 69 | - { |
|
| 70 | - return; |
|
| 71 | - } |
|
| 72 | - throw new SetupException("$sClass is not a valid \"class\" value for di"); |
|
| 73 | - } |
|
| 66 | +protected function validateClass(string $sClass): void |
|
| 67 | +{ |
|
| 68 | +if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0) |
|
| 69 | +{ |
|
| 70 | +return; |
|
| 71 | +} |
|
| 72 | +throw new SetupException("$sClass is not a valid \"class\" value for di"); |
|
| 73 | +} |
|
| 74 | 74 | |
| 75 | - /** |
|
| 75 | +/** |
|
| 76 | 76 | * @param string $sAttr |
| 77 | 77 | * @param string $sClass |
| 78 | 78 | * |
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | - public function addValue(string $sAttr, string $sClass): void |
|
| 82 | - { |
|
| 83 | - $this->validateAttr($sAttr); |
|
| 84 | - $this->validateClass($sClass); |
|
| 81 | +public function addValue(string $sAttr, string $sClass): void |
|
| 82 | +{ |
|
| 83 | +$this->validateAttr($sAttr); |
|
| 84 | +$this->validateClass($sClass); |
|
| 85 | 85 | |
| 86 | - $this->aProperties[$sAttr] = $sClass; |
|
| 87 | - } |
|
| 86 | +$this->aProperties[$sAttr] = $sClass; |
|
| 87 | +} |
|
| 88 | 88 | |
| 89 | - /** |
|
| 89 | +/** |
|
| 90 | 90 | * @inheritDoc |
| 91 | 91 | */ |
| 92 | - public function encode(string $sVarName): array |
|
| 93 | - { |
|
| 94 | - $aCalls = []; |
|
| 95 | - foreach($this->aProperties as $sAttr => $sClass) |
|
| 96 | - { |
|
| 97 | - $sClass = addslashes($sClass); |
|
| 98 | - $aCalls[] = "{$sVarName}->addValue('$sAttr', '$sClass');"; |
|
| 99 | - } |
|
| 92 | +public function encode(string $sVarName): array |
|
| 93 | +{ |
|
| 94 | +$aCalls = []; |
|
| 95 | +foreach($this->aProperties as $sAttr => $sClass) |
|
| 96 | +{ |
|
| 97 | +$sClass = addslashes($sClass); |
|
| 98 | +$aCalls[] = "{$sVarName}->addValue('$sAttr', '$sClass');"; |
|
| 99 | +} |
|
| 100 | 100 | |
| 101 | - return $aCalls; |
|
| 102 | - } |
|
| 101 | +return $aCalls; |
|
| 102 | +} |
|
| 103 | 103 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected function validateAttr(string $sAttr): void |
| 53 | 53 | { |
| 54 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0) |
|
| 54 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0) |
|
| 55 | 55 | { |
| 56 | 56 | return; |
| 57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | protected function validateClass(string $sClass): void |
| 67 | 67 | { |
| 68 | - if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0) |
|
| 68 | + if (preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0) |
|
| 69 | 69 | { |
| 70 | 70 | return; |
| 71 | 71 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | public function encode(string $sVarName): array |
| 93 | 93 | { |
| 94 | 94 | $aCalls = []; |
| 95 | - foreach($this->aProperties as $sAttr => $sClass) |
|
| 95 | + foreach ($this->aProperties as $sAttr => $sClass) |
|
| 96 | 96 | { |
| 97 | 97 | $sClass = addslashes($sClass); |
| 98 | 98 | $aCalls[] = "{$sVarName}->addValue('$sAttr', '$sClass');"; |
@@ -16,12 +16,12 @@ |
||
| 16 | 16 | |
| 17 | 17 | abstract class AbstractData |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * Generate the PHP code to populate a Metadata object |
| 21 | 21 | * |
| 22 | 22 | * @param string $sVarName |
| 23 | 23 | * |
| 24 | 24 | * @return array |
| 25 | 25 | */ |
| 26 | - abstract public function encode(string $sVarName): array; |
|
| 26 | +abstract public function encode(string $sVarName): array; |
|
| 27 | 27 | } |