@@ -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 | } |
@@ -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 | } |
@@ -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 | } |
@@ -27,38 +27,38 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class ExcludeAnnotation extends AbstractAnnotation |
| 29 | 29 | { |
| 30 | - /** |
|
| 30 | +/** |
|
| 31 | 31 | * @var bool |
| 32 | 32 | */ |
| 33 | - protected $bValue; |
|
| 33 | +protected $bValue; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 35 | +/** |
|
| 36 | 36 | * @inheritDoc |
| 37 | 37 | */ |
| 38 | - public static function parseAnnotation($value) |
|
| 39 | - { |
|
| 40 | - return [$value === 'true' ? true : ($value === 'false' ? false : $value)]; |
|
| 41 | - } |
|
| 38 | +public static function parseAnnotation($value) |
|
| 39 | +{ |
|
| 40 | +return [$value === 'true' ? true : ($value === 'false' ? false : $value)]; |
|
| 41 | +} |
|
| 42 | 42 | |
| 43 | - /** |
|
| 43 | +/** |
|
| 44 | 44 | * @inheritDoc |
| 45 | 45 | * @throws AnnotationException |
| 46 | 46 | */ |
| 47 | - public function initAnnotation(array $properties) |
|
| 48 | - { |
|
| 49 | - if(count($properties) !== 0 && (count($properties) !== 1 |
|
| 50 | - || !isset($properties[0]) || !is_bool($properties[0]))) |
|
| 51 | - { |
|
| 52 | - throw new AnnotationException('the @exclude annotation requires a single boolean or no property'); |
|
| 53 | - } |
|
| 54 | - $this->bValue = $properties[0] ?? true; |
|
| 55 | - } |
|
| 47 | +public function initAnnotation(array $properties) |
|
| 48 | +{ |
|
| 49 | +if(count($properties) !== 0 && (count($properties) !== 1 |
|
| 50 | +|| !isset($properties[0]) || !is_bool($properties[0]))) |
|
| 51 | +{ |
|
| 52 | +throw new AnnotationException('the @exclude annotation requires a single boolean or no property'); |
|
| 53 | +} |
|
| 54 | +$this->bValue = $properties[0] ?? true; |
|
| 55 | +} |
|
| 56 | 56 | |
| 57 | - /** |
|
| 57 | +/** |
|
| 58 | 58 | * @inheritDoc |
| 59 | 59 | */ |
| 60 | - public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 61 | - { |
|
| 62 | - $xMetadata->exclude($sMethod)->setValue($this->bValue); |
|
| 63 | - } |
|
| 60 | +public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 61 | +{ |
|
| 62 | +$xMetadata->exclude($sMethod)->setValue($this->bValue); |
|
| 63 | +} |
|
| 64 | 64 | } |
@@ -28,42 +28,42 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class UploadAnnotation extends AbstractAnnotation |
| 30 | 30 | { |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * The name of the upload field |
| 33 | 33 | * |
| 34 | 34 | * @var string |
| 35 | 35 | */ |
| 36 | - protected $sField = ''; |
|
| 36 | +protected $sField = ''; |
|
| 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 ? ['field' => $aParams[0]] : |
|
| 45 | - ['field' => $aParams[0], 'extra' => $aParams[1]]; |
|
| 46 | - } |
|
| 41 | +public static function parseAnnotation($value) |
|
| 42 | +{ |
|
| 43 | +$aParams = preg_split('/[\s]+/', $value, 2); |
|
| 44 | +return count($aParams) === 1 ? ['field' => $aParams[0]] : |
|
| 45 | +['field' => $aParams[0], 'extra' => $aParams[1]]; |
|
| 46 | +} |
|
| 47 | 47 | |
| 48 | - /** |
|
| 48 | +/** |
|
| 49 | 49 | * @inheritDoc |
| 50 | 50 | * @throws AnnotationException |
| 51 | 51 | */ |
| 52 | - public function initAnnotation(array $properties) |
|
| 53 | - { |
|
| 54 | - if(count($properties) != 1 || !isset($properties['field']) || |
|
| 55 | - !is_string($properties['field'])) |
|
| 56 | - { |
|
| 57 | - throw new AnnotationException('The @upload annotation requires a property "field" of type string'); |
|
| 58 | - } |
|
| 59 | - $this->sField = $properties['field']; |
|
| 60 | - } |
|
| 52 | +public function initAnnotation(array $properties) |
|
| 53 | +{ |
|
| 54 | +if(count($properties) != 1 || !isset($properties['field']) || |
|
| 55 | +!is_string($properties['field'])) |
|
| 56 | +{ |
|
| 57 | +throw new AnnotationException('The @upload annotation requires a property "field" of type string'); |
|
| 58 | +} |
|
| 59 | +$this->sField = $properties['field']; |
|
| 60 | +} |
|
| 61 | 61 | |
| 62 | - /** |
|
| 62 | +/** |
|
| 63 | 63 | * @inheritDoc |
| 64 | 64 | */ |
| 65 | - public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 66 | - { |
|
| 67 | - $xMetadata->upload($sMethod)->setValue($this->sField); |
|
| 68 | - } |
|
| 65 | +public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 66 | +{ |
|
| 67 | +$xMetadata->upload($sMethod)->setValue($this->sField); |
|
| 68 | +} |
|
| 69 | 69 | } |
@@ -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 | } |