@@ -35,13 +35,13 @@ |
||
| 35 | 35 | public static function read(string $sConfigFile): array |
| 36 | 36 | { |
| 37 | 37 | $sConfigFile = realpath($sConfigFile); |
| 38 | - if(!is_readable($sConfigFile)) |
|
| 38 | + if (!is_readable($sConfigFile)) |
|
| 39 | 39 | { |
| 40 | 40 | throw new FileAccess($sConfigFile); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | $aConfigOptions = include($sConfigFile); |
| 44 | - if(!is_array($aConfigOptions)) |
|
| 44 | + if (!is_array($aConfigOptions)) |
|
| 45 | 45 | { |
| 46 | 46 | throw new FileContent($sConfigFile); |
| 47 | 47 | } |
@@ -38,19 +38,19 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public static function read(string $sConfigFile): array |
| 40 | 40 | { |
| 41 | - if(!extension_loaded('yaml')) |
|
| 41 | + if (!extension_loaded('yaml')) |
|
| 42 | 42 | { |
| 43 | 43 | throw new YamlExtension(); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $sConfigFile = realpath($sConfigFile); |
| 47 | - if(!is_readable($sConfigFile)) |
|
| 47 | + if (!is_readable($sConfigFile)) |
|
| 48 | 48 | { |
| 49 | 49 | throw new FileAccess($sConfigFile); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $aConfigOptions = yaml_parse_file($sConfigFile); |
| 53 | - if(!is_array($aConfigOptions)) |
|
| 53 | + if (!is_array($aConfigOptions)) |
|
| 54 | 54 | { |
| 55 | 55 | throw new FileContent($sConfigFile); |
| 56 | 56 | } |
@@ -37,14 +37,14 @@ |
||
| 37 | 37 | public static function read(string $sConfigFile): array |
| 38 | 38 | { |
| 39 | 39 | $sConfigFile = realpath($sConfigFile); |
| 40 | - if(!is_readable($sConfigFile)) |
|
| 40 | + if (!is_readable($sConfigFile)) |
|
| 41 | 41 | { |
| 42 | 42 | throw new FileAccess($sConfigFile); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | $sFileContent = file_get_contents($sConfigFile); |
| 46 | 46 | $aConfigOptions = json_decode($sFileContent, true); |
| 47 | - if(!is_array($aConfigOptions)) |
|
| 47 | + if (!is_array($aConfigOptions)) |
|
| 48 | 48 | { |
| 49 | 49 | throw new FileContent($sConfigFile); |
| 50 | 50 | } |
@@ -44,8 +44,7 @@ discard block |
||
| 44 | 44 | public function newConfig(array $aOptions = [], |
| 45 | 45 | string $sNamePrefix = '', string $sValuePrefix = ''): Config |
| 46 | 46 | { |
| 47 | - return count($aOptions) === 0 ? new Config() : |
|
| 48 | - $this->setOptions(new Config(), $aOptions, $sNamePrefix, $sValuePrefix); |
|
| 47 | + return count($aOptions) === 0 ? new Config() : $this->setOptions(new Config(), $aOptions, $sNamePrefix, $sValuePrefix); |
|
| 49 | 48 | } |
| 50 | 49 | |
| 51 | 50 | /** |
@@ -77,7 +76,7 @@ discard block |
||
| 77 | 76 | $xValue = $xOptionValue; |
| 78 | 77 | $sLastName = ''; |
| 79 | 78 | $aNames = Value::explodeName($sOptionName); |
| 80 | - while($this->pop($sLastName, $aNames) > 0) |
|
| 79 | + while ($this->pop($sLastName, $aNames) > 0) |
|
| 81 | 80 | { |
| 82 | 81 | $sName = implode('.', $aNames); |
| 83 | 82 | // The current value is overwritten if it is not an array of options. |
@@ -121,15 +120,15 @@ discard block |
||
| 121 | 120 | string $sNamePrefix = '', int $nDepth = 0): array |
| 122 | 121 | { |
| 123 | 122 | // Check the max depth |
| 124 | - if($nDepth < 0 || $nDepth > 9) |
|
| 123 | + if ($nDepth < 0 || $nDepth > 9) |
|
| 125 | 124 | { |
| 126 | 125 | throw new DataDepth($sNamePrefix, $nDepth); |
| 127 | 126 | } |
| 128 | 127 | |
| 129 | - foreach($aOptions as $sName => $xValue) |
|
| 128 | + foreach ($aOptions as $sName => $xValue) |
|
| 130 | 129 | { |
| 131 | 130 | $sName = trim($sName); |
| 132 | - if(!Value::containsOptions($xValue)) |
|
| 131 | + if (!Value::containsOptions($xValue)) |
|
| 133 | 132 | { |
| 134 | 133 | // Save the value of this option |
| 135 | 134 | $aValues = $this->setValue($aValues, $sNamePrefix . $sName, $xValue); |
@@ -160,11 +159,11 @@ discard block |
||
| 160 | 159 | // Find the config array in the input data |
| 161 | 160 | $sValuePrefix = trim($sValuePrefix, ' .'); |
| 162 | 161 | $aKeys = Value::explodeName($sValuePrefix); |
| 163 | - foreach($aKeys as $sKey) |
|
| 162 | + foreach ($aKeys as $sKey) |
|
| 164 | 163 | { |
| 165 | - if(($sKey)) |
|
| 164 | + if (($sKey)) |
|
| 166 | 165 | { |
| 167 | - if(!isset($aOptions[$sKey]) || !is_array($aOptions[$sKey])) |
|
| 166 | + if (!isset($aOptions[$sKey]) || !is_array($aOptions[$sKey])) |
|
| 168 | 167 | { |
| 169 | 168 | // No change if the required key is not found. |
| 170 | 169 | return new Config($xConfig->getValues(), false); |
@@ -175,7 +174,7 @@ discard block |
||
| 175 | 174 | } |
| 176 | 175 | |
| 177 | 176 | $sNamePrefix = trim($sNamePrefix, ' .'); |
| 178 | - if(($sNamePrefix)) |
|
| 177 | + if (($sNamePrefix)) |
|
| 179 | 178 | { |
| 180 | 179 | $sNamePrefix .= '.'; |
| 181 | 180 | } |
@@ -204,7 +203,7 @@ discard block |
||
| 204 | 203 | private function deleteEntries(array $aValues, string $sName): array |
| 205 | 204 | { |
| 206 | 205 | $sName = rtrim($sName, '.'); |
| 207 | - if(!array_key_exists($sName, $aValues)) |
|
| 206 | + if (!array_key_exists($sName, $aValues)) |
|
| 208 | 207 | { |
| 209 | 208 | return $aValues; |
| 210 | 209 | } |
@@ -229,7 +228,7 @@ discard block |
||
| 229 | 228 | { |
| 230 | 229 | $aValues = $xConfig->getValues(); |
| 231 | 230 | $nEntryCount = count($aValues); |
| 232 | - foreach($aNames as $sName) |
|
| 231 | + foreach ($aNames as $sName) |
|
| 233 | 232 | { |
| 234 | 233 | $aValues = $this->deleteEntries($aValues, $sName); |
| 235 | 234 | } |
@@ -38,13 +38,13 @@ |
||
| 38 | 38 | */ |
| 39 | 39 | public function read(string $sConfigFile): array |
| 40 | 40 | { |
| 41 | - if(!($sConfigFile = trim($sConfigFile))) |
|
| 41 | + if (!($sConfigFile = trim($sConfigFile))) |
|
| 42 | 42 | { |
| 43 | 43 | return []; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
| 47 | - switch($sExt) |
|
| 47 | + switch ($sExt) |
|
| 48 | 48 | { |
| 49 | 49 | case 'php': |
| 50 | 50 | $aConfigOptions = Reader\PhpReader::read($sConfigFile); |
@@ -19,13 +19,13 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | class ConfigReader |
| 21 | 21 | { |
| 22 | - /** |
|
| 22 | +/** |
|
| 23 | 23 | * @param ConfigSetter $xConfigSetter |
| 24 | 24 | */ |
| 25 | - public function __construct(private ConfigSetter $xConfigSetter) |
|
| 26 | - {} |
|
| 25 | +public function __construct(private ConfigSetter $xConfigSetter) |
|
| 26 | +{} |
|
| 27 | 27 | |
| 28 | - /** |
|
| 28 | +/** |
|
| 29 | 29 | * Read options from a config file to an array |
| 30 | 30 | * |
| 31 | 31 | * @param string $sConfigFile The full path to the config file |
@@ -36,29 +36,29 @@ discard block |
||
| 36 | 36 | * @throws Exception\FileContent |
| 37 | 37 | * @throws Exception\YamlExtension |
| 38 | 38 | */ |
| 39 | - public function read(string $sConfigFile): array |
|
| 40 | - { |
|
| 41 | - if(!($sConfigFile = trim($sConfigFile))) |
|
| 42 | - { |
|
| 43 | - return []; |
|
| 44 | - } |
|
| 39 | +public function read(string $sConfigFile): array |
|
| 40 | +{ |
|
| 41 | +if(!($sConfigFile = trim($sConfigFile))) |
|
| 42 | +{ |
|
| 43 | +return []; |
|
| 44 | +} |
|
| 45 | 45 | |
| 46 | - $sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
|
| 47 | - switch($sExt) |
|
| 48 | - { |
|
| 49 | - case 'php': |
|
| 50 | - $aConfigOptions = Reader\PhpReader::read($sConfigFile); |
|
| 51 | - break; |
|
| 52 | - case 'yaml': |
|
| 53 | - case 'yml': |
|
| 54 | - $aConfigOptions = Reader\YamlReader::read($sConfigFile); |
|
| 55 | - break; |
|
| 56 | - case 'json': |
|
| 57 | - $aConfigOptions = Reader\JsonReader::read($sConfigFile); |
|
| 58 | - break; |
|
| 59 | - default: |
|
| 60 | - throw new Exception\FileExtension($sConfigFile); |
|
| 61 | - } |
|
| 46 | +$sExt = pathinfo($sConfigFile, PATHINFO_EXTENSION); |
|
| 47 | +switch($sExt) |
|
| 48 | +{ |
|
| 49 | +case 'php': |
|
| 50 | +$aConfigOptions = Reader\PhpReader::read($sConfigFile); |
|
| 51 | +break; |
|
| 52 | +case 'yaml': |
|
| 53 | +case 'yml': |
|
| 54 | +$aConfigOptions = Reader\YamlReader::read($sConfigFile); |
|
| 55 | +break; |
|
| 56 | +case 'json': |
|
| 57 | +$aConfigOptions = Reader\JsonReader::read($sConfigFile); |
|
| 58 | +break; |
|
| 59 | +default: |
|
| 60 | +throw new Exception\FileExtension($sConfigFile); |
|
| 61 | +} |
|
| 62 | 62 | |
| 63 | 63 | return $aConfigOptions; |
| 64 | 64 | } |
@@ -175,62 +175,62 @@ |
||
| 175 | 175 | 0 => true, |
| 176 | 176 | 1 => isset($this->properties['attr']) || isset($this->properties['class']), |
| 177 | 177 | 2 => isset($this->properties['attr']) && isset($this->properties['class']), |
| 178 | - default => false, |
|
| 179 | - }; |
|
| 180 | - } |
|
| 178 | +default => false, |
|
| 179 | +}; |
|
| 180 | +} |
|
| 181 | 181 | |
| 182 | - /** |
|
| 182 | +/** |
|
| 183 | 183 | * @return void |
| 184 | 184 | * @throws AnnotationException |
| 185 | 185 | */ |
| 186 | - private function parseProperties() |
|
| 187 | - { |
|
| 188 | - if(!$this->checkPropertiesNames()) |
|
| 189 | - { |
|
| 190 | - throw new AnnotationException('The @di annotation accepts only "attr" or "class" as properties'); |
|
| 191 | - } |
|
| 186 | +private function parseProperties() |
|
| 187 | +{ |
|
| 188 | +if(!$this->checkPropertiesNames()) |
|
| 189 | +{ |
|
| 190 | +throw new AnnotationException('The @di annotation accepts only "attr" or "class" as properties'); |
|
| 191 | +} |
|
| 192 | 192 | |
| 193 | - if(isset($this->properties['attr'])) |
|
| 194 | - { |
|
| 195 | - if(self::$xReader->annotationIsOnProperty()) |
|
| 196 | - { |
|
| 197 | - throw new AnnotationException('The @di annotation does not allow the "attr" property on class attributes'); |
|
| 198 | - } |
|
| 199 | - if(!is_string($this->properties['attr'])) |
|
| 200 | - { |
|
| 201 | - throw new AnnotationException('The @di annotation requires a property "attr" of type string'); |
|
| 202 | - } |
|
| 203 | - $this->sAttr = $this->properties['attr']; |
|
| 204 | - } |
|
| 205 | - if(isset($this->properties['class'])) |
|
| 206 | - { |
|
| 207 | - if(!is_string($this->properties['class'])) |
|
| 208 | - { |
|
| 209 | - throw new AnnotationException('The @di annotation requires a property "class" of type string'); |
|
| 210 | - } |
|
| 211 | - $this->sClass = $this->getFullClassName($this->properties['class']); |
|
| 212 | - } |
|
| 213 | - } |
|
| 193 | +if(isset($this->properties['attr'])) |
|
| 194 | +{ |
|
| 195 | +if(self::$xReader->annotationIsOnProperty()) |
|
| 196 | +{ |
|
| 197 | + throw new AnnotationException('The @di annotation does not allow the "attr" property on class attributes'); |
|
| 198 | +} |
|
| 199 | +if(!is_string($this->properties['attr'])) |
|
| 200 | +{ |
|
| 201 | + throw new AnnotationException('The @di annotation requires a property "attr" of type string'); |
|
| 202 | +} |
|
| 203 | +$this->sAttr = $this->properties['attr']; |
|
| 204 | +} |
|
| 205 | +if(isset($this->properties['class'])) |
|
| 206 | +{ |
|
| 207 | +if(!is_string($this->properties['class'])) |
|
| 208 | +{ |
|
| 209 | + throw new AnnotationException('The @di annotation requires a property "class" of type string'); |
|
| 210 | +} |
|
| 211 | +$this->sClass = $this->getFullClassName($this->properties['class']); |
|
| 212 | +} |
|
| 213 | +} |
|
| 214 | 214 | |
| 215 | - /** |
|
| 215 | +/** |
|
| 216 | 216 | * @inheritDoc |
| 217 | 217 | */ |
| 218 | - public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 219 | - { |
|
| 220 | - isset($this->properties['__value__']) ? $this->parseValue() : $this->parseProperties(); |
|
| 218 | +public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 219 | +{ |
|
| 220 | +isset($this->properties['__value__']) ? $this->parseValue() : $this->parseProperties(); |
|
| 221 | 221 | |
| 222 | - // The type in the @di annotations can be set from the values in the @var annotations |
|
| 223 | - $aPropTypes = self::$xReader->getPropTypes(); |
|
| 224 | - if($this->sClass === '') |
|
| 225 | - { |
|
| 226 | - if(!isset($aPropTypes[$this->sAttr])) |
|
| 227 | - { |
|
| 228 | - throw new AnnotationException('No class defined for @di on attribute "' . |
|
| 229 | - $this->sAttr . '".'); |
|
| 230 | - } |
|
| 231 | - $this->sClass = ltrim($aPropTypes[$this->sAttr], '\\'); |
|
| 232 | - } |
|
| 222 | +// The type in the @di annotations can be set from the values in the @var annotations |
|
| 223 | +$aPropTypes = self::$xReader->getPropTypes(); |
|
| 224 | +if($this->sClass === '') |
|
| 225 | +{ |
|
| 226 | +if(!isset($aPropTypes[$this->sAttr])) |
|
| 227 | +{ |
|
| 228 | + throw new AnnotationException('No class defined for @di on attribute "' . |
|
| 229 | + $this->sAttr . '".'); |
|
| 230 | +} |
|
| 231 | +$this->sClass = ltrim($aPropTypes[$this->sAttr], '\\'); |
|
| 232 | +} |
|
| 233 | 233 | |
| 234 | - $xMetadata->container($sMethod)->addValue($this->sAttr, $this->sClass); |
|
| 235 | - } |
|
| 234 | +$xMetadata->container($sMethod)->addValue($this->sAttr, $this->sClass); |
|
| 235 | +} |
|
| 236 | 236 | } |
@@ -122,38 +122,38 @@ discard block |
||
| 122 | 122 | $value = $this->properties['__value__']; |
| 123 | 123 | $aParams = preg_split('/[\s]+/', $value, 3); |
| 124 | 124 | $nParamCount = count($aParams); |
| 125 | - if($nParamCount === 1) |
|
| 125 | + if ($nParamCount === 1) |
|
| 126 | 126 | { |
| 127 | 127 | // For a property, the only parameter is the class. Otherwise, it is the attribute. |
| 128 | - if(self::$xReader->annotationIsOnProperty()) |
|
| 128 | + if (self::$xReader->annotationIsOnProperty()) |
|
| 129 | 129 | { |
| 130 | - if(substr($aParams[0], 0, 1) === '$') |
|
| 130 | + if (substr($aParams[0], 0, 1) === '$') |
|
| 131 | 131 | { |
| 132 | 132 | throw new AnnotationException('The only property of the @di annotation must be a class name'); |
| 133 | 133 | } |
| 134 | 134 | $this->sClass = $this->getFullClassName($aParams[0]); |
| 135 | 135 | return; |
| 136 | 136 | } |
| 137 | - if(substr($aParams[0], 0, 1) !== '$') |
|
| 137 | + if (substr($aParams[0], 0, 1) !== '$') |
|
| 138 | 138 | { |
| 139 | 139 | throw new AnnotationException('The only property of the @di annotation must be a var name'); |
| 140 | 140 | } |
| 141 | 141 | $this->sAttr = substr($aParams[0], 1); |
| 142 | 142 | return; |
| 143 | 143 | } |
| 144 | - if($nParamCount === 2) |
|
| 144 | + if ($nParamCount === 2) |
|
| 145 | 145 | { |
| 146 | 146 | // For a property, having 2 parameters is not allowed. |
| 147 | - if(self::$xReader->annotationIsOnProperty()) |
|
| 147 | + if (self::$xReader->annotationIsOnProperty()) |
|
| 148 | 148 | { |
| 149 | 149 | throw new AnnotationException('The @di annotation accepts only one property on a class attribute'); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if(substr($aParams[0], 0, 1) !== '$') |
|
| 152 | + if (substr($aParams[0], 0, 1) !== '$') |
|
| 153 | 153 | { |
| 154 | 154 | throw new AnnotationException('The only property of the @di annotation must be a var name'); |
| 155 | 155 | } |
| 156 | - if(substr($aParams[1], 0, 1) === '$') |
|
| 156 | + if (substr($aParams[1], 0, 1) === '$') |
|
| 157 | 157 | { |
| 158 | 158 | throw new AnnotationException('The first property of the @di annotation must be a class name'); |
| 159 | 159 | } |
@@ -185,26 +185,26 @@ discard block |
||
| 185 | 185 | */ |
| 186 | 186 | private function parseProperties() |
| 187 | 187 | { |
| 188 | - if(!$this->checkPropertiesNames()) |
|
| 188 | + if (!$this->checkPropertiesNames()) |
|
| 189 | 189 | { |
| 190 | 190 | throw new AnnotationException('The @di annotation accepts only "attr" or "class" as properties'); |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - if(isset($this->properties['attr'])) |
|
| 193 | + if (isset($this->properties['attr'])) |
|
| 194 | 194 | { |
| 195 | - if(self::$xReader->annotationIsOnProperty()) |
|
| 195 | + if (self::$xReader->annotationIsOnProperty()) |
|
| 196 | 196 | { |
| 197 | 197 | throw new AnnotationException('The @di annotation does not allow the "attr" property on class attributes'); |
| 198 | 198 | } |
| 199 | - if(!is_string($this->properties['attr'])) |
|
| 199 | + if (!is_string($this->properties['attr'])) |
|
| 200 | 200 | { |
| 201 | 201 | throw new AnnotationException('The @di annotation requires a property "attr" of type string'); |
| 202 | 202 | } |
| 203 | 203 | $this->sAttr = $this->properties['attr']; |
| 204 | 204 | } |
| 205 | - if(isset($this->properties['class'])) |
|
| 205 | + if (isset($this->properties['class'])) |
|
| 206 | 206 | { |
| 207 | - if(!is_string($this->properties['class'])) |
|
| 207 | + if (!is_string($this->properties['class'])) |
|
| 208 | 208 | { |
| 209 | 209 | throw new AnnotationException('The @di annotation requires a property "class" of type string'); |
| 210 | 210 | } |
@@ -221,9 +221,9 @@ discard block |
||
| 221 | 221 | |
| 222 | 222 | // The type in the @di annotations can be set from the values in the @var annotations |
| 223 | 223 | $aPropTypes = self::$xReader->getPropTypes(); |
| 224 | - if($this->sClass === '') |
|
| 224 | + if ($this->sClass === '') |
|
| 225 | 225 | { |
| 226 | - if(!isset($aPropTypes[$this->sAttr])) |
|
| 226 | + if (!isset($aPropTypes[$this->sAttr])) |
|
| 227 | 227 | { |
| 228 | 228 | throw new AnnotationException('No class defined for @di on attribute "' . |
| 229 | 229 | $this->sAttr . '".'); |
@@ -23,19 +23,19 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class AfterAnnotation extends HookAnnotation |
| 25 | 25 | { |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * @inheritDoc |
| 28 | 28 | */ |
| 29 | - protected static function getType(): string |
|
| 30 | - { |
|
| 31 | - return 'after'; |
|
| 32 | - } |
|
| 29 | +protected static function getType(): string |
|
| 30 | +{ |
|
| 31 | +return 'after'; |
|
| 32 | +} |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @inheritDoc |
| 36 | 36 | */ |
| 37 | - public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 38 | - { |
|
| 39 | - $xMetadata->after($sMethod)->addCall($this->sMethod, $this->aParams); |
|
| 40 | - } |
|
| 37 | +public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 38 | +{ |
|
| 39 | +$xMetadata->after($sMethod)->addCall($this->sMethod, $this->aParams); |
|
| 40 | +} |
|
| 41 | 41 | } |
@@ -28,40 +28,40 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class CallbackAnnotation extends AbstractAnnotation |
| 30 | 30 | { |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * The javascript object name |
| 33 | 33 | * |
| 34 | 34 | * @var string |
| 35 | 35 | */ |
| 36 | - protected $sJsObject; |
|
| 36 | +protected $sJsObject; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 38 | +/** |
|
| 39 | 39 | * @inheritDoc |
| 40 | 40 | */ |
| 41 | - public static function parseAnnotation($value) |
|
| 42 | - { |
|
| 43 | - $aParams = preg_split('/[\s]+/', $value, 2); |
|
| 44 | - return count($aParams) === 1 ? ['name' => $aParams[0]] : ['name' => $aParams[0], 'extra' => $aParams[1]]; |
|
| 45 | - } |
|
| 41 | +public static function parseAnnotation($value) |
|
| 42 | +{ |
|
| 43 | +$aParams = preg_split('/[\s]+/', $value, 2); |
|
| 44 | +return count($aParams) === 1 ? ['name' => $aParams[0]] : ['name' => $aParams[0], 'extra' => $aParams[1]]; |
|
| 45 | +} |
|
| 46 | 46 | |
| 47 | - /** |
|
| 47 | +/** |
|
| 48 | 48 | * @inheritDoc |
| 49 | 49 | * @throws AnnotationException |
| 50 | 50 | */ |
| 51 | - public function initAnnotation(array $properties) |
|
| 52 | - { |
|
| 53 | - if(count($properties) !== 1 || !isset($properties['name']) || !is_string($properties['name'])) |
|
| 54 | - { |
|
| 55 | - throw new AnnotationException('the @callback annotation requires a single string as property'); |
|
| 56 | - } |
|
| 57 | - $this->sJsObject = $properties['name']; |
|
| 58 | - } |
|
| 51 | +public function initAnnotation(array $properties) |
|
| 52 | +{ |
|
| 53 | +if(count($properties) !== 1 || !isset($properties['name']) || !is_string($properties['name'])) |
|
| 54 | +{ |
|
| 55 | +throw new AnnotationException('the @callback annotation requires a single string as property'); |
|
| 56 | +} |
|
| 57 | +$this->sJsObject = $properties['name']; |
|
| 58 | +} |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | +/** |
|
| 61 | 61 | * @inheritDoc |
| 62 | 62 | */ |
| 63 | - public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 64 | - { |
|
| 65 | - $xMetadata->callback($sMethod)->addValue($this->sJsObject); |
|
| 66 | - } |
|
| 63 | +public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 64 | +{ |
|
| 65 | +$xMetadata->callback($sMethod)->addValue($this->sJsObject); |
|
| 66 | +} |
|
| 67 | 67 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public function initAnnotation(array $properties) |
| 52 | 52 | { |
| 53 | - if(count($properties) !== 1 || !isset($properties['name']) || !is_string($properties['name'])) |
|
| 53 | + if (count($properties) !== 1 || !isset($properties['name']) || !is_string($properties['name'])) |
|
| 54 | 54 | { |
| 55 | 55 | throw new AnnotationException('the @callback annotation requires a single string as property'); |
| 56 | 56 | } |
@@ -23,19 +23,19 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | class BeforeAnnotation extends HookAnnotation |
| 25 | 25 | { |
| 26 | - /** |
|
| 26 | +/** |
|
| 27 | 27 | * @inheritDoc |
| 28 | 28 | */ |
| 29 | - protected static function getType(): string |
|
| 30 | - { |
|
| 31 | - return 'before'; |
|
| 32 | - } |
|
| 29 | +protected static function getType(): string |
|
| 30 | +{ |
|
| 31 | +return 'before'; |
|
| 32 | +} |
|
| 33 | 33 | |
| 34 | - /** |
|
| 34 | +/** |
|
| 35 | 35 | * @inheritDoc |
| 36 | 36 | */ |
| 37 | - public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 38 | - { |
|
| 39 | - $xMetadata->before($sMethod)->addCall($this->sMethod, $this->aParams); |
|
| 40 | - } |
|
| 37 | +public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 38 | +{ |
|
| 39 | +$xMetadata->before($sMethod)->addCall($this->sMethod, $this->aParams); |
|
| 40 | +} |
|
| 41 | 41 | } |