@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | abstract class AbstractComponent |
| 10 | 10 | { |
| 11 | - /** |
|
| 11 | +/** |
|
| 12 | 12 | * Get the component helper |
| 13 | 13 | * |
| 14 | 14 | * @return ComponentHelper |
| 15 | 15 | */ |
| 16 | - abstract protected function helper(): ComponentHelper; |
|
| 16 | +abstract protected function helper(): ComponentHelper; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 18 | +/** |
|
| 19 | 19 | * Initialize the component |
| 20 | 20 | * |
| 21 | 21 | * @param Container $di |
@@ -23,17 +23,17 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * @return void |
| 25 | 25 | */ |
| 26 | - abstract protected function initComponent(Container $di, ComponentHelper $xHelper); |
|
| 26 | +abstract protected function initComponent(Container $di, ComponentHelper $xHelper); |
|
| 27 | 27 | |
| 28 | - /** |
|
| 28 | +/** |
|
| 29 | 29 | * Get the js call factory. |
| 30 | 30 | * |
| 31 | 31 | * @param string $sClassName |
| 32 | 32 | * |
| 33 | 33 | * @return JxnCall |
| 34 | 34 | */ |
| 35 | - protected function rq(string $sClassName = ''): JxnCall |
|
| 36 | - { |
|
| 37 | - return $this->helper()->rq($sClassName); |
|
| 38 | - } |
|
| 35 | +protected function rq(string $sClassName = ''): JxnCall |
|
| 36 | +{ |
|
| 37 | +return $this->helper()->rq($sClassName); |
|
| 38 | +} |
|
| 39 | 39 | } |
@@ -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 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | protected function validateName(string $sName): void |
| 52 | 52 | { |
| 53 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 53 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 54 | 54 | { |
| 55 | 55 | return; |
| 56 | 56 | } |
@@ -22,61 +22,61 @@ |
||
| 22 | 22 | |
| 23 | 23 | class DatabagData extends AbstractData |
| 24 | 24 | { |
| 25 | - /** |
|
| 25 | +/** |
|
| 26 | 26 | * The databag names |
| 27 | 27 | * |
| 28 | 28 | * @var string |
| 29 | 29 | */ |
| 30 | - protected $aNames = []; |
|
| 30 | +protected $aNames = []; |
|
| 31 | 31 | |
| 32 | - /** |
|
| 32 | +/** |
|
| 33 | 33 | * @return string |
| 34 | 34 | */ |
| 35 | - public function getName(): string |
|
| 36 | - { |
|
| 37 | - return 'bags'; |
|
| 38 | - } |
|
| 35 | +public function getName(): string |
|
| 36 | +{ |
|
| 37 | +return 'bags'; |
|
| 38 | +} |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * @return mixed |
| 42 | 42 | */ |
| 43 | - public function getValue(): mixed |
|
| 44 | - { |
|
| 45 | - return array_values($this->aNames); |
|
| 46 | - } |
|
| 43 | +public function getValue(): mixed |
|
| 44 | +{ |
|
| 45 | +return array_values($this->aNames); |
|
| 46 | +} |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * @param string $sName |
| 50 | 50 | * |
| 51 | 51 | * @return void |
| 52 | 52 | */ |
| 53 | - protected function validateName(string $sName): void |
|
| 54 | - { |
|
| 55 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 56 | - { |
|
| 57 | - return; |
|
| 58 | - } |
|
| 59 | - throw new SetupException("$sName is not a valid \"name\" value for databag"); |
|
| 60 | - } |
|
| 53 | +protected function validateName(string $sName): void |
|
| 54 | +{ |
|
| 55 | +if(preg_match('/^[a-zA-Z][a-zA-Z0-9_\-\.]*$/', $sName) > 0) |
|
| 56 | +{ |
|
| 57 | +return; |
|
| 58 | +} |
|
| 59 | +throw new SetupException("$sName is not a valid \"name\" value for databag"); |
|
| 60 | +} |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * @param string $sName |
| 64 | 64 | * |
| 65 | 65 | * @return void |
| 66 | 66 | */ |
| 67 | - public function addValue(string $sName): void |
|
| 68 | - { |
|
| 69 | - $this->validateName($sName); |
|
| 67 | +public function addValue(string $sName): void |
|
| 68 | +{ |
|
| 69 | +$this->validateName($sName); |
|
| 70 | 70 | |
| 71 | - $this->aNames[$sName] = $sName; |
|
| 72 | - } |
|
| 71 | +$this->aNames[$sName] = $sName; |
|
| 72 | +} |
|
| 73 | 73 | |
| 74 | - /** |
|
| 74 | +/** |
|
| 75 | 75 | * @inheritDoc |
| 76 | 76 | */ |
| 77 | - public function encode(string $sVarName): array |
|
| 78 | - { |
|
| 79 | - return array_map(fn($sName) => |
|
| 80 | - "{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 81 | - } |
|
| 77 | +public function encode(string $sVarName): array |
|
| 78 | +{ |
|
| 79 | +return array_map(fn($sName) => |
|
| 80 | +"{$sVarName}->addValue('$sName');", $this->aNames); |
|
| 81 | +} |
|
| 82 | 82 | } |
@@ -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 | } |