@@ -28,27 +28,27 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | trait PluginTrait |
| 30 | 30 | { |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * @return PluginManager |
| 33 | 33 | */ |
| 34 | - abstract public function getPluginManager(): PluginManager; |
|
| 34 | +abstract public function getPluginManager(): PluginManager; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * @return PackageManager |
| 38 | 38 | */ |
| 39 | - abstract public function getPackageManager(): PackageManager; |
|
| 39 | +abstract public function getPackageManager(): PackageManager; |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | +/** |
|
| 42 | 42 | * @return CodeGenerator |
| 43 | 43 | */ |
| 44 | - abstract public function getCodeGenerator(): CodeGenerator; |
|
| 44 | +abstract public function getCodeGenerator(): CodeGenerator; |
|
| 45 | 45 | |
| 46 | - /** |
|
| 46 | +/** |
|
| 47 | 47 | * @return Bootstrap |
| 48 | 48 | */ |
| 49 | - abstract protected function getBootstrap(): Bootstrap; |
|
| 49 | +abstract protected function getBootstrap(): Bootstrap; |
|
| 50 | 50 | |
| 51 | - /** |
|
| 51 | +/** |
|
| 52 | 52 | * Register request handlers, including functions, callable classes and directories. |
| 53 | 53 | * |
| 54 | 54 | * @param string $sType The type of request handler being registered |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | * @return void |
| 66 | 66 | * @throws SetupException |
| 67 | 67 | */ |
| 68 | - public function register(string $sType, string $sName, $xOptions = []): void |
|
| 69 | - { |
|
| 70 | - // We need the library to have been bootstrapped. |
|
| 71 | - $this->getBootstrap()->onBoot(); |
|
| 72 | - $this->getPluginManager()->registerCallable($sType, $sName, $xOptions); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - /** |
|
| 68 | +public function register(string $sType, string $sName, $xOptions = []): void |
|
| 69 | +{ |
|
| 70 | +// We need the library to have been bootstrapped. |
|
| 71 | +$this->getBootstrap()->onBoot(); |
|
| 72 | +$this->getPluginManager()->registerCallable($sType, $sName, $xOptions); |
|
| 73 | +} |
|
| 74 | + |
|
| 75 | +/** |
|
| 76 | 76 | * Register a plugin |
| 77 | 77 | * |
| 78 | 78 | * Below is a table for priorities and their description: |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | * @return void |
| 88 | 88 | * @throws SetupException |
| 89 | 89 | */ |
| 90 | - public function registerPlugin(string $sClassName, string $sPluginName, int $nPriority = 1000) |
|
| 91 | - { |
|
| 92 | - // We need the library to have been bootstrapped. |
|
| 93 | - $this->getBootstrap()->onBoot(); |
|
| 94 | - $this->getPluginManager()->registerPlugin($sClassName, $sPluginName, $nPriority); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - /** |
|
| 90 | +public function registerPlugin(string $sClassName, string $sPluginName, int $nPriority = 1000) |
|
| 91 | +{ |
|
| 92 | +// We need the library to have been bootstrapped. |
|
| 93 | +$this->getBootstrap()->onBoot(); |
|
| 94 | +$this->getPluginManager()->registerPlugin($sClassName, $sPluginName, $nPriority); |
|
| 95 | +} |
|
| 96 | + |
|
| 97 | +/** |
|
| 98 | 98 | * Register a package |
| 99 | 99 | * |
| 100 | 100 | * @param string $sClassName The package class |
@@ -103,14 +103,14 @@ discard block |
||
| 103 | 103 | * @return void |
| 104 | 104 | * @throws SetupException |
| 105 | 105 | */ |
| 106 | - public function registerPackage(string $sClassName, array $xPkgOptions = []) |
|
| 107 | - { |
|
| 108 | - // We need the library to have been bootstrapped. |
|
| 109 | - $this->getBootstrap()->onBoot(); |
|
| 110 | - $this->getPackageManager()->registerPackage($sClassName, $xPkgOptions); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** |
|
| 106 | +public function registerPackage(string $sClassName, array $xPkgOptions = []) |
|
| 107 | +{ |
|
| 108 | +// We need the library to have been bootstrapped. |
|
| 109 | +$this->getBootstrap()->onBoot(); |
|
| 110 | +$this->getPackageManager()->registerPackage($sClassName, $xPkgOptions); |
|
| 111 | +} |
|
| 112 | + |
|
| 113 | +/** |
|
| 114 | 114 | * Find a response plugin by name or class name |
| 115 | 115 | * |
| 116 | 116 | * @template R of ResponsePluginInterface |
@@ -118,12 +118,12 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @return ($sName is class-string ? R : ResponsePluginInterface)|null |
| 120 | 120 | */ |
| 121 | - public function plugin(string $sName): ?ResponsePluginInterface |
|
| 122 | - { |
|
| 123 | - return $this->getPluginManager()->getResponsePlugin($sName); |
|
| 124 | - } |
|
| 121 | +public function plugin(string $sName): ?ResponsePluginInterface |
|
| 122 | +{ |
|
| 123 | +return $this->getPluginManager()->getResponsePlugin($sName); |
|
| 124 | +} |
|
| 125 | 125 | |
| 126 | - /** |
|
| 126 | +/** |
|
| 127 | 127 | * Get a package instance |
| 128 | 128 | * |
| 129 | 129 | * @template P of AbstractPackage |
@@ -131,52 +131,52 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return P|null |
| 133 | 133 | */ |
| 134 | - public function package(string $sClassName): ?AbstractPackage |
|
| 135 | - { |
|
| 136 | - return $this->getPackageManager()->getPackage($sClassName); |
|
| 137 | - } |
|
| 134 | +public function package(string $sClassName): ?AbstractPackage |
|
| 135 | +{ |
|
| 136 | +return $this->getPackageManager()->getPackage($sClassName); |
|
| 137 | +} |
|
| 138 | 138 | |
| 139 | - /** |
|
| 139 | +/** |
|
| 140 | 140 | * Get the HTML tags to include Jaxon javascript files into the page. |
| 141 | 141 | * |
| 142 | 142 | * @return string |
| 143 | 143 | */ |
| 144 | - public function getJs(): string |
|
| 145 | - { |
|
| 146 | - return $this->getCodeGenerator()->getJs(); |
|
| 147 | - } |
|
| 144 | +public function getJs(): string |
|
| 145 | +{ |
|
| 146 | +return $this->getCodeGenerator()->getJs(); |
|
| 147 | +} |
|
| 148 | 148 | |
| 149 | - /** |
|
| 149 | +/** |
|
| 150 | 150 | * Get the HTML tags to include Jaxon javascript files into the page. |
| 151 | 151 | * |
| 152 | 152 | * @return string the javascript code |
| 153 | 153 | */ |
| 154 | - public function js(): string |
|
| 155 | - { |
|
| 156 | - return $this->getCodeGenerator()->getJs(); |
|
| 157 | - } |
|
| 154 | +public function js(): string |
|
| 155 | +{ |
|
| 156 | +return $this->getCodeGenerator()->getJs(); |
|
| 157 | +} |
|
| 158 | 158 | |
| 159 | - /** |
|
| 159 | +/** |
|
| 160 | 160 | * Get the HTML tags to include Jaxon CSS code and files into the page. |
| 161 | 161 | * |
| 162 | 162 | * @return string |
| 163 | 163 | */ |
| 164 | - public function getCss(): string |
|
| 165 | - { |
|
| 166 | - return $this->getCodeGenerator()->getCss(); |
|
| 167 | - } |
|
| 164 | +public function getCss(): string |
|
| 165 | +{ |
|
| 166 | +return $this->getCodeGenerator()->getCss(); |
|
| 167 | +} |
|
| 168 | 168 | |
| 169 | - /** |
|
| 169 | +/** |
|
| 170 | 170 | * Get the HTML tags to include Jaxon CSS code and files into the page. |
| 171 | 171 | * |
| 172 | 172 | * @return string |
| 173 | 173 | */ |
| 174 | - public function css(): string |
|
| 175 | - { |
|
| 176 | - return $this->getCodeGenerator()->getCss(); |
|
| 177 | - } |
|
| 174 | +public function css(): string |
|
| 175 | +{ |
|
| 176 | +return $this->getCodeGenerator()->getCss(); |
|
| 177 | +} |
|
| 178 | 178 | |
| 179 | - /** |
|
| 179 | +/** |
|
| 180 | 180 | * Returns the js header and wrapper code to be printed into the page |
| 181 | 181 | * |
| 182 | 182 | * The javascript code returned by this function depends on the plugins |
@@ -188,12 +188,12 @@ discard block |
||
| 188 | 188 | * @return string |
| 189 | 189 | * @throws UriException |
| 190 | 190 | */ |
| 191 | - public function getScript(bool $bIncludeJs = false, bool $bIncludeCss = false): string |
|
| 192 | - { |
|
| 193 | - return $this->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss); |
|
| 194 | - } |
|
| 191 | +public function getScript(bool $bIncludeJs = false, bool $bIncludeCss = false): string |
|
| 192 | +{ |
|
| 193 | +return $this->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss); |
|
| 194 | +} |
|
| 195 | 195 | |
| 196 | - /** |
|
| 196 | +/** |
|
| 197 | 197 | * Returns the js header and wrapper code to be printed into the page |
| 198 | 198 | * |
| 199 | 199 | * @param bool $bIncludeJs Also get the js code |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | * @return string the javascript code |
| 203 | 203 | * @throws UriException |
| 204 | 204 | */ |
| 205 | - public function script(bool $bIncludeJs = false, bool $bIncludeCss = false): string |
|
| 206 | - { |
|
| 207 | - return $this->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss); |
|
| 208 | - } |
|
| 205 | +public function script(bool $bIncludeJs = false, bool $bIncludeCss = false): string |
|
| 206 | +{ |
|
| 207 | +return $this->getCodeGenerator()->getScript($bIncludeJs, $bIncludeCss); |
|
| 208 | +} |
|
| 209 | 209 | } |
@@ -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 | } |
@@ -33,111 +33,111 @@ |
||
| 33 | 33 | |
| 34 | 34 | final class Jaxon |
| 35 | 35 | { |
| 36 | - use Traits\ConfigTrait; |
|
| 37 | - use Traits\ServicesTrait; |
|
| 38 | - use Traits\PluginTrait; |
|
| 39 | - use Traits\RequestTrait; |
|
| 40 | - use Traits\ResponseTrait; |
|
| 41 | - use Traits\SendResponseTrait; |
|
| 42 | - |
|
| 43 | - /** |
|
| 36 | +use Traits\ConfigTrait; |
|
| 37 | +use Traits\ServicesTrait; |
|
| 38 | +use Traits\PluginTrait; |
|
| 39 | +use Traits\RequestTrait; |
|
| 40 | +use Traits\ResponseTrait; |
|
| 41 | +use Traits\SendResponseTrait; |
|
| 42 | + |
|
| 43 | +/** |
|
| 44 | 44 | * @var Jaxon |
| 45 | 45 | */ |
| 46 | - private static $xInstance = null; |
|
| 46 | +private static $xInstance = null; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * The constructor |
| 50 | 50 | * |
| 51 | 51 | * @param Container $xContainer |
| 52 | 52 | * @param ComponentContainer $xComponentContainer |
| 53 | 53 | */ |
| 54 | - private function __construct(Container $xContainer, ComponentContainer $xComponentContainer) |
|
| 55 | - { |
|
| 56 | - $this->xContainer = $xContainer; |
|
| 57 | - $this->xComponentContainer = $xComponentContainer; |
|
| 58 | - } |
|
| 54 | +private function __construct(Container $xContainer, ComponentContainer $xComponentContainer) |
|
| 55 | +{ |
|
| 56 | +$this->xContainer = $xContainer; |
|
| 57 | +$this->xComponentContainer = $xComponentContainer; |
|
| 58 | +} |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | +/** |
|
| 61 | 61 | * @return Jaxon |
| 62 | 62 | */ |
| 63 | - private static function createInstance(): Jaxon |
|
| 64 | - { |
|
| 65 | - $xContainer = new Container(); |
|
| 66 | - $xComponentContainer = new ComponentContainer($xContainer); |
|
| 67 | - self::$xInstance = new Jaxon($xContainer, $xComponentContainer); |
|
| 63 | +private static function createInstance(): Jaxon |
|
| 64 | +{ |
|
| 65 | +$xContainer = new Container(); |
|
| 66 | +$xComponentContainer = new ComponentContainer($xContainer); |
|
| 67 | +self::$xInstance = new Jaxon($xContainer, $xComponentContainer); |
|
| 68 | 68 | |
| 69 | - // Save the Jaxon and container instances |
|
| 70 | - $xContainer->val(Jaxon::class, self::$xInstance); |
|
| 71 | - $xContainer->val(ComponentContainer::class, $xComponentContainer); |
|
| 69 | +// Save the Jaxon and container instances |
|
| 70 | +$xContainer->val(Jaxon::class, self::$xInstance); |
|
| 71 | +$xContainer->val(ComponentContainer::class, $xComponentContainer); |
|
| 72 | 72 | |
| 73 | - // Make the helpers functions available in the global namespace. |
|
| 74 | - self::$xInstance->getCallbackManager()->boot(function() { |
|
| 75 | - self::$xInstance->config()->globals(); |
|
| 76 | - }); |
|
| 73 | +// Make the helpers functions available in the global namespace. |
|
| 74 | +self::$xInstance->getCallbackManager()->boot(function() { |
|
| 75 | +self::$xInstance->config()->globals(); |
|
| 76 | +}); |
|
| 77 | 77 | |
| 78 | - return self::$xInstance; |
|
| 79 | - } |
|
| 78 | +return self::$xInstance; |
|
| 79 | +} |
|
| 80 | 80 | |
| 81 | - /** |
|
| 81 | +/** |
|
| 82 | 82 | * @return Jaxon |
| 83 | 83 | */ |
| 84 | - public static function getInstance(): Jaxon |
|
| 85 | - { |
|
| 86 | - return self::$xInstance ?: self::$xInstance = self::createInstance(); |
|
| 87 | - } |
|
| 84 | +public static function getInstance(): Jaxon |
|
| 85 | +{ |
|
| 86 | +return self::$xInstance ?: self::$xInstance = self::createInstance(); |
|
| 87 | +} |
|
| 88 | 88 | |
| 89 | - /** |
|
| 89 | +/** |
|
| 90 | 90 | * @return string |
| 91 | 91 | */ |
| 92 | - public function getVersion(): string |
|
| 93 | - { |
|
| 94 | - return \Jaxon\Jaxon::VERSION; |
|
| 95 | - } |
|
| 92 | +public function getVersion(): string |
|
| 93 | +{ |
|
| 94 | +return \Jaxon\Jaxon::VERSION; |
|
| 95 | +} |
|
| 96 | 96 | |
| 97 | - /** |
|
| 97 | +/** |
|
| 98 | 98 | * @return ConfigManager |
| 99 | 99 | */ |
| 100 | - public function config(): ConfigManager |
|
| 101 | - { |
|
| 102 | - return $this->di()->g(ConfigManager::class); |
|
| 103 | - } |
|
| 100 | +public function config(): ConfigManager |
|
| 101 | +{ |
|
| 102 | +return $this->di()->g(ConfigManager::class); |
|
| 103 | +} |
|
| 104 | 104 | |
| 105 | - /** |
|
| 105 | +/** |
|
| 106 | 106 | * Set the ajax endpoint URI |
| 107 | 107 | * |
| 108 | 108 | * @param string $sUri The ajax endpoint URI |
| 109 | 109 | * |
| 110 | 110 | * @return void |
| 111 | 111 | */ |
| 112 | - public function setUri(string $sUri): void |
|
| 113 | - { |
|
| 114 | - $this->config()->setOption('core.request.uri', $sUri); |
|
| 115 | - } |
|
| 112 | +public function setUri(string $sUri): void |
|
| 113 | +{ |
|
| 114 | +$this->config()->setOption('core.request.uri', $sUri); |
|
| 115 | +} |
|
| 116 | 116 | |
| 117 | - /** |
|
| 117 | +/** |
|
| 118 | 118 | * @return AppInterface |
| 119 | 119 | */ |
| 120 | - public function app(): AppInterface |
|
| 121 | - { |
|
| 122 | - return $this->xContainer->getApp(); |
|
| 123 | - } |
|
| 120 | +public function app(): AppInterface |
|
| 121 | +{ |
|
| 122 | +return $this->xContainer->getApp(); |
|
| 123 | +} |
|
| 124 | 124 | |
| 125 | - /** |
|
| 125 | +/** |
|
| 126 | 126 | * Get the callback manager |
| 127 | 127 | * |
| 128 | 128 | * @return CallbackManager |
| 129 | 129 | */ |
| 130 | - public function callback(): CallbackManager |
|
| 131 | - { |
|
| 132 | - return $this->getCallbackManager(); |
|
| 133 | - } |
|
| 130 | +public function callback(): CallbackManager |
|
| 131 | +{ |
|
| 132 | +return $this->getCallbackManager(); |
|
| 133 | +} |
|
| 134 | 134 | |
| 135 | - /** |
|
| 135 | +/** |
|
| 136 | 136 | * @return void |
| 137 | 137 | * @throws SetupException |
| 138 | 138 | */ |
| 139 | - public function reset(): void |
|
| 140 | - { |
|
| 141 | - self::$xInstance = null; |
|
| 142 | - } |
|
| 139 | +public function reset(): void |
|
| 140 | +{ |
|
| 141 | +self::$xInstance = null; |
|
| 142 | +} |
|
| 143 | 143 | } |
@@ -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]; |