@@ -19,41 +19,41 @@ |
||
| 19 | 19 | |
| 20 | 20 | trait DiTrait |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @var Container |
| 24 | 24 | */ |
| 25 | - private Container $xContainer; |
|
| 25 | +private Container $xContainer; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 27 | +/** |
|
| 28 | 28 | * @var ComponentContainer |
| 29 | 29 | */ |
| 30 | - protected ComponentContainer $xComponentContainer; |
|
| 30 | +protected ComponentContainer $xComponentContainer; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | +/** |
|
| 33 | 33 | * Get the DI container |
| 34 | 34 | * |
| 35 | 35 | * @return Container |
| 36 | 36 | */ |
| 37 | - public function di(): Container |
|
| 38 | - { |
|
| 39 | - return $this->xContainer; |
|
| 40 | - } |
|
| 37 | +public function di(): Container |
|
| 38 | +{ |
|
| 39 | +return $this->xContainer; |
|
| 40 | +} |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | +/** |
|
| 43 | 43 | * Get the component DI container |
| 44 | 44 | * |
| 45 | 45 | * @return ComponentContainer |
| 46 | 46 | */ |
| 47 | - public function cdi(): ComponentContainer |
|
| 48 | - { |
|
| 49 | - return $this->xComponentContainer; |
|
| 50 | - } |
|
| 47 | +public function cdi(): ComponentContainer |
|
| 48 | +{ |
|
| 49 | +return $this->xComponentContainer; |
|
| 50 | +} |
|
| 51 | 51 | |
| 52 | - /** |
|
| 52 | +/** |
|
| 53 | 53 | * @return ConfigManager |
| 54 | 54 | */ |
| 55 | - public function config(): ConfigManager |
|
| 56 | - { |
|
| 57 | - return $this->di()->g(ConfigManager::class); |
|
| 58 | - } |
|
| 55 | +public function config(): ConfigManager |
|
| 56 | +{ |
|
| 57 | +return $this->di()->g(ConfigManager::class); |
|
| 58 | +} |
|
| 59 | 59 | } |
@@ -22,58 +22,58 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | interface AppInterface |
| 24 | 24 | { |
| 25 | - /** |
|
| 25 | +/** |
|
| 26 | 26 | * Set the logger. |
| 27 | 27 | * |
| 28 | 28 | * @param LoggerInterface|Closure $xLogger |
| 29 | 29 | * |
| 30 | 30 | * @return void |
| 31 | 31 | */ |
| 32 | - public function setLogger(LoggerInterface|Closure $xLogger): void; |
|
| 32 | +public function setLogger(LoggerInterface|Closure $xLogger): void; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * Get the configured character encoding |
| 36 | 36 | * |
| 37 | 37 | * @return string |
| 38 | 38 | */ |
| 39 | - public function getCharacterEncoding(): string; |
|
| 39 | +public function getCharacterEncoding(): string; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | +/** |
|
| 42 | 42 | * Get the content type of the HTTP response |
| 43 | 43 | * |
| 44 | 44 | * @return string |
| 45 | 45 | */ |
| 46 | - public function getContentType(): string; |
|
| 46 | +public function getContentType(): string; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * Get the HTML tags to include Jaxon javascript files into the page. |
| 50 | 50 | * |
| 51 | 51 | * @return string |
| 52 | 52 | */ |
| 53 | - public function getJs(): string; |
|
| 53 | +public function getJs(): string; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | +/** |
|
| 56 | 56 | * Get the HTML tags to include Jaxon javascript files into the page. |
| 57 | 57 | * |
| 58 | 58 | * @return string the javascript code |
| 59 | 59 | */ |
| 60 | - public function js(): string; |
|
| 60 | +public function js(): string; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * Get the HTML tags to include Jaxon CSS code and files into the page. |
| 64 | 64 | * |
| 65 | 65 | * @return string |
| 66 | 66 | */ |
| 67 | - public function getCss(): string; |
|
| 67 | +public function getCss(): string; |
|
| 68 | 68 | |
| 69 | - /** |
|
| 69 | +/** |
|
| 70 | 70 | * Get the HTML tags to include Jaxon CSS code and files into the page. |
| 71 | 71 | * |
| 72 | 72 | * @return string the javascript code |
| 73 | 73 | */ |
| 74 | - public function css(): string; |
|
| 74 | +public function css(): string; |
|
| 75 | 75 | |
| 76 | - /** |
|
| 76 | +/** |
|
| 77 | 77 | * Returns the js header and wrapper code to be printed into the page |
| 78 | 78 | * |
| 79 | 79 | * The javascript code returned by this function is dependent on the plugins |
@@ -84,9 +84,9 @@ discard block |
||
| 84 | 84 | * |
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | - public function getScript(bool $bIncludeJs = false, bool $bIncludeCss = false): string; |
|
| 87 | +public function getScript(bool $bIncludeJs = false, bool $bIncludeCss = false): string; |
|
| 88 | 88 | |
| 89 | - /** |
|
| 89 | +/** |
|
| 90 | 90 | * Returns the js header and wrapper code to be printed into the page |
| 91 | 91 | * |
| 92 | 92 | * @param bool $bIncludeJs Also get the JS files |
@@ -95,46 +95,46 @@ discard block |
||
| 95 | 95 | * @return string the javascript code |
| 96 | 96 | * @throws UriException |
| 97 | 97 | */ |
| 98 | - public function script(bool $bIncludeJs = false, bool $bIncludeCss = false): string; |
|
| 98 | +public function script(bool $bIncludeJs = false, bool $bIncludeCss = false): string; |
|
| 99 | 99 | |
| 100 | - /** |
|
| 100 | +/** |
|
| 101 | 101 | * Determine if a call is a jaxon request or a page load request |
| 102 | 102 | * |
| 103 | 103 | * @return bool |
| 104 | 104 | */ |
| 105 | - public function canProcessRequest(): bool; |
|
| 105 | +public function canProcessRequest(): bool; |
|
| 106 | 106 | |
| 107 | - /** |
|
| 107 | +/** |
|
| 108 | 108 | * Process an incoming Jaxon request, and return the response. |
| 109 | 109 | * |
| 110 | 110 | * @return mixed |
| 111 | 111 | */ |
| 112 | - public function processRequest(): mixed; |
|
| 112 | +public function processRequest(): mixed; |
|
| 113 | 113 | |
| 114 | - /** |
|
| 114 | +/** |
|
| 115 | 115 | * Get the Jaxon ajax response |
| 116 | 116 | * |
| 117 | 117 | * @return AjaxResponse |
| 118 | 118 | */ |
| 119 | - public function ajaxResponse(): AjaxResponse; |
|
| 119 | +public function ajaxResponse(): AjaxResponse; |
|
| 120 | 120 | |
| 121 | - /** |
|
| 121 | +/** |
|
| 122 | 122 | * @param Closure $xClosure A closure to create the session manager instance |
| 123 | 123 | * |
| 124 | 124 | * @return void |
| 125 | 125 | */ |
| 126 | - public function setSessionManager(Closure $xClosure); |
|
| 126 | +public function setSessionManager(Closure $xClosure); |
|
| 127 | 127 | |
| 128 | - /** |
|
| 128 | +/** |
|
| 129 | 129 | * Set the container provided by the integrated framework |
| 130 | 130 | * |
| 131 | 131 | * @param ContainerInterface $xContainer The container implementation |
| 132 | 132 | * |
| 133 | 133 | * @return void |
| 134 | 134 | */ |
| 135 | - public function setContainer(ContainerInterface $xContainer); |
|
| 135 | +public function setContainer(ContainerInterface $xContainer); |
|
| 136 | 136 | |
| 137 | - /** |
|
| 137 | +/** |
|
| 138 | 138 | * Add a view renderer with an id |
| 139 | 139 | * |
| 140 | 140 | * @param string $sRenderer The renderer name |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | * |
| 144 | 144 | * @return void |
| 145 | 145 | */ |
| 146 | - public function addViewRenderer(string $sRenderer, string $sExtension, Closure $xClosure); |
|
| 146 | +public function addViewRenderer(string $sRenderer, string $sExtension, Closure $xClosure); |
|
| 147 | 147 | |
| 148 | - /** |
|
| 148 | +/** |
|
| 149 | 149 | * Set the javascript asset |
| 150 | 150 | * |
| 151 | 151 | * @param bool $bExport Whether to export the js code in a file |
@@ -155,14 +155,14 @@ discard block |
||
| 155 | 155 | * |
| 156 | 156 | * @return void |
| 157 | 157 | */ |
| 158 | - public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): void; |
|
| 158 | +public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): void; |
|
| 159 | 159 | |
| 160 | - /** |
|
| 160 | +/** |
|
| 161 | 161 | * Read config options from a config file and set up the library |
| 162 | 162 | * |
| 163 | 163 | * @param string $sConfigFile The full path to the config file |
| 164 | 164 | * |
| 165 | 165 | * @return void |
| 166 | 166 | */ |
| 167 | - public function setup(string $sConfigFile = ''): void; |
|
| 167 | +public function setup(string $sConfigFile = ''): void; |
|
| 168 | 168 | } |
@@ -20,32 +20,32 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | abstract class AbstractApp implements AppInterface |
| 22 | 22 | { |
| 23 | - use Traits\ServicesTrait; |
|
| 24 | - use Traits\PluginTrait; |
|
| 25 | - use Traits\RequestTrait; |
|
| 26 | - use Traits\ResponseTrait; |
|
| 23 | +use Traits\ServicesTrait; |
|
| 24 | +use Traits\PluginTrait; |
|
| 25 | +use Traits\RequestTrait; |
|
| 26 | +use Traits\ResponseTrait; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 28 | +/** |
|
| 29 | 29 | * The class constructor |
| 30 | 30 | */ |
| 31 | - public function __construct() |
|
| 32 | - { |
|
| 33 | - // Declared in DiTrait. |
|
| 34 | - $this->xContainer = Jaxon::getInstance()->di(); |
|
| 35 | - $this->xComponentContainer = Jaxon::getInstance()->cdi(); |
|
| 36 | - } |
|
| 31 | +public function __construct() |
|
| 32 | +{ |
|
| 33 | +// Declared in DiTrait. |
|
| 34 | +$this->xContainer = Jaxon::getInstance()->di(); |
|
| 35 | +$this->xComponentContainer = Jaxon::getInstance()->cdi(); |
|
| 36 | +} |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * Get the Jaxon application bootstrapper. |
| 40 | 40 | * |
| 41 | 41 | * @return Bootstrap |
| 42 | 42 | */ |
| 43 | - protected function bootstrap(): Bootstrap |
|
| 44 | - { |
|
| 45 | - return $this->xContainer->getBootstrap(); |
|
| 46 | - } |
|
| 43 | +protected function bootstrap(): Bootstrap |
|
| 44 | +{ |
|
| 45 | +return $this->xContainer->getBootstrap(); |
|
| 46 | +} |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * Set the javascript asset |
| 50 | 50 | * |
| 51 | 51 | * @param bool $bExport Whether to export the js code in a file |
@@ -55,26 +55,26 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return void |
| 57 | 57 | */ |
| 58 | - public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): void |
|
| 59 | - { |
|
| 60 | - $this->bootstrap()->asset($bExport, $bMinify, $sUri, $sDir); |
|
| 61 | - } |
|
| 58 | +public function asset(bool $bExport, bool $bMinify, string $sUri = '', string $sDir = ''): void |
|
| 59 | +{ |
|
| 60 | +$this->bootstrap()->asset($bExport, $bMinify, $sUri, $sDir); |
|
| 61 | +} |
|
| 62 | 62 | |
| 63 | - /** |
|
| 63 | +/** |
|
| 64 | 64 | * Set the container provided by the integrated framework |
| 65 | 65 | * |
| 66 | 66 | * @param ContainerInterface $xContainer The container implementation |
| 67 | 67 | * |
| 68 | 68 | * @return void |
| 69 | 69 | */ |
| 70 | - public function setContainer(ContainerInterface $xContainer): void |
|
| 71 | - { |
|
| 72 | - $this->di()->setContainer($xContainer); |
|
| 73 | - } |
|
| 70 | +public function setContainer(ContainerInterface $xContainer): void |
|
| 71 | +{ |
|
| 72 | +$this->di()->setContainer($xContainer); |
|
| 73 | +} |
|
| 74 | 74 | |
| 75 | - /** |
|
| 75 | +/** |
|
| 76 | 76 | * @inheritDoc |
| 77 | 77 | */ |
| 78 | - public function setup(string $sConfigFile = ''): void |
|
| 79 | - {} |
|
| 78 | +public function setup(string $sConfigFile = ''): void |
|
| 79 | +{} |
|
| 80 | 80 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | interface ViewInterface |
| 6 | 6 | { |
| 7 | - /** |
|
| 7 | +/** |
|
| 8 | 8 | * Add a namespace to the view renderer |
| 9 | 9 | * |
| 10 | 10 | * @param string $sNamespace The namespace name |
@@ -13,14 +13,14 @@ discard block |
||
| 13 | 13 | * |
| 14 | 14 | * @return void |
| 15 | 15 | */ |
| 16 | - public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): void; |
|
| 16 | +public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): void; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | +/** |
|
| 19 | 19 | * Render a view |
| 20 | 20 | * |
| 21 | 21 | * @param Store $store A store populated with the view data |
| 22 | 22 | * |
| 23 | 23 | * @return string |
| 24 | 24 | */ |
| 25 | - public function render(Store $store): string; |
|
| 25 | +public function render(Store $store): string; |
|
| 26 | 26 | } |
@@ -73,8 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function excluded(?string $sMethodName = null): bool |
| 75 | 75 | { |
| 76 | - return $sMethodName === null ? $this->xOptions->excluded() : |
|
| 77 | - !$this->xOptions->isPublicMethod($sMethodName); |
|
| 76 | + return $sMethodName === null ? $this->xOptions->excluded() : !$this->xOptions->isPublicMethod($sMethodName); |
|
| 78 | 77 | } |
| 79 | 78 | |
| 80 | 79 | /** |
@@ -160,11 +159,11 @@ discard block |
||
| 160 | 159 | $sMethod = $this->xTarget->getMethodName(); |
| 161 | 160 | // The hooks defined at method level are merged with those defined at class level. |
| 162 | 161 | $aMethods = array_merge($aHookMethods['*'] ?? [], $aHookMethods[$sMethod] ?? []); |
| 163 | - foreach($aMethods as $xKey => $xValue) |
|
| 162 | + foreach ($aMethods as $xKey => $xValue) |
|
| 164 | 163 | { |
| 165 | 164 | $sHookName = $xValue; |
| 166 | 165 | $aHookArgs = []; |
| 167 | - if(is_string($xKey)) |
|
| 166 | + if (is_string($xKey)) |
|
| 168 | 167 | { |
| 169 | 168 | $sHookName = $xKey; |
| 170 | 169 | $aHookArgs = is_array($xValue) ? $xValue : [$xValue]; |
@@ -202,7 +201,7 @@ discard block |
||
| 202 | 201 | // Warning: dynamic properties will be deprecated in PHP8.2. |
| 203 | 202 | $this->$sAttr = $xDiValue; |
| 204 | 203 | }; |
| 205 | - foreach($aDiOptions as $sAttr => $sClass) |
|
| 204 | + foreach ($aDiOptions as $sAttr => $sClass) |
|
| 206 | 205 | { |
| 207 | 206 | $this->setDiAttribute($xComponent, $sAttr, $this->di->get($sClass), $cSetter); |
| 208 | 207 | } |
@@ -38,9 +38,9 @@ |
||
| 38 | 38 | public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
| 39 | 39 | { |
| 40 | 40 | $aMethods = []; |
| 41 | - foreach(['base', 'only', 'except'] as $key) |
|
| 41 | + foreach (['base', 'only', 'except'] as $key) |
|
| 42 | 42 | { |
| 43 | - if($this->$key !== null && count($this->$key) > 0) |
|
| 43 | + if ($this->$key !== null && count($this->$key) > 0) |
|
| 44 | 44 | { |
| 45 | 45 | $aMethods[$key] = $this->$key; |
| 46 | 46 | } |
@@ -26,41 +26,41 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class ExportAnnotation extends AbstractAnnotation |
| 28 | 28 | { |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * @var array |
| 31 | 31 | */ |
| 32 | - private $aMethods = []; |
|
| 32 | +private $aMethods = []; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @inheritDoc |
| 36 | 36 | */ |
| 37 | - public static function parseAnnotation($value) |
|
| 38 | - { |
|
| 39 | - $aParams = json_decode($value, true); |
|
| 40 | - return is_array($aParams) ? $aParams : []; |
|
| 41 | - } |
|
| 37 | +public static function parseAnnotation($value) |
|
| 38 | +{ |
|
| 39 | +$aParams = json_decode($value, true); |
|
| 40 | +return is_array($aParams) ? $aParams : []; |
|
| 41 | +} |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * @inheritDoc |
| 45 | 45 | * @throws AnnotationException |
| 46 | 46 | */ |
| 47 | - public function initAnnotation(array $properties) |
|
| 48 | - { |
|
| 49 | - foreach(['base', 'only', 'except'] as $key) |
|
| 50 | - { |
|
| 51 | - if(isset($properties[$key]) && is_array($properties[$key]) && |
|
| 52 | - count($properties[$key]) > 0) |
|
| 53 | - { |
|
| 54 | - $this->aMethods[$key] = $properties[$key]; |
|
| 55 | - } |
|
| 56 | - } |
|
| 57 | - } |
|
| 47 | +public function initAnnotation(array $properties) |
|
| 48 | +{ |
|
| 49 | +foreach(['base', 'only', 'except'] as $key) |
|
| 50 | +{ |
|
| 51 | +if(isset($properties[$key]) && is_array($properties[$key]) && |
|
| 52 | + count($properties[$key]) > 0) |
|
| 53 | +{ |
|
| 54 | + $this->aMethods[$key] = $properties[$key]; |
|
| 55 | +} |
|
| 56 | +} |
|
| 57 | +} |
|
| 58 | 58 | |
| 59 | - /** |
|
| 59 | +/** |
|
| 60 | 60 | * @inheritDoc |
| 61 | 61 | */ |
| 62 | - public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 63 | - { |
|
| 64 | - $xMetadata->export($sMethod)->setMethods($this->aMethods); |
|
| 65 | - } |
|
| 62 | +public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 63 | +{ |
|
| 64 | +$xMetadata->export($sMethod)->setMethods($this->aMethods); |
|
| 65 | +} |
|
| 66 | 66 | } |
@@ -46,9 +46,9 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | public function initAnnotation(array $properties) |
| 48 | 48 | { |
| 49 | - foreach(['base', 'only', 'except'] as $key) |
|
| 49 | + foreach (['base', 'only', 'except'] as $key) |
|
| 50 | 50 | { |
| 51 | - if(isset($properties[$key]) && is_array($properties[$key]) && |
|
| 51 | + if (isset($properties[$key]) && is_array($properties[$key]) && |
|
| 52 | 52 | count($properties[$key]) > 0) |
| 53 | 53 | { |
| 54 | 54 | $this->aMethods[$key] = $properties[$key]; |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -22,53 +22,53 @@ |
||
| 22 | 22 | |
| 23 | 23 | class ExportData extends AbstractData |
| 24 | 24 | { |
| 25 | - /** |
|
| 25 | +/** |
|
| 26 | 26 | * @var array<string, array<string>> |
| 27 | 27 | */ |
| 28 | - private array $aMethods = []; |
|
| 28 | +private array $aMethods = []; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 30 | +/** |
|
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - public function getName(): string |
|
| 34 | - { |
|
| 35 | - return 'export'; |
|
| 36 | - } |
|
| 33 | +public function getName(): string |
|
| 34 | +{ |
|
| 35 | +return 'export'; |
|
| 36 | +} |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * @return mixed |
| 40 | 40 | */ |
| 41 | - public function getValue(): mixed |
|
| 42 | - { |
|
| 43 | - return $this->aMethods; |
|
| 44 | - } |
|
| 41 | +public function getValue(): mixed |
|
| 42 | +{ |
|
| 43 | +return $this->aMethods; |
|
| 44 | +} |
|
| 45 | 45 | |
| 46 | - /** |
|
| 46 | +/** |
|
| 47 | 47 | * @param array $aMethods |
| 48 | 48 | * |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - public function setMethods(array $aMethods): void |
|
| 51 | +public function setMethods(array $aMethods): void |
|
| 52 | +{ |
|
| 53 | +foreach(['base', 'only', 'except'] as $sKey) |
|
| 54 | +{ |
|
| 55 | +foreach($aMethods[$sKey] ?? [] as $sMethod) |
|
| 56 | +{ |
|
| 57 | + if(!is_string($sMethod) || !$this->validateMethod($sMethod)) |
|
| 52 | 58 | { |
| 53 | - foreach(['base', 'only', 'except'] as $sKey) |
|
| 54 | - { |
|
| 55 | - foreach($aMethods[$sKey] ?? [] as $sMethod) |
|
| 56 | - { |
|
| 57 | - if(!is_string($sMethod) || !$this->validateMethod($sMethod)) |
|
| 58 | - { |
|
| 59 | - throw new SetupException("'$sMethod' is not a valid method name."); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - $this->aMethods = $aMethods; |
|
| 59 | + throw new SetupException("'$sMethod' is not a valid method name."); |
|
| 64 | 60 | } |
| 61 | +} |
|
| 62 | +} |
|
| 63 | +$this->aMethods = $aMethods; |
|
| 64 | +} |
|
| 65 | 65 | |
| 66 | - /** |
|
| 66 | +/** |
|
| 67 | 67 | * @inheritDoc |
| 68 | 68 | */ |
| 69 | - public function encode(string $sVarName): array |
|
| 70 | - { |
|
| 71 | - $sMethods = addslashes(json_encode($this->aMethods)); |
|
| 72 | - return ["{$sVarName}->setMethods(json_decode(\"$sMethods\", true));"]; |
|
| 73 | - } |
|
| 69 | +public function encode(string $sVarName): array |
|
| 70 | +{ |
|
| 71 | +$sMethods = addslashes(json_encode($this->aMethods)); |
|
| 72 | +return ["{$sVarName}->setMethods(json_decode(\"$sMethods\", true));"]; |
|
| 73 | +} |
|
| 74 | 74 | } |
@@ -50,11 +50,11 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function setMethods(array $aMethods): void |
| 52 | 52 | { |
| 53 | - foreach(['base', 'only', 'except'] as $sKey) |
|
| 53 | + foreach (['base', 'only', 'except'] as $sKey) |
|
| 54 | 54 | { |
| 55 | - foreach($aMethods[$sKey] ?? [] as $sMethod) |
|
| 55 | + foreach ($aMethods[$sKey] ?? [] as $sMethod) |
|
| 56 | 56 | { |
| 57 | - if(!is_string($sMethod) || !$this->validateMethod($sMethod)) |
|
| 57 | + if (!is_string($sMethod) || !$this->validateMethod($sMethod)) |
|
| 58 | 58 | { |
| 59 | 59 | throw new SetupException("'$sMethod' is not a valid method name."); |
| 60 | 60 | } |