@@ -14,78 +14,78 @@ |
||
| 14 | 14 | |
| 15 | 15 | trait UtilTrait |
| 16 | 16 | { |
| 17 | - /** |
|
| 17 | +/** |
|
| 18 | 18 | * Register the values into the container |
| 19 | 19 | * |
| 20 | 20 | * @return void |
| 21 | 21 | */ |
| 22 | - private function registerUtils(): void |
|
| 23 | - { |
|
| 24 | - // Translator |
|
| 25 | - $this->set(Translator::class, function($di) { |
|
| 26 | - $xTranslator = new Translator(); |
|
| 27 | - $sResourceDir = rtrim(trim($di->g('jaxon.core.dir.translation')), '/\\'); |
|
| 28 | - // Load the debug translations |
|
| 29 | - $xTranslator->loadTranslations($sResourceDir . '/en/errors.php', 'en'); |
|
| 30 | - $xTranslator->loadTranslations($sResourceDir . '/fr/errors.php', 'fr'); |
|
| 31 | - $xTranslator->loadTranslations($sResourceDir . '/es/errors.php', 'es'); |
|
| 32 | - // Load the config translations |
|
| 33 | - $xTranslator->loadTranslations($sResourceDir . '/en/config.php', 'en'); |
|
| 34 | - $xTranslator->loadTranslations($sResourceDir . '/fr/config.php', 'fr'); |
|
| 35 | - $xTranslator->loadTranslations($sResourceDir . '/es/config.php', 'es'); |
|
| 36 | - // Load the labels translations |
|
| 37 | - $xTranslator->loadTranslations($sResourceDir . '/en/labels.php', 'en'); |
|
| 38 | - $xTranslator->loadTranslations($sResourceDir . '/fr/labels.php', 'fr'); |
|
| 39 | - $xTranslator->loadTranslations($sResourceDir . '/es/labels.php', 'es'); |
|
| 40 | - return $xTranslator; |
|
| 41 | - }); |
|
| 22 | +private function registerUtils(): void |
|
| 23 | +{ |
|
| 24 | +// Translator |
|
| 25 | +$this->set(Translator::class, function($di) { |
|
| 26 | +$xTranslator = new Translator(); |
|
| 27 | +$sResourceDir = rtrim(trim($di->g('jaxon.core.dir.translation')), '/\\'); |
|
| 28 | +// Load the debug translations |
|
| 29 | +$xTranslator->loadTranslations($sResourceDir . '/en/errors.php', 'en'); |
|
| 30 | +$xTranslator->loadTranslations($sResourceDir . '/fr/errors.php', 'fr'); |
|
| 31 | +$xTranslator->loadTranslations($sResourceDir . '/es/errors.php', 'es'); |
|
| 32 | +// Load the config translations |
|
| 33 | +$xTranslator->loadTranslations($sResourceDir . '/en/config.php', 'en'); |
|
| 34 | +$xTranslator->loadTranslations($sResourceDir . '/fr/config.php', 'fr'); |
|
| 35 | +$xTranslator->loadTranslations($sResourceDir . '/es/config.php', 'es'); |
|
| 36 | +// Load the labels translations |
|
| 37 | +$xTranslator->loadTranslations($sResourceDir . '/en/labels.php', 'en'); |
|
| 38 | +$xTranslator->loadTranslations($sResourceDir . '/fr/labels.php', 'fr'); |
|
| 39 | +$xTranslator->loadTranslations($sResourceDir . '/es/labels.php', 'es'); |
|
| 40 | +return $xTranslator; |
|
| 41 | +}); |
|
| 42 | 42 | |
| 43 | - // Config reader |
|
| 44 | - $this->set(ConfigReader::class, function($di) { |
|
| 45 | - return new ConfigReader($di->g(ConfigSetter::class)); |
|
| 46 | - }); |
|
| 47 | - // Config setter |
|
| 48 | - $this->set(ConfigSetter::class, function() { |
|
| 49 | - return new ConfigSetter(); |
|
| 50 | - }); |
|
| 51 | - // Template engine |
|
| 52 | - $this->set(TemplateEngine::class, function($di) { |
|
| 53 | - $xTemplateEngine = new TemplateEngine(); |
|
| 54 | - $sTemplateDir = rtrim(trim($di->g('jaxon.core.dir.template')), '/\\'); |
|
| 55 | - $sPaginationDir = $sTemplateDir . DIRECTORY_SEPARATOR . 'pagination'; |
|
| 56 | - $xTemplateEngine->addNamespace('jaxon', $sTemplateDir, '.php'); |
|
| 57 | - $xTemplateEngine->addNamespace('pagination', $sPaginationDir, '.php'); |
|
| 58 | - $xTemplateEngine->setDefaultNamespace('jaxon'); |
|
| 59 | - return $xTemplateEngine; |
|
| 60 | - }); |
|
| 61 | - // URI detector |
|
| 62 | - $this->set(UriDetector::class, function() { |
|
| 63 | - return new UriDetector(); |
|
| 64 | - }); |
|
| 43 | +// Config reader |
|
| 44 | +$this->set(ConfigReader::class, function($di) { |
|
| 45 | +return new ConfigReader($di->g(ConfigSetter::class)); |
|
| 46 | +}); |
|
| 47 | +// Config setter |
|
| 48 | +$this->set(ConfigSetter::class, function() { |
|
| 49 | +return new ConfigSetter(); |
|
| 50 | +}); |
|
| 51 | +// Template engine |
|
| 52 | +$this->set(TemplateEngine::class, function($di) { |
|
| 53 | +$xTemplateEngine = new TemplateEngine(); |
|
| 54 | +$sTemplateDir = rtrim(trim($di->g('jaxon.core.dir.template')), '/\\'); |
|
| 55 | +$sPaginationDir = $sTemplateDir . DIRECTORY_SEPARATOR . 'pagination'; |
|
| 56 | +$xTemplateEngine->addNamespace('jaxon', $sTemplateDir, '.php'); |
|
| 57 | +$xTemplateEngine->addNamespace('pagination', $sPaginationDir, '.php'); |
|
| 58 | +$xTemplateEngine->setDefaultNamespace('jaxon'); |
|
| 59 | +return $xTemplateEngine; |
|
| 60 | +}); |
|
| 61 | +// URI detector |
|
| 62 | +$this->set(UriDetector::class, function() { |
|
| 63 | +return new UriDetector(); |
|
| 64 | +}); |
|
| 65 | 65 | |
| 66 | - // Temp cache for Jaxon components |
|
| 67 | - $this->set(Stash::class, function() { |
|
| 68 | - return new Stash(); |
|
| 69 | - }); |
|
| 70 | - } |
|
| 66 | +// Temp cache for Jaxon components |
|
| 67 | +$this->set(Stash::class, function() { |
|
| 68 | +return new Stash(); |
|
| 69 | +}); |
|
| 70 | +} |
|
| 71 | 71 | |
| 72 | - /** |
|
| 72 | +/** |
|
| 73 | 73 | * Get the template engine |
| 74 | 74 | * |
| 75 | 75 | * @return TemplateEngine |
| 76 | 76 | */ |
| 77 | - public function getTemplateEngine(): TemplateEngine |
|
| 78 | - { |
|
| 79 | - return $this->g(TemplateEngine::class); |
|
| 80 | - } |
|
| 77 | +public function getTemplateEngine(): TemplateEngine |
|
| 78 | +{ |
|
| 79 | +return $this->g(TemplateEngine::class); |
|
| 80 | +} |
|
| 81 | 81 | |
| 82 | - /** |
|
| 82 | +/** |
|
| 83 | 83 | * Get the temp cache for Jaxon components |
| 84 | 84 | * |
| 85 | 85 | * @return Stash |
| 86 | 86 | */ |
| 87 | - public function getStash(): Stash |
|
| 88 | - { |
|
| 89 | - return $this->g(Stash::class); |
|
| 90 | - } |
|
| 87 | +public function getStash(): Stash |
|
| 88 | +{ |
|
| 89 | +return $this->g(Stash::class); |
|
| 90 | +} |
|
| 91 | 91 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | interface RendererInterface |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * Render an array of pagination links |
| 21 | 21 | * |
| 22 | 22 | * @param Page[] $aPages |
@@ -25,5 +25,5 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return string |
| 27 | 27 | */ |
| 28 | - public function render(array $aPages, Page $xPrevPage, Page $xNextPage): string; |
|
| 28 | +public function render(array $aPages, Page $xPrevPage, Page $xNextPage): string; |
|
| 29 | 29 | } |
@@ -21,30 +21,30 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | class Renderer implements RendererInterface |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * The constructor. |
| 26 | 26 | * |
| 27 | 27 | * @param ViewRenderer $xRenderer |
| 28 | 28 | */ |
| 29 | - public function __construct(private ViewRenderer $xRenderer) |
|
| 30 | - { |
|
| 31 | - $this->xRenderer = $xRenderer; |
|
| 32 | - } |
|
| 29 | +public function __construct(private ViewRenderer $xRenderer) |
|
| 30 | +{ |
|
| 31 | +$this->xRenderer = $xRenderer; |
|
| 32 | +} |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @param Page $xPage |
| 36 | 36 | * |
| 37 | 37 | * @return string |
| 38 | 38 | */ |
| 39 | - private function renderPage(Page $xPage): string |
|
| 40 | - { |
|
| 41 | - return $this->xRenderer->render("pagination::links/{$xPage->sType}", [ |
|
| 42 | - 'page' => $xPage->nNumber, |
|
| 43 | - 'text' => $xPage->sText, |
|
| 44 | - ])->__toString(); |
|
| 45 | - } |
|
| 39 | +private function renderPage(Page $xPage): string |
|
| 40 | +{ |
|
| 41 | +return $this->xRenderer->render("pagination::links/{$xPage->sType}", [ |
|
| 42 | +'page' => $xPage->nNumber, |
|
| 43 | +'text' => $xPage->sText, |
|
| 44 | +])->__toString(); |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * Render an array of pagination links |
| 49 | 49 | * |
| 50 | 50 | * @param Page[] $aPages |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | * |
| 54 | 54 | * @return string |
| 55 | 55 | */ |
| 56 | - public function render(array $aPages, Page $xPrevPage, Page $xNextPage): string |
|
| 57 | - { |
|
| 58 | - return trim($this->xRenderer->render('pagination::wrapper', [ |
|
| 59 | - 'links' => array_map(fn($xPage) => $this->renderPage($xPage), $aPages), |
|
| 60 | - 'prev' => $this->renderPage($xPrevPage), |
|
| 61 | - 'next' => $this->renderPage($xNextPage), |
|
| 62 | - ])->__toString()); |
|
| 63 | - } |
|
| 56 | +public function render(array $aPages, Page $xPrevPage, Page $xNextPage): string |
|
| 57 | +{ |
|
| 58 | +return trim($this->xRenderer->render('pagination::wrapper', [ |
|
| 59 | +'links' => array_map(fn($xPage) => $this->renderPage($xPage), $aPages), |
|
| 60 | +'prev' => $this->renderPage($xPrevPage), |
|
| 61 | +'next' => $this->renderPage($xNextPage), |
|
| 62 | +])->__toString()); |
|
| 63 | +} |
|
| 64 | 64 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | |
| 19 | 19 | interface ConfigListenerInterface |
| 20 | 20 | { |
| 21 | - /** |
|
| 21 | +/** |
|
| 22 | 22 | * Config option changed, in case of multiple changes, the name is an empty string |
| 23 | 23 | * |
| 24 | 24 | * @param Config $xConfig |
@@ -26,5 +26,5 @@ discard block |
||
| 26 | 26 | * |
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | - public function onChange(Config $xConfig, string $sName): void; |
|
| 29 | +public function onChange(Config $xConfig, string $sName): void; |
|
| 30 | 30 | } |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | trait ConfigTrait |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * @return ConfigManager |
| 21 | 21 | */ |
| 22 | - abstract protected function config(): ConfigManager; |
|
| 22 | +abstract protected function config(): ConfigManager; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * Get the value of a config option |
| 26 | 26 | * |
| 27 | 27 | * @param string $sName The option name |
@@ -29,24 +29,24 @@ discard block |
||
| 29 | 29 | * |
| 30 | 30 | * @return mixed |
| 31 | 31 | */ |
| 32 | - public function getLibOption(string $sName, $xDefault = null): mixed |
|
| 33 | - { |
|
| 34 | - return $this->config()->getOption($sName, $xDefault); |
|
| 35 | - } |
|
| 32 | +public function getLibOption(string $sName, $xDefault = null): mixed |
|
| 33 | +{ |
|
| 34 | +return $this->config()->getOption($sName, $xDefault); |
|
| 35 | +} |
|
| 36 | 36 | |
| 37 | - /** |
|
| 37 | +/** |
|
| 38 | 38 | * Check the presence of a config option |
| 39 | 39 | * |
| 40 | 40 | * @param string $sName The option name |
| 41 | 41 | * |
| 42 | 42 | * @return bool |
| 43 | 43 | */ |
| 44 | - public function hasLibOption(string $sName): bool |
|
| 45 | - { |
|
| 46 | - return $this->config()->hasOption($sName); |
|
| 47 | - } |
|
| 44 | +public function hasLibOption(string $sName): bool |
|
| 45 | +{ |
|
| 46 | +return $this->config()->hasOption($sName); |
|
| 47 | +} |
|
| 48 | 48 | |
| 49 | - /** |
|
| 49 | +/** |
|
| 50 | 50 | * Set the value of a config option |
| 51 | 51 | * |
| 52 | 52 | * @param string $sName The option name |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | * |
| 55 | 55 | * @return void |
| 56 | 56 | */ |
| 57 | - public function setLibOption(string $sName, $xValue): void |
|
| 58 | - { |
|
| 59 | - $this->config()->setOption($sName, $xValue); |
|
| 60 | - } |
|
| 57 | +public function setLibOption(string $sName, $xValue): void |
|
| 58 | +{ |
|
| 59 | +$this->config()->setOption($sName, $xValue); |
|
| 60 | +} |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * Get the value of an application config option |
| 64 | 64 | * |
| 65 | 65 | * @param string $sName The option name |
@@ -67,24 +67,24 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return mixed |
| 69 | 69 | */ |
| 70 | - public function getAppOption(string $sName, $xDefault = null): mixed |
|
| 71 | - { |
|
| 72 | - return $this->config()->getAppOption($sName, $xDefault); |
|
| 73 | - } |
|
| 70 | +public function getAppOption(string $sName, $xDefault = null): mixed |
|
| 71 | +{ |
|
| 72 | +return $this->config()->getAppOption($sName, $xDefault); |
|
| 73 | +} |
|
| 74 | 74 | |
| 75 | - /** |
|
| 75 | +/** |
|
| 76 | 76 | * Check the presence of an application config option |
| 77 | 77 | * |
| 78 | 78 | * @param string $sName The option name |
| 79 | 79 | * |
| 80 | 80 | * @return bool |
| 81 | 81 | */ |
| 82 | - public function hasAppOption(string $sName): bool |
|
| 83 | - { |
|
| 84 | - return $this->config()->hasAppOption($sName); |
|
| 85 | - } |
|
| 82 | +public function hasAppOption(string $sName): bool |
|
| 83 | +{ |
|
| 84 | +return $this->config()->hasAppOption($sName); |
|
| 85 | +} |
|
| 86 | 86 | |
| 87 | - /** |
|
| 87 | +/** |
|
| 88 | 88 | * Set the value of a config option |
| 89 | 89 | * |
| 90 | 90 | * @param string $sName The option name |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | * |
| 93 | 93 | * @return void |
| 94 | 94 | */ |
| 95 | - public function setAppOption(string $sName, $xValue): void |
|
| 96 | - { |
|
| 97 | - $this->config()->setAppOption($sName, $xValue); |
|
| 98 | - } |
|
| 95 | +public function setAppOption(string $sName, $xValue): void |
|
| 96 | +{ |
|
| 97 | +$this->config()->setAppOption($sName, $xValue); |
|
| 98 | +} |
|
| 99 | 99 | } |
@@ -21,59 +21,59 @@ |
||
| 21 | 21 | |
| 22 | 22 | abstract class HookData extends AbstractData |
| 23 | 23 | { |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * @var array |
| 26 | 26 | */ |
| 27 | - protected $aCalls = []; |
|
| 27 | +protected $aCalls = []; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 29 | +/** |
|
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | - abstract protected function getType(): string; |
|
| 32 | +abstract protected function getType(): string; |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @return string |
| 36 | 36 | */ |
| 37 | - public function getName(): string |
|
| 38 | - { |
|
| 39 | - return '__' . $this->getType(); |
|
| 40 | - } |
|
| 37 | +public function getName(): string |
|
| 38 | +{ |
|
| 39 | +return '__' . $this->getType(); |
|
| 40 | +} |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | +/** |
|
| 43 | 43 | * @return mixed |
| 44 | 44 | */ |
| 45 | - public function getValue(): mixed |
|
| 46 | - { |
|
| 47 | - return $this->aCalls; |
|
| 48 | - } |
|
| 45 | +public function getValue(): mixed |
|
| 46 | +{ |
|
| 47 | +return $this->aCalls; |
|
| 48 | +} |
|
| 49 | 49 | |
| 50 | - /** |
|
| 50 | +/** |
|
| 51 | 51 | * @param string $sMethod |
| 52 | 52 | * @param array $aParams |
| 53 | 53 | * |
| 54 | 54 | * @return void |
| 55 | 55 | */ |
| 56 | - public function addCall(string $sMethod, array $aParams): void |
|
| 57 | - { |
|
| 58 | - if(!$this->validateMethod($sMethod)) |
|
| 59 | - { |
|
| 60 | - $sType = $this->getType(); |
|
| 61 | - throw new SetupException("'$sMethod' is not a valid \"call\" value for $sType."); |
|
| 62 | - } |
|
| 63 | - $this->aCalls[$sMethod] = $aParams; |
|
| 64 | - } |
|
| 56 | +public function addCall(string $sMethod, array $aParams): void |
|
| 57 | +{ |
|
| 58 | +if(!$this->validateMethod($sMethod)) |
|
| 59 | +{ |
|
| 60 | +$sType = $this->getType(); |
|
| 61 | +throw new SetupException("'$sMethod' is not a valid \"call\" value for $sType."); |
|
| 62 | +} |
|
| 63 | +$this->aCalls[$sMethod] = $aParams; |
|
| 64 | +} |
|
| 65 | 65 | |
| 66 | - /** |
|
| 66 | +/** |
|
| 67 | 67 | * @inheritDoc |
| 68 | 68 | */ |
| 69 | - public function encode(string $sVarName): array |
|
| 70 | - { |
|
| 71 | - $aCalls = []; |
|
| 72 | - foreach($this->aCalls as $sMethod => $aParams) |
|
| 73 | - { |
|
| 74 | - $sParams = addslashes(json_encode($aParams)); |
|
| 75 | - $aCalls[] = "{$sVarName}->addCall('$sMethod', json_decode(\"$sParams\", true));"; |
|
| 76 | - } |
|
| 77 | - return $aCalls; |
|
| 78 | - } |
|
| 69 | +public function encode(string $sVarName): array |
|
| 70 | +{ |
|
| 71 | +$aCalls = []; |
|
| 72 | +foreach($this->aCalls as $sMethod => $aParams) |
|
| 73 | +{ |
|
| 74 | +$sParams = addslashes(json_encode($aParams)); |
|
| 75 | +$aCalls[] = "{$sVarName}->addCall('$sMethod', json_decode(\"$sParams\", true));"; |
|
| 76 | +} |
|
| 77 | +return $aCalls; |
|
| 78 | +} |
|
| 79 | 79 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function addCall(string $sMethod, array $aParams): void |
| 57 | 57 | { |
| 58 | - if(!$this->validateMethod($sMethod)) |
|
| 58 | + if (!$this->validateMethod($sMethod)) |
|
| 59 | 59 | { |
| 60 | 60 | $sType = $this->getType(); |
| 61 | 61 | throw new SetupException("'$sMethod' is not a valid \"call\" value for $sType."); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public function encode(string $sVarName): array |
| 70 | 70 | { |
| 71 | 71 | $aCalls = []; |
| 72 | - foreach($this->aCalls as $sMethod => $aParams) |
|
| 72 | + foreach ($this->aCalls as $sMethod => $aParams) |
|
| 73 | 73 | { |
| 74 | 74 | $sParams = addslashes(json_encode($aParams)); |
| 75 | 75 | $aCalls[] = "{$sVarName}->addCall('$sMethod', json_decode(\"$sParams\", true));"; |
@@ -8,20 +8,20 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | class FuncComponent extends Component\AbstractComponent |
| 10 | 10 | { |
| 11 | - use Component\HelperTrait; |
|
| 12 | - use Component\AjaxResponseTrait; |
|
| 13 | - use Component\ComponentTrait; |
|
| 11 | +use Component\HelperTrait; |
|
| 12 | +use Component\AjaxResponseTrait; |
|
| 13 | +use Component\ComponentTrait; |
|
| 14 | 14 | |
| 15 | - /** |
|
| 15 | +/** |
|
| 16 | 16 | * @inheritDoc |
| 17 | 17 | */ |
| 18 | - final protected function initComponent(Container $di, ComponentHelper $xHelper): void |
|
| 19 | - { |
|
| 20 | - $this->setHelper($xHelper); |
|
| 21 | - $this->setAjaxResponse($di); |
|
| 22 | - } |
|
| 18 | +final protected function initComponent(Container $di, ComponentHelper $xHelper): void |
|
| 19 | +{ |
|
| 20 | +$this->setHelper($xHelper); |
|
| 21 | +$this->setAjaxResponse($di); |
|
| 22 | +} |
|
| 23 | 23 | |
| 24 | - /** |
|
| 24 | +/** |
|
| 25 | 25 | * Create a paginator. |
| 26 | 26 | * |
| 27 | 27 | * @param int $nPageNumber The current page number |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @return Paginator |
| 32 | 32 | */ |
| 33 | - final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator |
|
| 34 | - { |
|
| 35 | - return $this->response->paginator($nPageNumber, $nItemsPerPage, $nTotalItems); |
|
| 36 | - } |
|
| 33 | +final public function paginator(int $nPageNumber, int $nItemsPerPage, int $nTotalItems): Paginator |
|
| 34 | +{ |
|
| 35 | +return $this->response->paginator($nPageNumber, $nItemsPerPage, $nTotalItems); |
|
| 36 | +} |
|
| 37 | 37 | } |
@@ -4,23 +4,23 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | interface SessionInterface |
| 6 | 6 | { |
| 7 | - /** |
|
| 7 | +/** |
|
| 8 | 8 | * Get the current session id |
| 9 | 9 | * |
| 10 | 10 | * @return string |
| 11 | 11 | */ |
| 12 | - public function getId(): string; |
|
| 12 | +public function getId(): string; |
|
| 13 | 13 | |
| 14 | - /** |
|
| 14 | +/** |
|
| 15 | 15 | * Generate a new session id |
| 16 | 16 | * |
| 17 | 17 | * @param bool $bDeleteData Whether to delete data from the previous session |
| 18 | 18 | * |
| 19 | 19 | * @return void |
| 20 | 20 | */ |
| 21 | - public function newId(bool $bDeleteData = false): void; |
|
| 21 | +public function newId(bool $bDeleteData = false): void; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 23 | +/** |
|
| 24 | 24 | * Save data in the session |
| 25 | 25 | * |
| 26 | 26 | * @param string $sKey The session key |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | * |
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | - public function set(string $sKey, mixed $xValue): void; |
|
| 31 | +public function set(string $sKey, mixed $xValue): void; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * Save data in the session, that will be available only until the next call |
| 35 | 35 | * |
| 36 | 36 | * @param string $sKey The session key |
@@ -38,18 +38,18 @@ discard block |
||
| 38 | 38 | * |
| 39 | 39 | * @return void |
| 40 | 40 | */ |
| 41 | - // public function flash(string $sKey, $xValue); |
|
| 41 | +// public function flash(string $sKey, $xValue); |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * Check if a session key exists |
| 45 | 45 | * |
| 46 | 46 | * @param string $sKey The session key |
| 47 | 47 | * |
| 48 | 48 | * @return bool |
| 49 | 49 | */ |
| 50 | - public function has(string $sKey): bool; |
|
| 50 | +public function has(string $sKey): bool; |
|
| 51 | 51 | |
| 52 | - /** |
|
| 52 | +/** |
|
| 53 | 53 | * Get data from the session |
| 54 | 54 | * |
| 55 | 55 | * @param string $sKey The session key |
@@ -57,28 +57,28 @@ discard block |
||
| 57 | 57 | * |
| 58 | 58 | * @return mixed |
| 59 | 59 | */ |
| 60 | - public function get(string $sKey, mixed $xDefault = null): mixed; |
|
| 60 | +public function get(string $sKey, mixed $xDefault = null): mixed; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * Get all data in the session |
| 64 | 64 | * |
| 65 | 65 | * @return array |
| 66 | 66 | */ |
| 67 | - public function all(): array; |
|
| 67 | +public function all(): array; |
|
| 68 | 68 | |
| 69 | - /** |
|
| 69 | +/** |
|
| 70 | 70 | * Delete a session key and its data |
| 71 | 71 | * |
| 72 | 72 | * @param string $sKey The session key |
| 73 | 73 | * |
| 74 | 74 | * @return void |
| 75 | 75 | */ |
| 76 | - public function delete(string $sKey): void; |
|
| 76 | +public function delete(string $sKey): void; |
|
| 77 | 77 | |
| 78 | - /** |
|
| 78 | +/** |
|
| 79 | 79 | * Delete all data in the session |
| 80 | 80 | * |
| 81 | 81 | * @return void |
| 82 | 82 | */ |
| 83 | - public function clear(): void; |
|
| 83 | +public function clear(): void; |
|
| 84 | 84 | } |
@@ -23,58 +23,58 @@ |
||
| 23 | 23 | |
| 24 | 24 | trait ResponseTrait |
| 25 | 25 | { |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * @return ResponseManager |
| 28 | 28 | */ |
| 29 | - abstract public function getResponseManager(): ResponseManager; |
|
| 29 | +abstract public function getResponseManager(): ResponseManager; |
|
| 30 | 30 | |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * Get the global Response object |
| 33 | 33 | * |
| 34 | 34 | * @return Response |
| 35 | 35 | */ |
| 36 | - public function getResponse(): Response |
|
| 37 | - { |
|
| 38 | - return $this->getResponseManager()->getResponse(); |
|
| 39 | - } |
|
| 36 | +public function getResponse(): Response |
|
| 37 | +{ |
|
| 38 | +return $this->getResponseManager()->getResponse(); |
|
| 39 | +} |
|
| 40 | 40 | |
| 41 | - /** |
|
| 41 | +/** |
|
| 42 | 42 | * Create a new Jaxon response object |
| 43 | 43 | * |
| 44 | 44 | * @return Response |
| 45 | 45 | */ |
| 46 | - public function newResponse(): Response |
|
| 47 | - { |
|
| 48 | - return $this->getResponseManager()->newResponse(); |
|
| 49 | - } |
|
| 46 | +public function newResponse(): Response |
|
| 47 | +{ |
|
| 48 | +return $this->getResponseManager()->newResponse(); |
|
| 49 | +} |
|
| 50 | 50 | |
| 51 | - /** |
|
| 51 | +/** |
|
| 52 | 52 | * Get the Jaxon ajax response |
| 53 | 53 | * |
| 54 | 54 | * @return AjaxResponse |
| 55 | 55 | */ |
| 56 | - public function ajaxResponse(): AjaxResponse |
|
| 57 | - { |
|
| 58 | - return $this->getResponseManager()->ajaxResponse(); |
|
| 59 | - } |
|
| 56 | +public function ajaxResponse(): AjaxResponse |
|
| 57 | +{ |
|
| 58 | +return $this->getResponseManager()->ajaxResponse(); |
|
| 59 | +} |
|
| 60 | 60 | |
| 61 | - /** |
|
| 61 | +/** |
|
| 62 | 62 | * Get the configured character encoding |
| 63 | 63 | * |
| 64 | 64 | * @return string |
| 65 | 65 | */ |
| 66 | - public function getCharacterEncoding(): string |
|
| 67 | - { |
|
| 68 | - return $this->getResponseManager()->getCharacterEncoding(); |
|
| 69 | - } |
|
| 66 | +public function getCharacterEncoding(): string |
|
| 67 | +{ |
|
| 68 | +return $this->getResponseManager()->getCharacterEncoding(); |
|
| 69 | +} |
|
| 70 | 70 | |
| 71 | - /** |
|
| 71 | +/** |
|
| 72 | 72 | * Get the content type of the HTTP response |
| 73 | 73 | * |
| 74 | 74 | * @return string |
| 75 | 75 | */ |
| 76 | - public function getContentType(): string |
|
| 77 | - { |
|
| 78 | - return $this->getResponseManager()->getContentType(); |
|
| 79 | - } |
|
| 76 | +public function getContentType(): string |
|
| 77 | +{ |
|
| 78 | +return $this->getResponseManager()->getContentType(); |
|
| 79 | +} |
|
| 80 | 80 | } |