@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | public function canProcessRequest(): bool |
| 62 | 62 | { |
| 63 | 63 | // Return true if the request plugin was already found |
| 64 | - if($this->xRequestPlugin !== null) |
|
| 64 | + if ($this->xRequestPlugin !== null) |
|
| 65 | 65 | { |
| 66 | 66 | return true; |
| 67 | 67 | } |
@@ -70,9 +70,9 @@ discard block |
||
| 70 | 70 | $xRequest = $this->di->getRequest(); |
| 71 | 71 | |
| 72 | 72 | // Find a plugin to process the request |
| 73 | - foreach($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
| 73 | + foreach ($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
| 74 | 74 | { |
| 75 | - if($sClassName::canProcessRequest($xRequest)) |
|
| 75 | + if ($sClassName::canProcessRequest($xRequest)) |
|
| 76 | 76 | { |
| 77 | 77 | $this->xRequestPlugin = $this->di->g($sClassName); |
| 78 | 78 | $xTarget = $this->xRequestPlugin->setTarget($xRequest); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | private function _processRequest(): void |
| 93 | 93 | { |
| 94 | 94 | // Process the request |
| 95 | - if($this->xRequestPlugin !== null) |
|
| 95 | + if ($this->xRequestPlugin !== null) |
|
| 96 | 96 | { |
| 97 | 97 | $this->xRequestPlugin->processRequest(); |
| 98 | 98 | // Process the databag |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | public function processRequest(): void |
| 110 | 110 | { |
| 111 | 111 | // Check if there is a plugin to process this request |
| 112 | - if(!$this->canProcessRequest()) |
|
| 112 | + if (!$this->canProcessRequest()) |
|
| 113 | 113 | { |
| 114 | 114 | return; |
| 115 | 115 | } |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | { |
| 119 | 119 | $bEndRequest = false; |
| 120 | 120 | // Handle before processing event |
| 121 | - if($this->xRequestPlugin !== null) |
|
| 121 | + if ($this->xRequestPlugin !== null) |
|
| 122 | 122 | { |
| 123 | 123 | $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest); |
| 124 | 124 | } |
| 125 | - if($bEndRequest) |
|
| 125 | + if ($bEndRequest) |
|
| 126 | 126 | { |
| 127 | 127 | return; |
| 128 | 128 | } |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | $this->_processRequest(); |
| 131 | 131 | |
| 132 | 132 | // Handle after processing event |
| 133 | - if($this->xRequestPlugin !== null) |
|
| 133 | + if ($this->xRequestPlugin !== null) |
|
| 134 | 134 | { |
| 135 | 135 | $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest); |
| 136 | 136 | } |
@@ -138,12 +138,12 @@ discard block |
||
| 138 | 138 | // An exception was thrown while processing the request. |
| 139 | 139 | // The request missed the corresponding handler function, |
| 140 | 140 | // or an error occurred while attempting to execute the handler. |
| 141 | - catch(RequestException $e) |
|
| 141 | + catch (RequestException $e) |
|
| 142 | 142 | { |
| 143 | 143 | $this->xResponseManager->error($e->getMessage()); |
| 144 | 144 | $this->xCallbackManager->onInvalid($e); |
| 145 | 145 | } |
| 146 | - catch(Exception $e) |
|
| 146 | + catch (Exception $e) |
|
| 147 | 147 | { |
| 148 | 148 | $this->xResponseManager->error($e->getMessage()); |
| 149 | 149 | $this->xCallbackManager->onError($e); |
@@ -142,8 +142,7 @@ |
||
| 142 | 142 | { |
| 143 | 143 | $this->xResponseManager->error($e->getMessage()); |
| 144 | 144 | $this->xCallbackManager->onInvalid($e); |
| 145 | - } |
|
| 146 | - catch(Exception $e) |
|
| 145 | + } catch(Exception $e) |
|
| 147 | 146 | { |
| 148 | 147 | $this->xResponseManager->error($e->getMessage()); |
| 149 | 148 | $this->xCallbackManager->onError($e); |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | class RequestHandler |
| 32 | 32 | { |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * The request plugin that is able to process the current request |
| 35 | 35 | * |
| 36 | 36 | * @var RequestHandlerInterface |
| 37 | 37 | */ |
| 38 | - private $xRequestPlugin = null; |
|
| 38 | +private $xRequestPlugin = null; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * The constructor |
| 42 | 42 | * |
| 43 | 43 | * @param Container $di |
@@ -46,110 +46,110 @@ discard block |
||
| 46 | 46 | * @param CallbackManager $xCallbackManager |
| 47 | 47 | * @param DatabagPlugin $xDatabagPlugin |
| 48 | 48 | */ |
| 49 | - public function __construct(private Container $di, private PluginManager $xPluginManager, |
|
| 50 | - private ResponseManager $xResponseManager, private CallbackManager $xCallbackManager, |
|
| 51 | - private DatabagPlugin $xDatabagPlugin) |
|
| 52 | - {} |
|
| 49 | +public function __construct(private Container $di, private PluginManager $xPluginManager, |
|
| 50 | +private ResponseManager $xResponseManager, private CallbackManager $xCallbackManager, |
|
| 51 | +private DatabagPlugin $xDatabagPlugin) |
|
| 52 | +{} |
|
| 53 | 53 | |
| 54 | - /** |
|
| 54 | +/** |
|
| 55 | 55 | * Check if the current request can be processed |
| 56 | 56 | * |
| 57 | 57 | * Calls each of the request plugins and determines if the current request can be processed by one of them. |
| 58 | 58 | * |
| 59 | 59 | * @return bool |
| 60 | 60 | */ |
| 61 | - public function canProcessRequest(): bool |
|
| 62 | - { |
|
| 63 | - // Return true if the request plugin was already found |
|
| 64 | - if($this->xRequestPlugin !== null) |
|
| 65 | - { |
|
| 66 | - return true; |
|
| 67 | - } |
|
| 61 | +public function canProcessRequest(): bool |
|
| 62 | +{ |
|
| 63 | +// Return true if the request plugin was already found |
|
| 64 | +if($this->xRequestPlugin !== null) |
|
| 65 | +{ |
|
| 66 | +return true; |
|
| 67 | +} |
|
| 68 | 68 | |
| 69 | - // The HTTP request |
|
| 70 | - $xRequest = $this->di->getRequest(); |
|
| 69 | +// The HTTP request |
|
| 70 | +$xRequest = $this->di->getRequest(); |
|
| 71 | 71 | |
| 72 | - // Find a plugin to process the request |
|
| 73 | - foreach($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
| 74 | - { |
|
| 75 | - if($sClassName::canProcessRequest($xRequest)) |
|
| 76 | - { |
|
| 77 | - $this->xRequestPlugin = $this->di->g($sClassName); |
|
| 78 | - $xTarget = $this->xRequestPlugin->setTarget($xRequest); |
|
| 79 | - $xTarget->setMethodArgs($this->di->getRequestArguments()); |
|
| 80 | - return true; |
|
| 81 | - } |
|
| 82 | - } |
|
| 83 | - return false; |
|
| 84 | - } |
|
| 72 | +// Find a plugin to process the request |
|
| 73 | +foreach($this->xPluginManager->getRequestHandlers() as $sClassName) |
|
| 74 | +{ |
|
| 75 | +if($sClassName::canProcessRequest($xRequest)) |
|
| 76 | +{ |
|
| 77 | + $this->xRequestPlugin = $this->di->g($sClassName); |
|
| 78 | + $xTarget = $this->xRequestPlugin->setTarget($xRequest); |
|
| 79 | + $xTarget->setMethodArgs($this->di->getRequestArguments()); |
|
| 80 | + return true; |
|
| 81 | +} |
|
| 82 | +} |
|
| 83 | +return false; |
|
| 84 | +} |
|
| 85 | 85 | |
| 86 | - /** |
|
| 86 | +/** |
|
| 87 | 87 | * Process the current request and handle errors and exceptions. |
| 88 | 88 | * |
| 89 | 89 | * @return void |
| 90 | 90 | * @throws RequestException |
| 91 | 91 | */ |
| 92 | - private function _processRequest(): void |
|
| 93 | - { |
|
| 94 | - // Process the request |
|
| 95 | - if($this->xRequestPlugin !== null) |
|
| 96 | - { |
|
| 97 | - $this->xRequestPlugin->processRequest(); |
|
| 98 | - // Process the databag |
|
| 99 | - $this->xDatabagPlugin->writeCommand(); |
|
| 100 | - } |
|
| 101 | - } |
|
| 92 | +private function _processRequest(): void |
|
| 93 | +{ |
|
| 94 | +// Process the request |
|
| 95 | +if($this->xRequestPlugin !== null) |
|
| 96 | +{ |
|
| 97 | +$this->xRequestPlugin->processRequest(); |
|
| 98 | +// Process the databag |
|
| 99 | +$this->xDatabagPlugin->writeCommand(); |
|
| 100 | +} |
|
| 101 | +} |
|
| 102 | 102 | |
| 103 | - /** |
|
| 103 | +/** |
|
| 104 | 104 | * Process the current request. |
| 105 | 105 | * |
| 106 | 106 | * @return void |
| 107 | 107 | * @throws RequestException |
| 108 | 108 | */ |
| 109 | - public function processRequest(): void |
|
| 110 | - { |
|
| 111 | - // Check if there is a plugin to process this request |
|
| 112 | - if(!$this->canProcessRequest()) |
|
| 113 | - { |
|
| 114 | - return; |
|
| 115 | - } |
|
| 109 | +public function processRequest(): void |
|
| 110 | +{ |
|
| 111 | +// Check if there is a plugin to process this request |
|
| 112 | +if(!$this->canProcessRequest()) |
|
| 113 | +{ |
|
| 114 | +return; |
|
| 115 | +} |
|
| 116 | 116 | |
| 117 | - try |
|
| 118 | - { |
|
| 119 | - $bEndRequest = false; |
|
| 120 | - // Handle before processing event |
|
| 121 | - if($this->xRequestPlugin !== null) |
|
| 122 | - { |
|
| 123 | - $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest); |
|
| 124 | - } |
|
| 125 | - if($bEndRequest) |
|
| 126 | - { |
|
| 127 | - return; |
|
| 128 | - } |
|
| 117 | +try |
|
| 118 | +{ |
|
| 119 | +$bEndRequest = false; |
|
| 120 | +// Handle before processing event |
|
| 121 | +if($this->xRequestPlugin !== null) |
|
| 122 | +{ |
|
| 123 | + $this->xCallbackManager->onBefore($this->xRequestPlugin->getTarget(), $bEndRequest); |
|
| 124 | +} |
|
| 125 | +if($bEndRequest) |
|
| 126 | +{ |
|
| 127 | + return; |
|
| 128 | +} |
|
| 129 | 129 | |
| 130 | - $this->_processRequest(); |
|
| 130 | +$this->_processRequest(); |
|
| 131 | 131 | |
| 132 | - // Handle after processing event |
|
| 133 | - if($this->xRequestPlugin !== null) |
|
| 134 | - { |
|
| 135 | - $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest); |
|
| 136 | - } |
|
| 137 | - } |
|
| 138 | - // An exception was thrown while processing the request. |
|
| 139 | - // The request missed the corresponding handler function, |
|
| 140 | - // or an error occurred while attempting to execute the handler. |
|
| 141 | - catch(RequestException $e) |
|
| 142 | - { |
|
| 143 | - $this->xResponseManager->error($e->getMessage()); |
|
| 144 | - $this->xCallbackManager->onInvalid($e); |
|
| 145 | - } |
|
| 146 | - catch(Exception $e) |
|
| 147 | - { |
|
| 148 | - $this->xResponseManager->error($e->getMessage()); |
|
| 149 | - $this->xCallbackManager->onError($e); |
|
| 150 | - } |
|
| 132 | +// Handle after processing event |
|
| 133 | +if($this->xRequestPlugin !== null) |
|
| 134 | +{ |
|
| 135 | + $this->xCallbackManager->onAfter($this->xRequestPlugin->getTarget(), $bEndRequest); |
|
| 136 | +} |
|
| 137 | +} |
|
| 138 | +// An exception was thrown while processing the request. |
|
| 139 | +// The request missed the corresponding handler function, |
|
| 140 | +// or an error occurred while attempting to execute the handler. |
|
| 141 | +catch(RequestException $e) |
|
| 142 | +{ |
|
| 143 | +$this->xResponseManager->error($e->getMessage()); |
|
| 144 | +$this->xCallbackManager->onInvalid($e); |
|
| 145 | +} |
|
| 146 | +catch(Exception $e) |
|
| 147 | +{ |
|
| 148 | +$this->xResponseManager->error($e->getMessage()); |
|
| 149 | +$this->xCallbackManager->onError($e); |
|
| 150 | +} |
|
| 151 | 151 | |
| 152 | - // Print the debug messages |
|
| 153 | - $this->xResponseManager->printDebug(); |
|
| 154 | - } |
|
| 152 | +// Print the debug messages |
|
| 153 | +$this->xResponseManager->printDebug(); |
|
| 154 | +} |
|
| 155 | 155 | } |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | class ParameterReader |
| 42 | 42 | { |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * The constructor |
| 45 | 45 | * |
| 46 | 46 | * @param Container $di |
@@ -48,28 +48,28 @@ discard block |
||
| 48 | 48 | * @param ConfigManager $xConfigManager |
| 49 | 49 | * @param UriDetector $xUriDetector |
| 50 | 50 | */ |
| 51 | - public function __construct(private Container $di, private Translator $xTranslator, |
|
| 52 | - private ConfigManager $xConfigManager, private UriDetector $xUriDetector) |
|
| 53 | - {} |
|
| 51 | +public function __construct(private Container $di, private Translator $xTranslator, |
|
| 52 | +private ConfigManager $xConfigManager, private UriDetector $xUriDetector) |
|
| 53 | +{} |
|
| 54 | 54 | |
| 55 | - /** |
|
| 55 | +/** |
|
| 56 | 56 | * Decode input data. |
| 57 | 57 | * |
| 58 | 58 | * @param string $sStr |
| 59 | 59 | * |
| 60 | 60 | * @return string |
| 61 | 61 | */ |
| 62 | - private function decodeStr(string $sStr): string |
|
| 63 | - { |
|
| 64 | - $aServerParams = $this->di->getServerParams(); |
|
| 65 | - $sContentType = $aServerParams['CONTENT_TYPE'] ?? $aServerParams['HTTP_CONTENT_TYPE'] ?? ''; |
|
| 66 | - $sType = 'multipart/form-data'; |
|
| 67 | - // Parameters are url encoded when uploading files |
|
| 68 | - return strncmp($sContentType, $sType, strlen($sType)) !== 0 ? |
|
| 69 | - $sStr : urldecode($sStr); |
|
| 70 | - } |
|
| 62 | +private function decodeStr(string $sStr): string |
|
| 63 | +{ |
|
| 64 | +$aServerParams = $this->di->getServerParams(); |
|
| 65 | +$sContentType = $aServerParams['CONTENT_TYPE'] ?? $aServerParams['HTTP_CONTENT_TYPE'] ?? ''; |
|
| 66 | +$sType = 'multipart/form-data'; |
|
| 67 | +// Parameters are url encoded when uploading files |
|
| 68 | +return strncmp($sContentType, $sType, strlen($sType)) !== 0 ? |
|
| 69 | +$sStr : urldecode($sStr); |
|
| 70 | +} |
|
| 71 | 71 | |
| 72 | - /** |
|
| 72 | +/** |
|
| 73 | 73 | * Decode input data. |
| 74 | 74 | * |
| 75 | 75 | * @param string $sStr |
@@ -77,73 +77,73 @@ discard block |
||
| 77 | 77 | * @return string |
| 78 | 78 | * @throws RequestException |
| 79 | 79 | */ |
| 80 | - private function decoderUtf8Str(string $sStr): string |
|
| 81 | - { |
|
| 82 | - $sEncoding = $this->xConfigManager->getOption('core.encoding', ''); |
|
| 83 | - if(function_exists('iconv')) |
|
| 84 | - { |
|
| 85 | - return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr); |
|
| 86 | - } |
|
| 87 | - if(function_exists('mb_convert_encoding')) |
|
| 88 | - { |
|
| 89 | - return mb_convert_encoding($sStr, $sEncoding, "UTF-8"); |
|
| 90 | - } |
|
| 91 | - // By default, no decoding |
|
| 92 | - // return $sStr; |
|
| 93 | - throw new RequestException($this->xTranslator->trans('errors.request.conversion')); |
|
| 94 | - } |
|
| 80 | +private function decoderUtf8Str(string $sStr): string |
|
| 81 | +{ |
|
| 82 | +$sEncoding = $this->xConfigManager->getOption('core.encoding', ''); |
|
| 83 | +if(function_exists('iconv')) |
|
| 84 | +{ |
|
| 85 | +return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr); |
|
| 86 | +} |
|
| 87 | +if(function_exists('mb_convert_encoding')) |
|
| 88 | +{ |
|
| 89 | +return mb_convert_encoding($sStr, $sEncoding, "UTF-8"); |
|
| 90 | +} |
|
| 91 | +// By default, no decoding |
|
| 92 | +// return $sStr; |
|
| 93 | +throw new RequestException($this->xTranslator->trans('errors.request.conversion')); |
|
| 94 | +} |
|
| 95 | 95 | |
| 96 | - /** |
|
| 96 | +/** |
|
| 97 | 97 | * Choose the function to use to decode input data. |
| 98 | 98 | * |
| 99 | 99 | * @param string $sParam |
| 100 | 100 | * |
| 101 | 101 | * @return string |
| 102 | 102 | */ |
| 103 | - private function decodeRequestParameter(string $sParam): string |
|
| 104 | - { |
|
| 105 | - $sParam = $this->decodeStr($sParam); |
|
| 106 | - if(!$this->xConfigManager->getOption('core.decode_utf8')) |
|
| 107 | - { |
|
| 108 | - return $sParam; |
|
| 109 | - } |
|
| 110 | - $this->xConfigManager->setOption('core.decode_utf8', false); |
|
| 111 | - return $this->decoderUtf8Str($sParam); |
|
| 112 | - } |
|
| 103 | +private function decodeRequestParameter(string $sParam): string |
|
| 104 | +{ |
|
| 105 | +$sParam = $this->decodeStr($sParam); |
|
| 106 | +if(!$this->xConfigManager->getOption('core.decode_utf8')) |
|
| 107 | +{ |
|
| 108 | +return $sParam; |
|
| 109 | +} |
|
| 110 | +$this->xConfigManager->setOption('core.decode_utf8', false); |
|
| 111 | +return $this->decoderUtf8Str($sParam); |
|
| 112 | +} |
|
| 113 | 113 | |
| 114 | - /** |
|
| 114 | +/** |
|
| 115 | 115 | * @param ServerRequestInterface $xRequest |
| 116 | 116 | * |
| 117 | 117 | * @return array|null |
| 118 | 118 | */ |
| 119 | - public function getRequestParameter(ServerRequestInterface $xRequest): ?array |
|
| 120 | - { |
|
| 121 | - $aBody = $xRequest->getParsedBody(); |
|
| 122 | - $aParams = is_array($aBody) ? $aBody : $xRequest->getQueryParams(); |
|
| 123 | - // Check if Jaxon call parameters are present. |
|
| 124 | - return !isset($aParams['jxncall']) || !is_string($aParams['jxncall']) ? null : |
|
| 125 | - json_decode($this->decodeRequestParameter($aParams['jxncall']), true); |
|
| 126 | - } |
|
| 119 | +public function getRequestParameter(ServerRequestInterface $xRequest): ?array |
|
| 120 | +{ |
|
| 121 | +$aBody = $xRequest->getParsedBody(); |
|
| 122 | +$aParams = is_array($aBody) ? $aBody : $xRequest->getQueryParams(); |
|
| 123 | +// Check if Jaxon call parameters are present. |
|
| 124 | +return !isset($aParams['jxncall']) || !is_string($aParams['jxncall']) ? null : |
|
| 125 | +json_decode($this->decodeRequestParameter($aParams['jxncall']), true); |
|
| 126 | +} |
|
| 127 | 127 | |
| 128 | - /** |
|
| 128 | +/** |
|
| 129 | 129 | * Get the URI of the current request |
| 130 | 130 | * |
| 131 | 131 | * @throws UriException |
| 132 | 132 | */ |
| 133 | - public function uri(): string |
|
| 134 | - { |
|
| 135 | - return $this->xUriDetector->detect($this->di->getServerParams()); |
|
| 136 | - } |
|
| 133 | +public function uri(): string |
|
| 134 | +{ |
|
| 135 | +return $this->xUriDetector->detect($this->di->getServerParams()); |
|
| 136 | +} |
|
| 137 | 137 | |
| 138 | - /** |
|
| 138 | +/** |
|
| 139 | 139 | * Make the specified URL suitable for redirect |
| 140 | 140 | * |
| 141 | 141 | * @param string $sURL The relative or fully qualified URL |
| 142 | 142 | * |
| 143 | 143 | * @return string |
| 144 | 144 | */ |
| 145 | - public function parseUrl(string $sURL): string |
|
| 146 | - { |
|
| 147 | - return $this->xUriDetector->redirect($sURL, $this->di->getServerParams()); |
|
| 148 | - } |
|
| 145 | +public function parseUrl(string $sURL): string |
|
| 146 | +{ |
|
| 147 | +return $this->xUriDetector->redirect($sURL, $this->di->getServerParams()); |
|
| 148 | +} |
|
| 149 | 149 | } |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | private function decoderUtf8Str(string $sStr): string |
| 81 | 81 | { |
| 82 | 82 | $sEncoding = $this->xConfigManager->getOption('core.encoding', ''); |
| 83 | - if(function_exists('iconv')) |
|
| 83 | + if (function_exists('iconv')) |
|
| 84 | 84 | { |
| 85 | 85 | return iconv("UTF-8", $sEncoding . '//TRANSLIT', $sStr); |
| 86 | 86 | } |
| 87 | - if(function_exists('mb_convert_encoding')) |
|
| 87 | + if (function_exists('mb_convert_encoding')) |
|
| 88 | 88 | { |
| 89 | 89 | return mb_convert_encoding($sStr, $sEncoding, "UTF-8"); |
| 90 | 90 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | private function decodeRequestParameter(string $sParam): string |
| 104 | 104 | { |
| 105 | 105 | $sParam = $this->decodeStr($sParam); |
| 106 | - if(!$this->xConfigManager->getOption('core.decode_utf8')) |
|
| 106 | + if (!$this->xConfigManager->getOption('core.decode_utf8')) |
|
| 107 | 107 | { |
| 108 | 108 | return $sParam; |
| 109 | 109 | } |
@@ -18,52 +18,52 @@ |
||
| 18 | 18 | |
| 19 | 19 | interface FileInterface |
| 20 | 20 | { |
| 21 | - /** |
|
| 21 | +/** |
|
| 22 | 22 | * Get the filesystem where the file is stored |
| 23 | 23 | * |
| 24 | 24 | * @return Filesystem |
| 25 | 25 | */ |
| 26 | - public function filesystem(): Filesystem; |
|
| 26 | +public function filesystem(): Filesystem; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 28 | +/** |
|
| 29 | 29 | * Get the uploaded file type |
| 30 | 30 | * |
| 31 | 31 | * @return string |
| 32 | 32 | */ |
| 33 | - public function type(): string; |
|
| 33 | +public function type(): string; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 35 | +/** |
|
| 36 | 36 | * Get the uploaded file name, without the extension and slugified |
| 37 | 37 | * |
| 38 | 38 | * @return string |
| 39 | 39 | */ |
| 40 | - public function name(): string; |
|
| 40 | +public function name(): string; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | +/** |
|
| 43 | 43 | * Get the uploaded file name, with the extension |
| 44 | 44 | * |
| 45 | 45 | * @return string |
| 46 | 46 | */ |
| 47 | - public function filename(): string; |
|
| 47 | +public function filename(): string; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 49 | +/** |
|
| 50 | 50 | * Get the uploaded file path |
| 51 | 51 | * |
| 52 | 52 | * @return string |
| 53 | 53 | */ |
| 54 | - public function path(): string; |
|
| 54 | +public function path(): string; |
|
| 55 | 55 | |
| 56 | - /** |
|
| 56 | +/** |
|
| 57 | 57 | * Get the uploaded file size |
| 58 | 58 | * |
| 59 | 59 | * @return int |
| 60 | 60 | */ |
| 61 | - public function size(): int; |
|
| 61 | +public function size(): int; |
|
| 62 | 62 | |
| 63 | - /** |
|
| 63 | +/** |
|
| 64 | 64 | * Get the uploaded file extension |
| 65 | 65 | * |
| 66 | 66 | * @return string |
| 67 | 67 | */ |
| 68 | - public function extension(): string; |
|
| 68 | +public function extension(): string; |
|
| 69 | 69 | } |
@@ -31,9 +31,9 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function withPage(): self |
| 33 | 33 | { |
| 34 | - foreach($this->aArguments as $xArgument) |
|
| 34 | + foreach ($this->aArguments as $xArgument) |
|
| 35 | 35 | { |
| 36 | - if(TypedValue::isPage($xArgument)) |
|
| 36 | + if (TypedValue::isPage($xArgument)) |
|
| 37 | 37 | { |
| 38 | 38 | return $this; |
| 39 | 39 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | { |
| 26 | 26 | $sName = trim($sPath) ?: 'this'; |
| 27 | 27 | $this->aCall = ['_type' => 'select', '_name' => $sName, 'mode' => $sMode]; |
| 28 | - if($sName !== 'this' && $xContext !== null) |
|
| 28 | + if ($sName !== 'this' && $xContext !== null) |
|
| 29 | 29 | { |
| 30 | 30 | $this->aCall['context'] = is_a($xContext, JsonSerializable::class) ? |
| 31 | 31 | $xContext->jsonSerialize() : $xContext; |
@@ -89,9 +89,9 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public function func(): ?Func |
| 91 | 91 | { |
| 92 | - foreach($this->aCalls as $xCall) |
|
| 92 | + foreach ($this->aCalls as $xCall) |
|
| 93 | 93 | { |
| 94 | - if(is_a($xCall, Func::class)) |
|
| 94 | + if (is_a($xCall, Func::class)) |
|
| 95 | 95 | { |
| 96 | 96 | return $xCall; |
| 97 | 97 | } |
@@ -426,15 +426,15 @@ discard block |
||
| 426 | 426 | 'calls' => array_map(fn(JsonSerializable|array $xCall) => |
| 427 | 427 | is_array($xCall) ? $xCall : $xCall->jsonSerialize(), $this->aCalls), |
| 428 | 428 | ]; |
| 429 | - if(($this->aConfirm)) |
|
| 429 | + if (($this->aConfirm)) |
|
| 430 | 430 | { |
| 431 | 431 | $aJsExpr['confirm'] = $this->aConfirm; |
| 432 | 432 | } |
| 433 | - if(($this->aCondition)) |
|
| 433 | + if (($this->aCondition)) |
|
| 434 | 434 | { |
| 435 | 435 | $aJsExpr['condition'] = $this->aCondition; |
| 436 | 436 | } |
| 437 | - if(($this->aAlert)) |
|
| 437 | + if (($this->aAlert)) |
|
| 438 | 438 | { |
| 439 | 439 | $aJsExpr['alert'] = $this->aAlert; |
| 440 | 440 | } |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | */ |
| 59 | 59 | public function __get(string $sAttribute): JsExpr |
| 60 | 60 | { |
| 61 | - return $this->_expr()->__get( $sAttribute); |
|
| 61 | + return $this->_expr()->__get($sAttribute); |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | /** |
@@ -63,8 +63,10 @@ |
||
| 63 | 63 | |
| 64 | 64 | interface TestInterface |
| 65 | 65 | { |
| 66 | - public function do(); |
|
| 67 | -} |
|
| 66 | + public function do { |
|
| 67 | + (); |
|
| 68 | + } |
|
| 69 | + } |
|
| 68 | 70 | |
| 69 | 71 | class ClassWithInterface implements TestInterface |
| 70 | 72 | { |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | Dialog\Library\Butterup::class, // Butterup |
| 56 | 56 | Dialog\Library\IziToast::class, // IziToast |
| 57 | 57 | ]; |
| 58 | - foreach($aLibraries as $sClass) |
|
| 58 | + foreach ($aLibraries as $sClass) |
|
| 59 | 59 | { |
| 60 | 60 | try |
| 61 | 61 | { |
| 62 | 62 | $xDialog->registerLibrary($sClass, $sClass::NAME); |
| 63 | 63 | } |
| 64 | - catch(SetupException $_){} |
|
| 64 | + catch (SetupException $_) {} |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return $xDialog; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | function register(): void |
| 80 | 80 | { |
| 81 | 81 | // Do nothing if running in cli. |
| 82 | - if(php_sapi_name() !== 'cli') |
|
| 82 | + if (php_sapi_name() !== 'cli') |
|
| 83 | 83 | { |
| 84 | 84 | _register(); |
| 85 | 85 | }; |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | try |
| 61 | 61 | { |
| 62 | 62 | $xDialog->registerLibrary($sClass, $sClass::NAME); |
| 63 | - } |
|
| 64 | - catch(SetupException $_){} |
|
| 63 | + } catch(SetupException $_){} |
|
| 65 | 64 | } |
| 66 | 65 | |
| 67 | 66 | return $xDialog; |