@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -45,7 +45,7 @@ |
||
| 45 | 45 | $aFiles = scandir($this->sCacheDir); |
| 46 | 46 | foreach ($aFiles as $sFile) |
| 47 | 47 | { |
| 48 | - if($sFile !== '.' && $sFile !== '..') |
|
| 48 | + if ($sFile !== '.' && $sFile !== '..') |
|
| 49 | 49 | { |
| 50 | 50 | @unlink($this->sCacheDir . DIRECTORY_SEPARATOR . $sFile); |
| 51 | 51 | } |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | function register(): void |
| 31 | 31 | { |
| 32 | 32 | // Do nothing if running in cli. |
| 33 | - if(php_sapi_name() !== 'cli') |
|
| 33 | + if (php_sapi_name() !== 'cli') |
|
| 34 | 34 | { |
| 35 | 35 | _register(); |
| 36 | 36 | }; |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | function register(): void |
| 31 | 31 | { |
| 32 | 32 | // Do nothing if running in cli. |
| 33 | - if(php_sapi_name() !== 'cli') |
|
| 33 | + if (php_sapi_name() !== 'cli') |
|
| 34 | 34 | { |
| 35 | 35 | _register(); |
| 36 | 36 | }; |
@@ -139,16 +139,16 @@ discard block |
||
| 139 | 139 | { |
| 140 | 140 | $aProperties = []; |
| 141 | 141 | $aClassProperties = []; |
| 142 | - foreach($this->aAttributes as $sType => $aValues) |
|
| 142 | + foreach ($this->aAttributes as $sType => $aValues) |
|
| 143 | 143 | { |
| 144 | - if($sType === 'exclude') |
|
| 144 | + if ($sType === 'exclude') |
|
| 145 | 145 | { |
| 146 | 146 | continue; |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - foreach($aValues as $sMethod => $xData) |
|
| 149 | + foreach ($aValues as $sMethod => $xData) |
|
| 150 | 150 | { |
| 151 | - if($sMethod === '*') |
|
| 151 | + if ($sMethod === '*') |
|
| 152 | 152 | { |
| 153 | 153 | $aClassProperties[$xData->getName()] = $xData->getValue(); |
| 154 | 154 | continue; |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if(count($aClassProperties) > 0) |
|
| 160 | + if (count($aClassProperties) > 0) |
|
| 161 | 161 | { |
| 162 | 162 | $aProperties['*'] = $aClassProperties; |
| 163 | 163 | } |
@@ -50,8 +50,7 @@ |
||
| 50 | 50 | public function rq(string $sClassName = ''): ?JxnCall |
| 51 | 51 | { |
| 52 | 52 | $sClassName = trim($sClassName); |
| 53 | - return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() : |
|
| 54 | - $this->cdi->getComponentRequestFactory($sClassName); |
|
| 53 | + return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() : $this->cdi->getComponentRequestFactory($sClassName); |
|
| 55 | 54 | } |
| 56 | 55 | |
| 57 | 56 | /** |
@@ -28,18 +28,18 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | class CallFactory |
| 30 | 30 | { |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * The constructor. |
| 33 | 33 | * |
| 34 | 34 | * @param ComponentContainer $cdi |
| 35 | 35 | * @param DialogCommand $xDialogCommand |
| 36 | 36 | */ |
| 37 | - public function __construct(private ComponentContainer $cdi, DialogCommand $xDialogCommand) |
|
| 38 | - { |
|
| 39 | - JsExpr::setDialogCommand($xDialogCommand); |
|
| 40 | - } |
|
| 37 | +public function __construct(private ComponentContainer $cdi, DialogCommand $xDialogCommand) |
|
| 38 | +{ |
|
| 39 | +JsExpr::setDialogCommand($xDialogCommand); |
|
| 40 | +} |
|
| 41 | 41 | |
| 42 | - /** |
|
| 42 | +/** |
|
| 43 | 43 | * Get a factory for a registered class. |
| 44 | 44 | * |
| 45 | 45 | * @param string $sClassName |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | * @return JxnCall|null |
| 48 | 48 | * @throws SetupException |
| 49 | 49 | */ |
| 50 | - public function rq(string $sClassName = ''): ?JxnCall |
|
| 51 | - { |
|
| 52 | - $sClassName = trim($sClassName); |
|
| 53 | - return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() : |
|
| 54 | - $this->cdi->getComponentRequestFactory($sClassName); |
|
| 55 | - } |
|
| 50 | +public function rq(string $sClassName = ''): ?JxnCall |
|
| 51 | +{ |
|
| 52 | +$sClassName = trim($sClassName); |
|
| 53 | +return $sClassName === '' ? $this->cdi->getFunctionRequestFactory() : |
|
| 54 | +$this->cdi->getComponentRequestFactory($sClassName); |
|
| 55 | +} |
|
| 56 | 56 | |
| 57 | - /** |
|
| 57 | +/** |
|
| 58 | 58 | * Get a factory for a Javascript object. |
| 59 | 59 | * |
| 60 | 60 | * @param string $sObject |
@@ -62,17 +62,17 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @return JsObjectCall|null |
| 64 | 64 | */ |
| 65 | - public function jo(string $sObject = '', ?Closure $xExprCb = null): ?JsObjectCall |
|
| 66 | - { |
|
| 67 | - /* |
|
| 65 | +public function jo(string $sObject = '', ?Closure $xExprCb = null): ?JsObjectCall |
|
| 66 | +{ |
|
| 67 | +/* |
|
| 68 | 68 | * The provided closure will be called each time a js expression is created with this factory, |
| 69 | 69 | * with the expression as the only parameter. |
| 70 | 70 | * It is currently used to attach the expression to a Jaxon response. |
| 71 | 71 | */ |
| 72 | - return new JsObjectCall($xExprCb, trim($sObject, " \t")); |
|
| 73 | - } |
|
| 72 | +return new JsObjectCall($xExprCb, trim($sObject, " \t")); |
|
| 73 | +} |
|
| 74 | 74 | |
| 75 | - /** |
|
| 75 | +/** |
|
| 76 | 76 | * Get a factory for a JQuery selector. |
| 77 | 77 | * |
| 78 | 78 | * @param string $sPath The jQuery selector path |
@@ -81,17 +81,17 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return JqSelectorCall |
| 83 | 83 | */ |
| 84 | - public function jq(string $sPath = '', $xContext = null, ?Closure $xExprCb = null): JqSelectorCall |
|
| 85 | - { |
|
| 86 | - /* |
|
| 84 | +public function jq(string $sPath = '', $xContext = null, ?Closure $xExprCb = null): JqSelectorCall |
|
| 85 | +{ |
|
| 86 | +/* |
|
| 87 | 87 | * The provided closure will be called each time a js expression is created with this factory, |
| 88 | 88 | * with the expression as the only parameter. |
| 89 | 89 | * It is currently used to attach the expression to a Jaxon response. |
| 90 | 90 | */ |
| 91 | - return new JqSelectorCall($xExprCb, trim($sPath, " \t"), $xContext); |
|
| 92 | - } |
|
| 91 | +return new JqSelectorCall($xExprCb, trim($sPath, " \t"), $xContext); |
|
| 92 | +} |
|
| 93 | 93 | |
| 94 | - /** |
|
| 94 | +/** |
|
| 95 | 95 | * Get a factory for a Javascript element selector. |
| 96 | 96 | * |
| 97 | 97 | * @param string $sElementId The DOM element id |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | * |
| 100 | 100 | * @return JsSelectorCall |
| 101 | 101 | */ |
| 102 | - public function je(string $sElementId = '', ?Closure $xExprCb = null): JsSelectorCall |
|
| 103 | - { |
|
| 104 | - /* |
|
| 102 | +public function je(string $sElementId = '', ?Closure $xExprCb = null): JsSelectorCall |
|
| 103 | +{ |
|
| 104 | +/* |
|
| 105 | 105 | * The provided closure will be called each time a js expression is created with this factory, |
| 106 | 106 | * with the expression as the only parameter. |
| 107 | 107 | * It is currently used to attach the expression to a Jaxon response. |
| 108 | 108 | */ |
| 109 | - return new JsSelectorCall($xExprCb, trim($sElementId, " \t")); |
|
| 110 | - } |
|
| 109 | +return new JsSelectorCall($xExprCb, trim($sElementId, " \t")); |
|
| 110 | +} |
|
| 111 | 111 | } |
@@ -51,12 +51,12 @@ |
||
| 51 | 51 | $sMetadataVar = '$xMetadata'; |
| 52 | 52 | $sDataVar = '$xData'; |
| 53 | 53 | $aCalls = ["$sMetadataVar = new " . Metadata::class . '();']; |
| 54 | - foreach($xMetadata->getAttributes() as $sType => $aValues) |
|
| 54 | + foreach ($xMetadata->getAttributes() as $sType => $aValues) |
|
| 55 | 55 | { |
| 56 | - foreach($aValues as $sMethod => $xData) |
|
| 56 | + foreach ($aValues as $sMethod => $xData) |
|
| 57 | 57 | { |
| 58 | 58 | $aCalls[] = "$sDataVar = {$sMetadataVar}->{$sType}('{$sMethod}');"; |
| 59 | - foreach($xData->encode($sDataVar) as $sCall) |
|
| 59 | + foreach ($xData->encode($sDataVar) as $sCall) |
|
| 60 | 60 | { |
| 61 | 61 | $aCalls[] = $sCall; |
| 62 | 62 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | protected function validateAttr(string $sAttr): void |
| 53 | 53 | { |
| 54 | - if(preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0) |
|
| 54 | + if (preg_match('/^[a-zA-Z][a-zA-Z0-9_]*$/', $sAttr) > 0) |
|
| 55 | 55 | { |
| 56 | 56 | return; |
| 57 | 57 | } |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | protected function validateClass(string $sClass): void |
| 67 | 67 | { |
| 68 | - if(preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0) |
|
| 68 | + if (preg_match('/^(\\\)?([a-zA-Z][a-zA-Z0-9_]*)(\\\[a-zA-Z][a-zA-Z0-9_]*)*$/', $sClass) > 0) |
|
| 69 | 69 | { |
| 70 | 70 | return; |
| 71 | 71 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | public function encode(string $sVarName): array |
| 93 | 93 | { |
| 94 | 94 | $aCalls = []; |
| 95 | - foreach($this->aProperties as $sAttr => $sClass) |
|
| 95 | + foreach ($this->aProperties as $sAttr => $sClass) |
|
| 96 | 96 | { |
| 97 | 97 | $aCalls[] = "{$sVarName}->addValue('$sAttr', '" . addslashes($sClass) . "');"; |
| 98 | 98 | } |
@@ -16,31 +16,31 @@ |
||
| 16 | 16 | |
| 17 | 17 | class JsCode |
| 18 | 18 | { |
| 19 | - /** |
|
| 19 | +/** |
|
| 20 | 20 | * The main javascript code |
| 21 | 21 | * |
| 22 | 22 | * @var string |
| 23 | 23 | */ |
| 24 | - public $sJs = ''; |
|
| 24 | +public $sJs = ''; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * The js files |
| 28 | 28 | * |
| 29 | 29 | * @var array |
| 30 | 30 | */ |
| 31 | - public $aFiles = []; |
|
| 31 | +public $aFiles = []; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 33 | +/** |
|
| 34 | 34 | * The javascript code to be inserted inline before the main code |
| 35 | 35 | * |
| 36 | 36 | * @var string |
| 37 | 37 | */ |
| 38 | - public $sJsBefore = ''; |
|
| 38 | +public $sJsBefore = ''; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 40 | +/** |
|
| 41 | 41 | * The javascript code to be inserted inline after the main code |
| 42 | 42 | * |
| 43 | 43 | * @var string |
| 44 | 44 | */ |
| 45 | - public $sJsAfter = ''; |
|
| 45 | +public $sJsAfter = ''; |
|
| 46 | 46 | } |