@@ -27,64 +27,64 @@ |
||
| 27 | 27 | |
| 28 | 28 | abstract class HookAnnotation extends AbstractAnnotation |
| 29 | 29 | { |
| 30 | - /** |
|
| 30 | +/** |
|
| 31 | 31 | * @var string |
| 32 | 32 | */ |
| 33 | - protected $sMethod = ''; |
|
| 33 | +protected $sMethod = ''; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 35 | +/** |
|
| 36 | 36 | * @var array |
| 37 | 37 | */ |
| 38 | - protected $aParams = []; |
|
| 38 | +protected $aParams = []; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * |
| 42 | 42 | */ |
| 43 | - abstract protected static function getType(): string; |
|
| 43 | +abstract protected static function getType(): string; |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | +/** |
|
| 46 | 46 | * @inheritDoc |
| 47 | 47 | */ |
| 48 | - public static function parseAnnotation($value) |
|
| 49 | - { |
|
| 50 | - $aParams = preg_split('/[\s]+/', $value, 2); |
|
| 51 | - if(count($aParams) === 1) |
|
| 52 | - { |
|
| 53 | - return ['call' => rtrim($aParams[0])]; |
|
| 54 | - } |
|
| 55 | - // The second parameter must be an array of callback parameter in json format. |
|
| 56 | - return ['call' => rtrim($aParams[0]), 'with' => json_decode($aParams[1], false)]; |
|
| 57 | - } |
|
| 48 | +public static function parseAnnotation($value) |
|
| 49 | +{ |
|
| 50 | +$aParams = preg_split('/[\s]+/', $value, 2); |
|
| 51 | +if(count($aParams) === 1) |
|
| 52 | +{ |
|
| 53 | +return ['call' => rtrim($aParams[0])]; |
|
| 54 | +} |
|
| 55 | +// The second parameter must be an array of callback parameter in json format. |
|
| 56 | +return ['call' => rtrim($aParams[0]), 'with' => json_decode($aParams[1], false)]; |
|
| 57 | +} |
|
| 58 | 58 | |
| 59 | - /** |
|
| 59 | +/** |
|
| 60 | 60 | * @inheritDoc |
| 61 | 61 | * @throws AnnotationException |
| 62 | 62 | */ |
| 63 | - public function initAnnotation(array $properties) |
|
| 64 | - { |
|
| 65 | - if(!isset($properties['call']) || !is_string($properties['call'])) |
|
| 66 | - { |
|
| 67 | - throw new AnnotationException('The @' . $this->getType() . |
|
| 68 | - ' annotation requires a property "call" of type string'); |
|
| 69 | - } |
|
| 70 | - foreach(array_keys($properties) as $propName) |
|
| 71 | - { |
|
| 72 | - if($propName !== 'call' && $propName !== 'with') |
|
| 73 | - { |
|
| 74 | - throw new AnnotationException('Unknown property "' . $propName . |
|
| 75 | - '" in the @' . $this->getType() . ' annotation'); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - // Cannot use isset here, because it will return false in case $properties['with'] === null |
|
| 79 | - if(array_key_exists('with', $properties)) |
|
| 80 | - { |
|
| 81 | - if(!is_array($properties['with'])) |
|
| 82 | - { |
|
| 83 | - throw new AnnotationException('The "with" property of the @' . |
|
| 84 | - $this->getType() . ' annotation must be of type array'); |
|
| 85 | - } |
|
| 86 | - $this->aParams = $properties['with']; |
|
| 87 | - } |
|
| 88 | - $this->sMethod = $properties['call']; |
|
| 89 | - } |
|
| 63 | +public function initAnnotation(array $properties) |
|
| 64 | +{ |
|
| 65 | +if(!isset($properties['call']) || !is_string($properties['call'])) |
|
| 66 | +{ |
|
| 67 | +throw new AnnotationException('The @' . $this->getType() . |
|
| 68 | + ' annotation requires a property "call" of type string'); |
|
| 69 | +} |
|
| 70 | +foreach(array_keys($properties) as $propName) |
|
| 71 | +{ |
|
| 72 | +if($propName !== 'call' && $propName !== 'with') |
|
| 73 | +{ |
|
| 74 | + throw new AnnotationException('Unknown property "' . $propName . |
|
| 75 | + '" in the @' . $this->getType() . ' annotation'); |
|
| 76 | +} |
|
| 77 | +} |
|
| 78 | +// Cannot use isset here, because it will return false in case $properties['with'] === null |
|
| 79 | +if(array_key_exists('with', $properties)) |
|
| 80 | +{ |
|
| 81 | +if(!is_array($properties['with'])) |
|
| 82 | +{ |
|
| 83 | + throw new AnnotationException('The "with" property of the @' . |
|
| 84 | + $this->getType() . ' annotation must be of type array'); |
|
| 85 | +} |
|
| 86 | +$this->aParams = $properties['with']; |
|
| 87 | +} |
|
| 88 | +$this->sMethod = $properties['call']; |
|
| 89 | +} |
|
| 90 | 90 | } |
@@ -7,28 +7,28 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | trait ViewTrait |
| 9 | 9 | { |
| 10 | - /** |
|
| 10 | +/** |
|
| 11 | 11 | * The template directories |
| 12 | 12 | * |
| 13 | 13 | * @var array |
| 14 | 14 | */ |
| 15 | - protected $aDirectories = []; |
|
| 15 | +protected $aDirectories = []; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * The directory of the current template |
| 19 | 19 | * |
| 20 | 20 | * @var string |
| 21 | 21 | */ |
| 22 | - protected $sDirectory = ''; |
|
| 22 | +protected $sDirectory = ''; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * The extension of the current template |
| 26 | 26 | * |
| 27 | 27 | * @var string |
| 28 | 28 | */ |
| 29 | - protected $sExtension = ''; |
|
| 29 | +protected $sExtension = ''; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * Add a namespace to the view renderer |
| 33 | 33 | * |
| 34 | 34 | * @param string $sNamespace The namespace name |
@@ -37,28 +37,28 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | - public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): void |
|
| 41 | - { |
|
| 42 | - $this->aDirectories[$sNamespace] = ['path' => $sDirectory, 'ext' => $sExtension]; |
|
| 43 | - } |
|
| 40 | +public function addNamespace(string $sNamespace, string $sDirectory, string $sExtension = ''): void |
|
| 41 | +{ |
|
| 42 | +$this->aDirectories[$sNamespace] = ['path' => $sDirectory, 'ext' => $sExtension]; |
|
| 43 | +} |
|
| 44 | 44 | |
| 45 | - /** |
|
| 45 | +/** |
|
| 46 | 46 | * Set the namespace of the template being rendered |
| 47 | 47 | * |
| 48 | 48 | * @param string $sNamespace The namespace name |
| 49 | 49 | * |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function setCurrentNamespace(string $sNamespace): void |
|
| 53 | - { |
|
| 54 | - $this->sDirectory = ''; |
|
| 55 | - $this->sExtension = ''; |
|
| 56 | - if(isset($this->aDirectories[$sNamespace])) |
|
| 57 | - { |
|
| 58 | - // Make sure there's only one '/' at the end of the string |
|
| 59 | - $this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/'; |
|
| 60 | - // Make sure there's only one '.' at the beginning of the string |
|
| 61 | - $this->sExtension = '.' . ltrim($this->aDirectories[$sNamespace]['ext'], '.'); |
|
| 62 | - } |
|
| 63 | - } |
|
| 52 | +public function setCurrentNamespace(string $sNamespace): void |
|
| 53 | +{ |
|
| 54 | +$this->sDirectory = ''; |
|
| 55 | +$this->sExtension = ''; |
|
| 56 | +if(isset($this->aDirectories[$sNamespace])) |
|
| 57 | +{ |
|
| 58 | +// Make sure there's only one '/' at the end of the string |
|
| 59 | +$this->sDirectory = rtrim($this->aDirectories[$sNamespace]['path'], '/') . '/'; |
|
| 60 | +// Make sure there's only one '.' at the beginning of the string |
|
| 61 | +$this->sExtension = '.' . ltrim($this->aDirectories[$sNamespace]['ext'], '.'); |
|
| 62 | +} |
|
| 63 | +} |
|
| 64 | 64 | } |
@@ -19,24 +19,24 @@ |
||
| 19 | 19 | |
| 20 | 20 | interface LibraryRegistryInterface |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * Get the AlertInterface library |
| 24 | 24 | * |
| 25 | 25 | * @return AlertInterface |
| 26 | 26 | */ |
| 27 | - public function getAlertLibrary(): AlertInterface; |
|
| 27 | +public function getAlertLibrary(): AlertInterface; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * Get the ConfirmInterface library |
| 31 | 31 | * |
| 32 | 32 | * @return ConfirmInterface |
| 33 | 33 | */ |
| 34 | - public function getConfirmLibrary(): ConfirmInterface; |
|
| 34 | +public function getConfirmLibrary(): ConfirmInterface; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * Get the ModalInterface library |
| 38 | 38 | * |
| 39 | 39 | * @return ModalInterface|null |
| 40 | 40 | */ |
| 41 | - public function getModalLibrary(): ?ModalInterface; |
|
| 41 | +public function getModalLibrary(): ?ModalInterface; |
|
| 42 | 42 | } |
@@ -19,89 +19,89 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | class DialogCommand |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * The next alert library |
| 24 | 24 | * |
| 25 | 25 | * @var string |
| 26 | 26 | */ |
| 27 | - private $sLibrary = ''; |
|
| 27 | +private $sLibrary = ''; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * The next alert title |
| 31 | 31 | * |
| 32 | 32 | * @var string |
| 33 | 33 | */ |
| 34 | - private $sTitle = ''; |
|
| 34 | +private $sTitle = ''; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 36 | +/** |
|
| 37 | 37 | * The constructor |
| 38 | 38 | * |
| 39 | 39 | * @param LibraryRegistryInterface|null $xRegistry |
| 40 | 40 | */ |
| 41 | - public function __construct(private ?LibraryRegistryInterface $xRegistry) |
|
| 42 | - {} |
|
| 41 | +public function __construct(private ?LibraryRegistryInterface $xRegistry) |
|
| 42 | +{} |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | +/** |
|
| 45 | 45 | * Set the library for the next alert. |
| 46 | 46 | * |
| 47 | 47 | * @param string $sLibrary The name of the library |
| 48 | 48 | * |
| 49 | 49 | * @return void |
| 50 | 50 | */ |
| 51 | - public function library(string $sLibrary): void |
|
| 52 | - { |
|
| 53 | - $this->sLibrary = $sLibrary; |
|
| 54 | - } |
|
| 51 | +public function library(string $sLibrary): void |
|
| 52 | +{ |
|
| 53 | +$this->sLibrary = $sLibrary; |
|
| 54 | +} |
|
| 55 | 55 | |
| 56 | - /** |
|
| 56 | +/** |
|
| 57 | 57 | * Set the title of the next alert. |
| 58 | 58 | * |
| 59 | 59 | * @param string $sTitle The title of the alert |
| 60 | 60 | * |
| 61 | 61 | * @return void |
| 62 | 62 | */ |
| 63 | - public function title(string $sTitle): void |
|
| 64 | - { |
|
| 65 | - $this->sTitle = $sTitle; |
|
| 66 | - } |
|
| 63 | +public function title(string $sTitle): void |
|
| 64 | +{ |
|
| 65 | +$this->sTitle = $sTitle; |
|
| 66 | +} |
|
| 67 | 67 | |
| 68 | - /** |
|
| 68 | +/** |
|
| 69 | 69 | * @param string $sStr |
| 70 | 70 | * @param array $aArgs |
| 71 | 71 | * |
| 72 | 72 | * @return array |
| 73 | 73 | */ |
| 74 | - private function phrase(string $sStr, array $aArgs = []): array |
|
| 75 | - { |
|
| 76 | - return [ |
|
| 77 | - 'str' => $sStr, |
|
| 78 | - 'args' => array_map(function($xArg) { |
|
| 79 | - return TypedValue::make($xArg); |
|
| 80 | - }, $aArgs), |
|
| 81 | - ]; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - /** |
|
| 74 | +private function phrase(string $sStr, array $aArgs = []): array |
|
| 75 | +{ |
|
| 76 | +return [ |
|
| 77 | +'str' => $sStr, |
|
| 78 | +'args' => array_map(function($xArg) { |
|
| 79 | + return TypedValue::make($xArg); |
|
| 80 | +}, $aArgs), |
|
| 81 | +]; |
|
| 82 | +} |
|
| 83 | + |
|
| 84 | +/** |
|
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | - private function getLibrary(): string |
|
| 88 | - { |
|
| 89 | - $sLibrary = $this->sLibrary; |
|
| 90 | - $this->sLibrary = ''; |
|
| 91 | - return $sLibrary; |
|
| 92 | - } |
|
| 87 | +private function getLibrary(): string |
|
| 88 | +{ |
|
| 89 | +$sLibrary = $this->sLibrary; |
|
| 90 | +$this->sLibrary = ''; |
|
| 91 | +return $sLibrary; |
|
| 92 | +} |
|
| 93 | 93 | |
| 94 | - /** |
|
| 94 | +/** |
|
| 95 | 95 | * @return string |
| 96 | 96 | */ |
| 97 | - private function getTitle(): string |
|
| 98 | - { |
|
| 99 | - $sTitle = $this->sTitle; |
|
| 100 | - $this->sTitle = ''; |
|
| 101 | - return $sTitle; |
|
| 102 | - } |
|
| 97 | +private function getTitle(): string |
|
| 98 | +{ |
|
| 99 | +$sTitle = $this->sTitle; |
|
| 100 | +$this->sTitle = ''; |
|
| 101 | +return $sTitle; |
|
| 102 | +} |
|
| 103 | 103 | |
| 104 | - /** |
|
| 104 | +/** |
|
| 105 | 105 | * Print an alert message. |
| 106 | 106 | * |
| 107 | 107 | * @param string $sType The type of the message |
@@ -110,20 +110,20 @@ discard block |
||
| 110 | 110 | * |
| 111 | 111 | * @return array |
| 112 | 112 | */ |
| 113 | - private function alert(string $sType, string $sMessage, array $aArgs): array |
|
| 114 | - { |
|
| 115 | - return [ |
|
| 116 | - 'lib' => $this->getLibrary() ?: |
|
| 117 | - ($this->xRegistry?->getAlertLibrary()->getName() ?? ''), |
|
| 118 | - 'message' => [ |
|
| 119 | - 'type' => $sType, |
|
| 120 | - 'title' => $this->getTitle(), |
|
| 121 | - 'phrase' => $this->phrase($sMessage, $aArgs), |
|
| 122 | - ], |
|
| 123 | - ]; |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - /** |
|
| 113 | +private function alert(string $sType, string $sMessage, array $aArgs): array |
|
| 114 | +{ |
|
| 115 | +return [ |
|
| 116 | +'lib' => $this->getLibrary() ?: |
|
| 117 | + ($this->xRegistry?->getAlertLibrary()->getName() ?? ''), |
|
| 118 | +'message' => [ |
|
| 119 | + 'type' => $sType, |
|
| 120 | + 'title' => $this->getTitle(), |
|
| 121 | + 'phrase' => $this->phrase($sMessage, $aArgs), |
|
| 122 | +], |
|
| 123 | +]; |
|
| 124 | +} |
|
| 125 | + |
|
| 126 | +/** |
|
| 127 | 127 | * Show a success message. |
| 128 | 128 | * |
| 129 | 129 | * @param string $sMessage The text of the message |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | * |
| 132 | 132 | * @return array |
| 133 | 133 | */ |
| 134 | - public function success(string $sMessage, array $aArgs = []): array |
|
| 135 | - { |
|
| 136 | - return $this->alert('success', $sMessage, $aArgs); |
|
| 137 | - } |
|
| 134 | +public function success(string $sMessage, array $aArgs = []): array |
|
| 135 | +{ |
|
| 136 | +return $this->alert('success', $sMessage, $aArgs); |
|
| 137 | +} |
|
| 138 | 138 | |
| 139 | - /** |
|
| 139 | +/** |
|
| 140 | 140 | * Show an information message. |
| 141 | 141 | * |
| 142 | 142 | * @param string $sMessage The text of the message |
@@ -144,12 +144,12 @@ discard block |
||
| 144 | 144 | * |
| 145 | 145 | * @return array |
| 146 | 146 | */ |
| 147 | - public function info(string $sMessage, array $aArgs = []): array |
|
| 148 | - { |
|
| 149 | - return $this->alert('info', $sMessage, $aArgs); |
|
| 150 | - } |
|
| 147 | +public function info(string $sMessage, array $aArgs = []): array |
|
| 148 | +{ |
|
| 149 | +return $this->alert('info', $sMessage, $aArgs); |
|
| 150 | +} |
|
| 151 | 151 | |
| 152 | - /** |
|
| 152 | +/** |
|
| 153 | 153 | * Show a warning message. |
| 154 | 154 | * |
| 155 | 155 | * @param string $sMessage The text of the message |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | * |
| 158 | 158 | * @return array |
| 159 | 159 | */ |
| 160 | - public function warning(string $sMessage, array $aArgs = []): array |
|
| 161 | - { |
|
| 162 | - return $this->alert('warning', $sMessage, $aArgs); |
|
| 163 | - } |
|
| 160 | +public function warning(string $sMessage, array $aArgs = []): array |
|
| 161 | +{ |
|
| 162 | +return $this->alert('warning', $sMessage, $aArgs); |
|
| 163 | +} |
|
| 164 | 164 | |
| 165 | - /** |
|
| 165 | +/** |
|
| 166 | 166 | * Show an error message. |
| 167 | 167 | * |
| 168 | 168 | * @param string $sMessage The text of the message |
@@ -170,12 +170,12 @@ discard block |
||
| 170 | 170 | * |
| 171 | 171 | * @return array |
| 172 | 172 | */ |
| 173 | - public function error(string $sMessage, array $aArgs = []): array |
|
| 174 | - { |
|
| 175 | - return $this->alert('error', $sMessage, $aArgs); |
|
| 176 | - } |
|
| 173 | +public function error(string $sMessage, array $aArgs = []): array |
|
| 174 | +{ |
|
| 175 | +return $this->alert('error', $sMessage, $aArgs); |
|
| 176 | +} |
|
| 177 | 177 | |
| 178 | - /** |
|
| 178 | +/** |
|
| 179 | 179 | * Show a modal dialog. |
| 180 | 180 | * |
| 181 | 181 | * @param string $sTitle The title of the dialog |
@@ -194,34 +194,34 @@ discard block |
||
| 194 | 194 | * |
| 195 | 195 | * @return array |
| 196 | 196 | */ |
| 197 | - public function show(string $sTitle, string $sContent, array $aButtons, array $aOptions = []): array |
|
| 198 | - { |
|
| 199 | - return [ |
|
| 200 | - 'lib' => $this->getLibrary() ?: |
|
| 201 | - ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 202 | - 'dialog' => [ |
|
| 203 | - 'title' => $sTitle, |
|
| 204 | - 'content' => $sContent, |
|
| 205 | - 'buttons' => $aButtons, |
|
| 206 | - 'options' => $aOptions, |
|
| 207 | - ], |
|
| 208 | - ]; |
|
| 209 | - } |
|
| 210 | - |
|
| 211 | - /** |
|
| 197 | +public function show(string $sTitle, string $sContent, array $aButtons, array $aOptions = []): array |
|
| 198 | +{ |
|
| 199 | +return [ |
|
| 200 | +'lib' => $this->getLibrary() ?: |
|
| 201 | + ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 202 | +'dialog' => [ |
|
| 203 | + 'title' => $sTitle, |
|
| 204 | + 'content' => $sContent, |
|
| 205 | + 'buttons' => $aButtons, |
|
| 206 | + 'options' => $aOptions, |
|
| 207 | +], |
|
| 208 | +]; |
|
| 209 | +} |
|
| 210 | + |
|
| 211 | +/** |
|
| 212 | 212 | * Hide the modal dialog. |
| 213 | 213 | * |
| 214 | 214 | * @return array |
| 215 | 215 | */ |
| 216 | - public function hide(): array |
|
| 217 | - { |
|
| 218 | - return [ |
|
| 219 | - 'lib' => $this->getLibrary() ?: |
|
| 220 | - ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 221 | - ]; |
|
| 222 | - } |
|
| 216 | +public function hide(): array |
|
| 217 | +{ |
|
| 218 | +return [ |
|
| 219 | +'lib' => $this->getLibrary() ?: |
|
| 220 | + ($this->xRegistry?->getModalLibrary()->getName() ?? ''), |
|
| 221 | +]; |
|
| 222 | +} |
|
| 223 | 223 | |
| 224 | - /** |
|
| 224 | +/** |
|
| 225 | 225 | * Add a confirm question to a function call. |
| 226 | 226 | * |
| 227 | 227 | * @param string $sQuestion |
@@ -229,15 +229,15 @@ discard block |
||
| 229 | 229 | * |
| 230 | 230 | * @return array |
| 231 | 231 | */ |
| 232 | - public function confirm(string $sQuestion, array $aArgs = []): array |
|
| 233 | - { |
|
| 234 | - return [ |
|
| 235 | - 'lib' => $this->getLibrary() ?: |
|
| 236 | - ($this->xRegistry?->getConfirmLibrary()->getName() ?? ''), |
|
| 237 | - 'question' => [ |
|
| 238 | - 'title' => $this->getTitle(), |
|
| 239 | - 'phrase' => $this->phrase($sQuestion, $aArgs), |
|
| 240 | - ], |
|
| 241 | - ]; |
|
| 242 | - } |
|
| 232 | +public function confirm(string $sQuestion, array $aArgs = []): array |
|
| 233 | +{ |
|
| 234 | +return [ |
|
| 235 | +'lib' => $this->getLibrary() ?: |
|
| 236 | + ($this->xRegistry?->getConfirmLibrary()->getName() ?? ''), |
|
| 237 | +'question' => [ |
|
| 238 | + 'title' => $this->getTitle(), |
|
| 239 | + 'phrase' => $this->phrase($sQuestion, $aArgs), |
|
| 240 | +], |
|
| 241 | +]; |
|
| 242 | +} |
|
| 243 | 243 | } |
@@ -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 | } |