@@ -8,26 +8,26 @@ |
||
| 8 | 8 | |
| 9 | 9 | trait AjaxResponseTrait |
| 10 | 10 | { |
| 11 | - /** |
|
| 11 | +/** |
|
| 12 | 12 | * @var Response |
| 13 | 13 | */ |
| 14 | - protected $response; |
|
| 14 | +protected $response; |
|
| 15 | 15 | |
| 16 | - /** |
|
| 16 | +/** |
|
| 17 | 17 | * @param Container $di |
| 18 | 18 | * |
| 19 | 19 | * @return void |
| 20 | 20 | */ |
| 21 | - private function setAjaxResponse(Container $di): void |
|
| 22 | - { |
|
| 23 | - $this->response = $di->getResponse(); |
|
| 24 | - } |
|
| 21 | +private function setAjaxResponse(Container $di): void |
|
| 22 | +{ |
|
| 23 | +$this->response = $di->getResponse(); |
|
| 24 | +} |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * @return Response |
| 28 | 28 | */ |
| 29 | - final protected function response(): AjaxResponse |
|
| 30 | - { |
|
| 31 | - return $this->response; |
|
| 32 | - } |
|
| 29 | +final protected function response(): AjaxResponse |
|
| 30 | +{ |
|
| 31 | +return $this->response; |
|
| 32 | +} |
|
| 33 | 33 | } |
@@ -6,26 +6,26 @@ |
||
| 6 | 6 | |
| 7 | 7 | trait HelperTrait |
| 8 | 8 | { |
| 9 | - /** |
|
| 9 | +/** |
|
| 10 | 10 | * @var ComponentHelper |
| 11 | 11 | */ |
| 12 | - private $xHelper; |
|
| 12 | +private $xHelper; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * @param ComponentHelper $xHelper |
| 16 | 16 | * |
| 17 | 17 | * @return void |
| 18 | 18 | */ |
| 19 | - private function setHelper(ComponentHelper $xHelper): void |
|
| 20 | - { |
|
| 21 | - $this->xHelper = $xHelper; |
|
| 22 | - } |
|
| 19 | +private function setHelper(ComponentHelper $xHelper): void |
|
| 20 | +{ |
|
| 21 | +$this->xHelper = $xHelper; |
|
| 22 | +} |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @return ComponentHelper |
| 26 | 26 | */ |
| 27 | - protected function helper(): ComponentHelper |
|
| 28 | - { |
|
| 29 | - return $this->xHelper; |
|
| 30 | - } |
|
| 27 | +protected function helper(): ComponentHelper |
|
| 28 | +{ |
|
| 29 | +return $this->xHelper; |
|
| 30 | +} |
|
| 31 | 31 | } |
@@ -7,49 +7,49 @@ |
||
| 7 | 7 | |
| 8 | 8 | trait NodeResponseTrait |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * @var NodeResponse |
| 12 | 12 | */ |
| 13 | - protected $nodeResponse = null; |
|
| 13 | +protected $nodeResponse = null; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 15 | +/** |
|
| 16 | 16 | * @var string |
| 17 | 17 | */ |
| 18 | - protected $overrides = ''; |
|
| 18 | +protected $overrides = ''; |
|
| 19 | 19 | |
| 20 | - /** |
|
| 20 | +/** |
|
| 21 | 21 | * @param Container $di |
| 22 | 22 | * |
| 23 | 23 | * @return void |
| 24 | 24 | */ |
| 25 | - private function setNodeResponse(Container $di): void |
|
| 26 | - { |
|
| 27 | - // Each component must have its own reponse object. |
|
| 28 | - // A component can override another one. In this case, |
|
| 29 | - // its response is attached to the overriden component DOM node. |
|
| 30 | - $this->nodeResponse = $di->newNodeResponse($this->rq($this->overrides ?: '')); |
|
| 31 | - } |
|
| 25 | +private function setNodeResponse(Container $di): void |
|
| 26 | +{ |
|
| 27 | +// Each component must have its own reponse object. |
|
| 28 | +// A component can override another one. In this case, |
|
| 29 | +// its response is attached to the overriden component DOM node. |
|
| 30 | +$this->nodeResponse = $di->newNodeResponse($this->rq($this->overrides ?: '')); |
|
| 31 | +} |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * Get the component response |
| 35 | 35 | * |
| 36 | 36 | * @return NodeResponse |
| 37 | 37 | */ |
| 38 | - final protected function node(): NodeResponse |
|
| 39 | - { |
|
| 40 | - return $this->nodeResponse; |
|
| 41 | - } |
|
| 38 | +final protected function node(): NodeResponse |
|
| 39 | +{ |
|
| 40 | +return $this->nodeResponse; |
|
| 41 | +} |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * Set the component item. |
| 45 | 45 | * |
| 46 | 46 | * @param string $item |
| 47 | 47 | * |
| 48 | 48 | * @return self |
| 49 | 49 | */ |
| 50 | - final public function item(string $item): self |
|
| 51 | - { |
|
| 52 | - $this->node()->item($item); |
|
| 53 | - return $this; |
|
| 54 | - } |
|
| 50 | +final public function item(string $item): self |
|
| 51 | +{ |
|
| 52 | +$this->node()->item($item); |
|
| 53 | +return $this; |
|
| 54 | +} |
|
| 55 | 55 | } |
@@ -6,38 +6,38 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Stash |
| 8 | 8 | { |
| 9 | - /** |
|
| 9 | +/** |
|
| 10 | 10 | * @var array |
| 11 | 11 | */ |
| 12 | - private array $values = []; |
|
| 12 | +private array $values = []; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * @param string $key |
| 16 | 16 | * @param mixed $value |
| 17 | 17 | * |
| 18 | 18 | * @return void |
| 19 | 19 | */ |
| 20 | - public function set(string $key, mixed $value): void |
|
| 21 | - { |
|
| 22 | - $this->values[$key] = $value; |
|
| 23 | - } |
|
| 20 | +public function set(string $key, mixed $value): void |
|
| 21 | +{ |
|
| 22 | +$this->values[$key] = $value; |
|
| 23 | +} |
|
| 24 | 24 | |
| 25 | - /** |
|
| 25 | +/** |
|
| 26 | 26 | * @param string $key |
| 27 | 27 | * @param mixed $default |
| 28 | 28 | * |
| 29 | 29 | * @return mixed |
| 30 | 30 | */ |
| 31 | - public function get(string $key, mixed $default = null): mixed |
|
| 32 | - { |
|
| 33 | - $value = $this->values[$key] ?? $default; |
|
| 34 | - if(is_callable($value)) |
|
| 35 | - { |
|
| 36 | - $value = $value(); |
|
| 37 | - // Save the value returned by the callback in the stash. |
|
| 38 | - $this->values[$key] = $value; |
|
| 39 | - } |
|
| 31 | +public function get(string $key, mixed $default = null): mixed |
|
| 32 | +{ |
|
| 33 | +$value = $this->values[$key] ?? $default; |
|
| 34 | +if(is_callable($value)) |
|
| 35 | +{ |
|
| 36 | +$value = $value(); |
|
| 37 | +// Save the value returned by the callback in the stash. |
|
| 38 | +$this->values[$key] = $value; |
|
| 39 | +} |
|
| 40 | 40 | |
| 41 | - return $value; |
|
| 42 | - } |
|
| 41 | +return $value; |
|
| 42 | +} |
|
| 43 | 43 | } |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | |
| 17 | 17 | class AfterData extends HookData |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @inheritDoc |
| 21 | 21 | */ |
| 22 | - protected function getType(): string |
|
| 23 | - { |
|
| 24 | - return 'after'; |
|
| 25 | - } |
|
| 22 | +protected function getType(): string |
|
| 23 | +{ |
|
| 24 | +return 'after'; |
|
| 25 | +} |
|
| 26 | 26 | } |
@@ -16,11 +16,11 @@ |
||
| 16 | 16 | |
| 17 | 17 | class BeforeData extends HookData |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @inheritDoc |
| 21 | 21 | */ |
| 22 | - protected function getType(): string |
|
| 23 | - { |
|
| 24 | - return 'before'; |
|
| 25 | - } |
|
| 22 | +protected function getType(): string |
|
| 23 | +{ |
|
| 24 | +return 'before'; |
|
| 25 | +} |
|
| 26 | 26 | } |
@@ -30,16 +30,16 @@ |
||
| 30 | 30 | |
| 31 | 31 | abstract class AbstractRequestPlugin extends AbstractPlugin implements CallableRegistryInterface, RequestHandlerInterface |
| 32 | 32 | { |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * @var Target |
| 35 | 35 | */ |
| 36 | - protected $xTarget = null; |
|
| 36 | +protected $xTarget = null; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * @inheritDoc |
| 40 | 40 | */ |
| 41 | - public function getTarget(): ?Target |
|
| 42 | - { |
|
| 43 | - return $this->xTarget; |
|
| 44 | - } |
|
| 41 | +public function getTarget(): ?Target |
|
| 42 | +{ |
|
| 43 | +return $this->xTarget; |
|
| 44 | +} |
|
| 45 | 45 | } |
@@ -19,46 +19,46 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | abstract class AbstractPackage extends AbstractCodeGenerator |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * The configuration options of the package |
| 24 | 24 | * |
| 25 | 25 | * @var Config |
| 26 | 26 | */ |
| 27 | - protected $xPkgConfig; |
|
| 27 | +protected $xPkgConfig; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * The view renderer |
| 31 | 31 | * |
| 32 | 32 | * @var ViewRenderer |
| 33 | 33 | */ |
| 34 | - protected $xRenderer; |
|
| 34 | +protected $xRenderer; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * Get the path to the config file, or the config options in an array. |
| 38 | 38 | * |
| 39 | 39 | * @return string|array |
| 40 | 40 | */ |
| 41 | - abstract public static function config(): string|array; |
|
| 41 | +abstract public static function config(): string|array; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * Get the package config object |
| 45 | 45 | * |
| 46 | 46 | * @return Config |
| 47 | 47 | */ |
| 48 | - final public function getConfig(): Config |
|
| 49 | - { |
|
| 50 | - return $this->xPkgConfig; |
|
| 51 | - } |
|
| 48 | +final public function getConfig(): Config |
|
| 49 | +{ |
|
| 50 | +return $this->xPkgConfig; |
|
| 51 | +} |
|
| 52 | 52 | |
| 53 | - /** |
|
| 53 | +/** |
|
| 54 | 54 | * This method is automatically called after the package instance is created and configured. |
| 55 | 55 | * |
| 56 | 56 | * @return void |
| 57 | 57 | */ |
| 58 | - protected function init(): void |
|
| 59 | - {} |
|
| 58 | +protected function init(): void |
|
| 59 | +{} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * Get the value of a given package option |
| 63 | 63 | * |
| 64 | 64 | * @param string $sOption The option name |
@@ -66,49 +66,49 @@ discard block |
||
| 66 | 66 | * |
| 67 | 67 | * @return mixed |
| 68 | 68 | */ |
| 69 | - final public function getOption(string $sOption, $xDefault = null): mixed |
|
| 70 | - { |
|
| 71 | - return $this->xPkgConfig->getOption($sOption, $xDefault); |
|
| 72 | - } |
|
| 69 | +final public function getOption(string $sOption, $xDefault = null): mixed |
|
| 70 | +{ |
|
| 71 | +return $this->xPkgConfig->getOption($sOption, $xDefault); |
|
| 72 | +} |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | +/** |
|
| 75 | 75 | * Get the view renderer |
| 76 | 76 | * |
| 77 | 77 | * @return ViewRenderer |
| 78 | 78 | */ |
| 79 | - final public function view(): ViewRenderer |
|
| 80 | - { |
|
| 81 | - return $this->xRenderer; |
|
| 82 | - } |
|
| 79 | +final public function view(): ViewRenderer |
|
| 80 | +{ |
|
| 81 | +return $this->xRenderer; |
|
| 82 | +} |
|
| 83 | 83 | |
| 84 | - /** |
|
| 84 | +/** |
|
| 85 | 85 | * @inheritDoc |
| 86 | 86 | */ |
| 87 | - final public function getHash(): string |
|
| 88 | - { |
|
| 89 | - // Packages do not generate hash on their own. So we make this method final. |
|
| 90 | - return ''; |
|
| 91 | - } |
|
| 87 | +final public function getHash(): string |
|
| 88 | +{ |
|
| 89 | +// Packages do not generate hash on their own. So we make this method final. |
|
| 90 | +return ''; |
|
| 91 | +} |
|
| 92 | 92 | |
| 93 | - /** |
|
| 93 | +/** |
|
| 94 | 94 | * Get the HTML code of the package home page |
| 95 | 95 | * |
| 96 | 96 | * @return string|Stringable |
| 97 | 97 | */ |
| 98 | - public function getHtml(): string|Stringable |
|
| 99 | - { |
|
| 100 | - return ''; |
|
| 101 | - } |
|
| 98 | +public function getHtml(): string|Stringable |
|
| 99 | +{ |
|
| 100 | +return ''; |
|
| 101 | +} |
|
| 102 | 102 | |
| 103 | - /** |
|
| 103 | +/** |
|
| 104 | 104 | * Get the HTML code of the package home page |
| 105 | 105 | * |
| 106 | 106 | * This method is an alias for getHtml(). |
| 107 | 107 | * |
| 108 | 108 | * @return string|Stringable |
| 109 | 109 | */ |
| 110 | - public function html(): string|Stringable |
|
| 111 | - { |
|
| 112 | - return $this->getHtml(); |
|
| 113 | - } |
|
| 110 | +public function html(): string|Stringable |
|
| 111 | +{ |
|
| 112 | +return $this->getHtml(); |
|
| 113 | +} |
|
| 114 | 114 | } |
@@ -7,21 +7,21 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | interface RequestHandlerInterface |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * Get the target function or class and method |
| 12 | 12 | * |
| 13 | 13 | * @return Target|null |
| 14 | 14 | */ |
| 15 | - public function getTarget(): ?Target; |
|
| 15 | +public function getTarget(): ?Target; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * @param ServerRequestInterface $xRequest |
| 19 | 19 | * |
| 20 | 20 | * @return Target |
| 21 | 21 | */ |
| 22 | - public function setTarget(ServerRequestInterface $xRequest): Target; |
|
| 22 | +public function setTarget(ServerRequestInterface $xRequest): Target; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * Check if this plugin can process the current request |
| 26 | 26 | * |
| 27 | 27 | * Called by the <Jaxon\Plugin\RequestManager> when a request has been received to determine |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * |
| 32 | 32 | * @return bool |
| 33 | 33 | */ |
| 34 | - public static function canProcessRequest(ServerRequestInterface $xRequest): bool; |
|
| 34 | +public static function canProcessRequest(ServerRequestInterface $xRequest): bool; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * Process the current request |
| 38 | 38 | * |
| 39 | 39 | * Called by the <Jaxon\Plugin\RequestManager> when a request is being processed. |
@@ -42,5 +42,5 @@ discard block |
||
| 42 | 42 | * |
| 43 | 43 | * @return void |
| 44 | 44 | */ |
| 45 | - public function processRequest(): void; |
|
| 45 | +public function processRequest(): void; |
|
| 46 | 46 | } |