@@ -16,45 +16,45 @@ |
||
| 16 | 16 | |
| 17 | 17 | interface LibraryInterface |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * Get the library name |
| 21 | 21 | * |
| 22 | 22 | * @return string |
| 23 | 23 | */ |
| 24 | - public function getName(): string; |
|
| 24 | +public function getName(): string; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * Get the library base URI |
| 28 | 28 | * |
| 29 | 29 | * @return string |
| 30 | 30 | */ |
| 31 | - public function getUri(): string; |
|
| 31 | +public function getUri(): string; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * Get the CSS header code and file includes |
| 35 | 35 | * |
| 36 | 36 | * @return string |
| 37 | 37 | */ |
| 38 | - public function getCss(): string; |
|
| 38 | +public function getCss(): string; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * Get the javascript header code and file includes |
| 42 | 42 | * |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - public function getJs(): string; |
|
| 45 | +public function getJs(): string; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * Get the javascript code to be printed into the page |
| 49 | 49 | * |
| 50 | 50 | * @return string |
| 51 | 51 | */ |
| 52 | - public function getScript(): string; |
|
| 52 | +public function getScript(): string; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 54 | +/** |
|
| 55 | 55 | * Get the javascript codes to include into the page |
| 56 | 56 | * |
| 57 | 57 | * @return JsCode|null |
| 58 | 58 | */ |
| 59 | - public function getJsCode(): ?JsCode; |
|
| 59 | +public function getJsCode(): ?JsCode; |
|
| 60 | 60 | } |
@@ -6,24 +6,24 @@ |
||
| 6 | 6 | |
| 7 | 7 | trait DialogTrait |
| 8 | 8 | {
|
| 9 | - /** |
|
| 9 | +/** |
|
| 10 | 10 | * @return AjaxResponse |
| 11 | 11 | */ |
| 12 | - abstract protected function response(): AjaxResponse; |
|
| 12 | +abstract protected function response(): AjaxResponse; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * @return AlertInterface |
| 16 | 16 | */ |
| 17 | - protected function alert(): AlertInterface |
|
| 18 | - {
|
|
| 19 | - return $this->response()->dialog; |
|
| 20 | - } |
|
| 17 | +protected function alert(): AlertInterface |
|
| 18 | +{
|
|
| 19 | +return $this->response()->dialog; |
|
| 20 | +} |
|
| 21 | 21 | |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @return ModalInterface |
| 24 | 24 | */ |
| 25 | - protected function modal(): ModalInterface |
|
| 26 | - {
|
|
| 27 | - return $this->response()->dialog; |
|
| 28 | - } |
|
| 25 | +protected function modal(): ModalInterface |
|
| 26 | +{
|
|
| 27 | +return $this->response()->dialog; |
|
| 28 | +} |
|
| 29 | 29 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | interface ModalInterface |
| 18 | 18 | {
|
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * Show a modal dialog. |
| 21 | 21 | * |
| 22 | 22 | * @param string $sTitle The title of the dialog |
@@ -26,12 +26,12 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | - public function show(string $sTitle, string $sContent, array $aButtons = [], array $aOptions = []): void; |
|
| 29 | +public function show(string $sTitle, string $sContent, array $aButtons = [], array $aOptions = []): void; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * Hide the modal dialog. |
| 33 | 33 | * |
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | - public function hide(): void; |
|
| 36 | +public function hide(): void; |
|
| 37 | 37 | } |
@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | interface AlertInterface |
| 18 | 18 | {
|
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * Set the title of the next message. |
| 21 | 21 | * |
| 22 | 22 | * @param string $sTitle The title of the message |
| 23 | 23 | * |
| 24 | 24 | * @return AlertInterface |
| 25 | 25 | */ |
| 26 | - public function title(string $sTitle): AlertInterface; |
|
| 26 | +public function title(string $sTitle): AlertInterface; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 28 | +/** |
|
| 29 | 29 | * Show a success message. |
| 30 | 30 | * |
| 31 | 31 | * @param string $sMessage The text of the message |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | * |
| 34 | 34 | * @return void |
| 35 | 35 | */ |
| 36 | - public function success(string $sMessage, ...$aArgs): void; |
|
| 36 | +public function success(string $sMessage, ...$aArgs): void; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * Show an information message. |
| 40 | 40 | * |
| 41 | 41 | * @param string $sMessage The text of the message |
@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | * |
| 44 | 44 | * @return void |
| 45 | 45 | */ |
| 46 | - public function info(string $sMessage, ...$aArgs): void; |
|
| 46 | +public function info(string $sMessage, ...$aArgs): void; |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * Show a warning message. |
| 50 | 50 | * |
| 51 | 51 | * @param string $sMessage The text of the message |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return void |
| 55 | 55 | */ |
| 56 | - public function warning(string $sMessage, ...$aArgs): void; |
|
| 56 | +public function warning(string $sMessage, ...$aArgs): void; |
|
| 57 | 57 | |
| 58 | - /** |
|
| 58 | +/** |
|
| 59 | 59 | * Show an error message. |
| 60 | 60 | * |
| 61 | 61 | * @param string $sMessage The text of the message |
@@ -63,5 +63,5 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @return void |
| 65 | 65 | */ |
| 66 | - public function error(string $sMessage, ...$aArgs): void; |
|
| 66 | +public function error(string $sMessage, ...$aArgs): void; |
|
| 67 | 67 | } |
@@ -8,19 +8,19 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class Pagination extends AbstractComponent |
| 10 | 10 | { |
| 11 | - use HelperTrait; |
|
| 12 | - use NodeResponseTrait; |
|
| 11 | +use HelperTrait; |
|
| 12 | +use NodeResponseTrait; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * @inheritDoc |
| 16 | 16 | */ |
| 17 | - protected function initComponent(Container $di, ComponentHelper $xHelper): void |
|
| 18 | - { |
|
| 19 | - $this->setHelper($xHelper); |
|
| 20 | - $this->setNodeResponse($di); |
|
| 21 | - } |
|
| 17 | +protected function initComponent(Container $di, ComponentHelper $xHelper): void |
|
| 18 | +{ |
|
| 19 | +$this->setHelper($xHelper); |
|
| 20 | +$this->setNodeResponse($di); |
|
| 21 | +} |
|
| 22 | 22 | |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * Create a paginator. |
| 25 | 25 | * |
| 26 | 26 | * @param int $nPageNumber The current page number |
@@ -29,8 +29,8 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return Paginator |
| 31 | 31 | */ |
| 32 | - final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator |
|
| 33 | - { |
|
| 34 | - return $this->nodeResponse->paginator($nPageNumber, $nItemsPerPage, $nTotalItems); |
|
| 35 | - } |
|
| 32 | +final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator |
|
| 33 | +{ |
|
| 34 | +return $this->nodeResponse->paginator($nPageNumber, $nItemsPerPage, $nTotalItems); |
|
| 35 | +} |
|
| 36 | 36 | } |
@@ -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 | } |