@@ -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 | } |
@@ -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 | } |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | public function initAnnotation(array $properties) |
| 48 | 48 | { |
| 49 | - if(count($properties) !== 0 && (count($properties) !== 1 |
|
| 49 | + if (count($properties) !== 0 && (count($properties) !== 1 |
|
| 50 | 50 | || !isset($properties[0]) || !is_bool($properties[0]))) |
| 51 | 51 | { |
| 52 | 52 | throw new AnnotationException('the @exclude annotation requires a single boolean or no property'); |
@@ -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 | } |
@@ -41,8 +41,7 @@ discard block |
||
| 41 | 41 | public static function parseAnnotation($value) |
| 42 | 42 | { |
| 43 | 43 | $aParams = preg_split('/[\s]+/', $value, 2); |
| 44 | - return count($aParams) === 1 ? ['field' => $aParams[0]] : |
|
| 45 | - ['field' => $aParams[0], 'extra' => $aParams[1]]; |
|
| 44 | + return count($aParams) === 1 ? ['field' => $aParams[0]] : ['field' => $aParams[0], 'extra' => $aParams[1]]; |
|
| 46 | 45 | } |
| 47 | 46 | |
| 48 | 47 | /** |
@@ -51,7 +50,7 @@ discard block |
||
| 51 | 50 | */ |
| 52 | 51 | public function initAnnotation(array $properties) |
| 53 | 52 | { |
| 54 | - if(count($properties) != 1 || !isset($properties['field']) || |
|
| 53 | + if (count($properties) != 1 || !isset($properties['field']) || |
|
| 55 | 54 | !is_string($properties['field'])) |
| 56 | 55 | { |
| 57 | 56 | throw new AnnotationException('The @upload annotation requires a property "field" of type string'); |
@@ -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 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | public static function parseAnnotation($value) |
| 49 | 49 | { |
| 50 | 50 | $aParams = preg_split('/[\s]+/', $value, 2); |
| 51 | - if(count($aParams) === 1) |
|
| 51 | + if (count($aParams) === 1) |
|
| 52 | 52 | { |
| 53 | 53 | return ['call' => rtrim($aParams[0])]; |
| 54 | 54 | } |
@@ -62,23 +62,23 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function initAnnotation(array $properties) |
| 64 | 64 | { |
| 65 | - if(!isset($properties['call']) || !is_string($properties['call'])) |
|
| 65 | + if (!isset($properties['call']) || !is_string($properties['call'])) |
|
| 66 | 66 | { |
| 67 | 67 | throw new AnnotationException('The @' . $this->getType() . |
| 68 | 68 | ' annotation requires a property "call" of type string'); |
| 69 | 69 | } |
| 70 | - foreach(array_keys($properties) as $propName) |
|
| 70 | + foreach (array_keys($properties) as $propName) |
|
| 71 | 71 | { |
| 72 | - if($propName !== 'call' && $propName !== 'with') |
|
| 72 | + if ($propName !== 'call' && $propName !== 'with') |
|
| 73 | 73 | { |
| 74 | 74 | throw new AnnotationException('Unknown property "' . $propName . |
| 75 | 75 | '" in the @' . $this->getType() . ' annotation'); |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | // Cannot use isset here, because it will return false in case $properties['with'] === null |
| 79 | - if(array_key_exists('with', $properties)) |
|
| 79 | + if (array_key_exists('with', $properties)) |
|
| 80 | 80 | { |
| 81 | - if(!is_array($properties['with'])) |
|
| 81 | + if (!is_array($properties['with'])) |
|
| 82 | 82 | { |
| 83 | 83 | throw new AnnotationException('The "with" property of the @' . |
| 84 | 84 | $this->getType() . ' annotation must be of type array'); |
@@ -28,40 +28,40 @@ |
||
| 28 | 28 | */ |
| 29 | 29 | class DataBagAnnotation extends AbstractAnnotation |
| 30 | 30 | { |
| 31 | - /** |
|
| 31 | +/** |
|
| 32 | 32 | * The data bag name |
| 33 | 33 | * |
| 34 | 34 | * @var string |
| 35 | 35 | */ |
| 36 | - protected $sName = ''; |
|
| 36 | +protected $sName = ''; |
|
| 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 @databag annotation requires a property "name" of type string'); |
|
| 56 | - } |
|
| 57 | - $this->sName = $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 @databag annotation requires a property "name" of type string'); |
|
| 56 | +} |
|
| 57 | +$this->sName = $properties['name']; |
|
| 58 | +} |
|
| 59 | 59 | |
| 60 | - /** |
|
| 60 | +/** |
|
| 61 | 61 | * @inheritDoc |
| 62 | 62 | */ |
| 63 | - public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 64 | - { |
|
| 65 | - $xMetadata->databag($sMethod)->addValue($this->sName); |
|
| 66 | - } |
|
| 63 | +public function saveValue(Metadata $xMetadata, string $sMethod = '*'): void |
|
| 64 | +{ |
|
| 65 | +$xMetadata->databag($sMethod)->addValue($this->sName); |
|
| 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 @databag annotation requires a property "name" of type string'); |
| 56 | 56 | } |
@@ -114,21 +114,21 @@ discard block |
||
| 114 | 114 | fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class) |
| 115 | 115 | ); |
| 116 | 116 | // First check if the class is excluded. |
| 117 | - foreach($aAnnotations as $xAnnotation) |
|
| 117 | + foreach ($aAnnotations as $xAnnotation) |
|
| 118 | 118 | { |
| 119 | - if(is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 119 | + if (is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 120 | 120 | { |
| 121 | 121 | $xAnnotation->saveValue($this->xMetadata); |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | - if($this->xMetadata->isExcluded()) |
|
| 124 | + if ($this->xMetadata->isExcluded()) |
|
| 125 | 125 | { |
| 126 | 126 | return; |
| 127 | 127 | } |
| 128 | 128 | |
| 129 | - foreach($aAnnotations as $xAnnotation) |
|
| 129 | + foreach ($aAnnotations as $xAnnotation) |
|
| 130 | 130 | { |
| 131 | - if(!is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 131 | + if (!is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 132 | 132 | { |
| 133 | 133 | $xAnnotation->saveValue($this->xMetadata); |
| 134 | 134 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $this->xManager->getPropertyAnnotations($sClass, $sProperty), |
| 151 | 151 | function($xAnnotation) use($sProperty) { |
| 152 | 152 | // Save the property type |
| 153 | - if(is_a($xAnnotation, VarAnnotation::class)) |
|
| 153 | + if (is_a($xAnnotation, VarAnnotation::class)) |
|
| 154 | 154 | { |
| 155 | 155 | $this->aPropTypes[$sProperty] = $xAnnotation->type; |
| 156 | 156 | } |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | return is_a($xAnnotation, ContainerAnnotation::class); |
| 159 | 159 | } |
| 160 | 160 | ); |
| 161 | - if(count($aAnnotations) > 1) |
|
| 161 | + if (count($aAnnotations) > 1) |
|
| 162 | 162 | { |
| 163 | 163 | throw new AnnotationException('Only one @di annotation is allowed on a property'); |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | - foreach($aAnnotations as $xAnnotation) |
|
| 166 | + foreach ($aAnnotations as $xAnnotation) |
|
| 167 | 167 | { |
| 168 | 168 | $xAnnotation->setAttr($sProperty); |
| 169 | 169 | $xAnnotation->saveValue($this->xMetadata); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $this->xManager->getMethodAnnotations($sClass, $sMethod), |
| 186 | 186 | fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class) |
| 187 | 187 | ); |
| 188 | - foreach($aAnnotations as $xAnnotation) |
|
| 188 | + foreach ($aAnnotations as $xAnnotation) |
|
| 189 | 189 | { |
| 190 | 190 | $xAnnotation->saveValue($this->xMetadata, $sMethod); |
| 191 | 191 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | $this->sCurrMemberType = AnnotationManager::MEMBER_CLASS; |
| 209 | 209 | |
| 210 | 210 | $this->getClassAttrs($sClass); |
| 211 | - if($this->xMetadata->isExcluded()) |
|
| 211 | + if ($this->xMetadata->isExcluded()) |
|
| 212 | 212 | { |
| 213 | 213 | // The entire class is not to be exported. |
| 214 | 214 | return $this->xMetadata; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $this->sCurrMemberType = AnnotationManager::MEMBER_PROPERTY; |
| 219 | 219 | |
| 220 | 220 | // Properties annotations |
| 221 | - foreach($xInput->getProperties() as $sProperty) |
|
| 221 | + foreach ($xInput->getProperties() as $sProperty) |
|
| 222 | 222 | { |
| 223 | 223 | $this->getPropertyAttrs($sClass, $sProperty); |
| 224 | 224 | } |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | // Processing methods annotations |
| 227 | 227 | $this->sCurrMemberType = AnnotationManager::MEMBER_METHOD; |
| 228 | 228 | |
| 229 | - foreach($xInput->getMethods() as $sMethod) |
|
| 229 | + foreach ($xInput->getMethods() as $sMethod) |
|
| 230 | 230 | { |
| 231 | 231 | $this->getMethodAttrs($sClass, $sMethod); |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | return $this->xMetadata; |
| 235 | 235 | } |
| 236 | - catch(AnnotationException $e) |
|
| 236 | + catch (AnnotationException $e) |
|
| 237 | 237 | { |
| 238 | 238 | throw new SetupException($e->getMessage()); |
| 239 | 239 | } |
@@ -232,8 +232,7 @@ |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | return $this->xMetadata; |
| 235 | - } |
|
| 236 | - catch(AnnotationException $e) |
|
| 235 | + } catch(AnnotationException $e) |
|
| 237 | 236 | { |
| 238 | 237 | throw new SetupException($e->getMessage()); |
| 239 | 238 | } |
@@ -36,206 +36,206 @@ |
||
| 36 | 36 | |
| 37 | 37 | class AnnotationReader implements MetadataReaderInterface |
| 38 | 38 | { |
| 39 | - /** |
|
| 39 | +/** |
|
| 40 | 40 | * @var AnnotationManager |
| 41 | 41 | */ |
| 42 | - protected $xManager; |
|
| 42 | +protected $xManager; |
|
| 43 | 43 | |
| 44 | - /** |
|
| 44 | +/** |
|
| 45 | 45 | * @var Metadata |
| 46 | 46 | */ |
| 47 | - protected $xMetadata; |
|
| 47 | +protected $xMetadata; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 49 | +/** |
|
| 50 | 50 | * Properties types, read from the "var" annotations. |
| 51 | 51 | * |
| 52 | 52 | * @var array |
| 53 | 53 | */ |
| 54 | - protected $aPropTypes; |
|
| 54 | +protected $aPropTypes; |
|
| 55 | 55 | |
| 56 | - /** |
|
| 56 | +/** |
|
| 57 | 57 | * The type of the class member being currently processed. |
| 58 | 58 | * |
| 59 | 59 | * @var string |
| 60 | 60 | */ |
| 61 | - protected $sCurrMemberType; |
|
| 61 | +protected $sCurrMemberType; |
|
| 62 | 62 | |
| 63 | - /** |
|
| 63 | +/** |
|
| 64 | 64 | * The constructor |
| 65 | 65 | * |
| 66 | 66 | * @param AnnotationManager $xManager |
| 67 | 67 | */ |
| 68 | - public function __construct(AnnotationManager $xManager) |
|
| 69 | - { |
|
| 70 | - $this->xManager = $xManager; |
|
| 71 | - $this->xManager->registry['upload'] = UploadAnnotation::class; |
|
| 72 | - $this->xManager->registry['databag'] = DataBagAnnotation::class; |
|
| 73 | - $this->xManager->registry['exclude'] = ExcludeAnnotation::class; |
|
| 74 | - $this->xManager->registry['before'] = BeforeAnnotation::class; |
|
| 75 | - $this->xManager->registry['after'] = AfterAnnotation::class; |
|
| 76 | - $this->xManager->registry['di'] = ContainerAnnotation::class; |
|
| 77 | - $this->xManager->registry['callback'] = CallbackAnnotation::class; |
|
| 78 | - // Missing standard annotations. |
|
| 79 | - // We need to define this, otherwise they throw an exception, and make the whole processing fail. |
|
| 80 | - $this->xManager->registry['const'] = false; |
|
| 81 | - $this->xManager->registry['inheritDoc'] = false; |
|
| 82 | - $this->xManager->registry['template'] = false; |
|
| 83 | - $this->xManager->registry['param-closure-this'] = false; |
|
| 84 | - } |
|
| 68 | +public function __construct(AnnotationManager $xManager) |
|
| 69 | +{ |
|
| 70 | +$this->xManager = $xManager; |
|
| 71 | +$this->xManager->registry['upload'] = UploadAnnotation::class; |
|
| 72 | +$this->xManager->registry['databag'] = DataBagAnnotation::class; |
|
| 73 | +$this->xManager->registry['exclude'] = ExcludeAnnotation::class; |
|
| 74 | +$this->xManager->registry['before'] = BeforeAnnotation::class; |
|
| 75 | +$this->xManager->registry['after'] = AfterAnnotation::class; |
|
| 76 | +$this->xManager->registry['di'] = ContainerAnnotation::class; |
|
| 77 | +$this->xManager->registry['callback'] = CallbackAnnotation::class; |
|
| 78 | +// Missing standard annotations. |
|
| 79 | +// We need to define this, otherwise they throw an exception, and make the whole processing fail. |
|
| 80 | +$this->xManager->registry['const'] = false; |
|
| 81 | +$this->xManager->registry['inheritDoc'] = false; |
|
| 82 | +$this->xManager->registry['template'] = false; |
|
| 83 | +$this->xManager->registry['param-closure-this'] = false; |
|
| 84 | +} |
|
| 85 | 85 | |
| 86 | - /** |
|
| 86 | +/** |
|
| 87 | 87 | * @return array |
| 88 | 88 | */ |
| 89 | - public function getPropTypes(): array |
|
| 90 | - { |
|
| 91 | - return $this->aPropTypes; |
|
| 92 | - } |
|
| 89 | +public function getPropTypes(): array |
|
| 90 | +{ |
|
| 91 | +return $this->aPropTypes; |
|
| 92 | +} |
|
| 93 | 93 | |
| 94 | - /** |
|
| 94 | +/** |
|
| 95 | 95 | * @return bool |
| 96 | 96 | */ |
| 97 | - public function annotationIsOnProperty(): bool |
|
| 98 | - { |
|
| 99 | - return $this->sCurrMemberType === AnnotationManager::MEMBER_PROPERTY; |
|
| 100 | - } |
|
| 97 | +public function annotationIsOnProperty(): bool |
|
| 98 | +{ |
|
| 99 | +return $this->sCurrMemberType === AnnotationManager::MEMBER_PROPERTY; |
|
| 100 | +} |
|
| 101 | 101 | |
| 102 | - /** |
|
| 102 | +/** |
|
| 103 | 103 | * @param string $sClass |
| 104 | 104 | * |
| 105 | 105 | * @return void |
| 106 | 106 | * @throws AnnotationException |
| 107 | 107 | */ |
| 108 | - private function getClassAttrs(string $sClass): void |
|
| 109 | - { |
|
| 110 | - // Only keep the annotations declared in this package. |
|
| 111 | - /** @var array<AbstractAnnotation> */ |
|
| 112 | - $aAnnotations = array_filter( |
|
| 113 | - $this->xManager->getClassAnnotations($sClass), |
|
| 114 | - fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class) |
|
| 115 | - ); |
|
| 116 | - // First check if the class is excluded. |
|
| 117 | - foreach($aAnnotations as $xAnnotation) |
|
| 118 | - { |
|
| 119 | - if(is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 120 | - { |
|
| 121 | - $xAnnotation->saveValue($this->xMetadata); |
|
| 122 | - } |
|
| 123 | - } |
|
| 124 | - if($this->xMetadata->isExcluded()) |
|
| 125 | - { |
|
| 126 | - return; |
|
| 127 | - } |
|
| 128 | - |
|
| 129 | - foreach($aAnnotations as $xAnnotation) |
|
| 130 | - { |
|
| 131 | - if(!is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 132 | - { |
|
| 133 | - $xAnnotation->saveValue($this->xMetadata); |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - } |
|
| 108 | +private function getClassAttrs(string $sClass): void |
|
| 109 | +{ |
|
| 110 | +// Only keep the annotations declared in this package. |
|
| 111 | +/** @var array<AbstractAnnotation> */ |
|
| 112 | +$aAnnotations = array_filter( |
|
| 113 | +$this->xManager->getClassAnnotations($sClass), |
|
| 114 | +fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class) |
|
| 115 | +); |
|
| 116 | +// First check if the class is excluded. |
|
| 117 | +foreach($aAnnotations as $xAnnotation) |
|
| 118 | +{ |
|
| 119 | +if(is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 120 | +{ |
|
| 121 | + $xAnnotation->saveValue($this->xMetadata); |
|
| 122 | +} |
|
| 123 | +} |
|
| 124 | +if($this->xMetadata->isExcluded()) |
|
| 125 | +{ |
|
| 126 | +return; |
|
| 127 | +} |
|
| 137 | 128 | |
| 138 | - /** |
|
| 129 | +foreach($aAnnotations as $xAnnotation) |
|
| 130 | +{ |
|
| 131 | +if(!is_a($xAnnotation, ExcludeAnnotation::class)) |
|
| 132 | +{ |
|
| 133 | + $xAnnotation->saveValue($this->xMetadata); |
|
| 134 | +} |
|
| 135 | +} |
|
| 136 | +} |
|
| 137 | + |
|
| 138 | +/** |
|
| 139 | 139 | * @param string $sClass |
| 140 | 140 | * @param string $sProperty |
| 141 | 141 | * |
| 142 | 142 | * @return void |
| 143 | 143 | * @throws AnnotationException |
| 144 | 144 | */ |
| 145 | - private function getPropertyAttrs(string $sClass, string $sProperty): void |
|
| 145 | +private function getPropertyAttrs(string $sClass, string $sProperty): void |
|
| 146 | +{ |
|
| 147 | +/** @var array<ContainerAnnotation> */ |
|
| 148 | +// Only keep the annotations declared in this package. |
|
| 149 | +$aAnnotations = array_filter( |
|
| 150 | +$this->xManager->getPropertyAnnotations($sClass, $sProperty), |
|
| 151 | +function($xAnnotation) use($sProperty) { |
|
| 152 | + // Save the property type |
|
| 153 | + if(is_a($xAnnotation, VarAnnotation::class)) |
|
| 146 | 154 | { |
| 147 | - /** @var array<ContainerAnnotation> */ |
|
| 148 | - // Only keep the annotations declared in this package. |
|
| 149 | - $aAnnotations = array_filter( |
|
| 150 | - $this->xManager->getPropertyAnnotations($sClass, $sProperty), |
|
| 151 | - function($xAnnotation) use($sProperty) { |
|
| 152 | - // Save the property type |
|
| 153 | - if(is_a($xAnnotation, VarAnnotation::class)) |
|
| 154 | - { |
|
| 155 | - $this->aPropTypes[$sProperty] = $xAnnotation->type; |
|
| 156 | - } |
|
| 157 | - // Only container annotations are allowed on properties |
|
| 158 | - return is_a($xAnnotation, ContainerAnnotation::class); |
|
| 159 | - } |
|
| 160 | - ); |
|
| 161 | - if(count($aAnnotations) > 1) |
|
| 162 | - { |
|
| 163 | - throw new AnnotationException('Only one @di annotation is allowed on a property'); |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - foreach($aAnnotations as $xAnnotation) |
|
| 167 | - { |
|
| 168 | - $xAnnotation->setAttr($sProperty); |
|
| 169 | - $xAnnotation->saveValue($this->xMetadata); |
|
| 170 | - } |
|
| 155 | + $this->aPropTypes[$sProperty] = $xAnnotation->type; |
|
| 171 | 156 | } |
| 157 | + // Only container annotations are allowed on properties |
|
| 158 | + return is_a($xAnnotation, ContainerAnnotation::class); |
|
| 159 | +} |
|
| 160 | +); |
|
| 161 | +if(count($aAnnotations) > 1) |
|
| 162 | +{ |
|
| 163 | +throw new AnnotationException('Only one @di annotation is allowed on a property'); |
|
| 164 | +} |
|
| 172 | 165 | |
| 173 | - /** |
|
| 166 | +foreach($aAnnotations as $xAnnotation) |
|
| 167 | +{ |
|
| 168 | +$xAnnotation->setAttr($sProperty); |
|
| 169 | +$xAnnotation->saveValue($this->xMetadata); |
|
| 170 | +} |
|
| 171 | +} |
|
| 172 | + |
|
| 173 | +/** |
|
| 174 | 174 | * @param string $sClass |
| 175 | 175 | * @param string $sMethod |
| 176 | 176 | * |
| 177 | 177 | * @return void |
| 178 | 178 | * @throws AnnotationException |
| 179 | 179 | */ |
| 180 | - private function getMethodAttrs(string $sClass, string $sMethod): void |
|
| 181 | - { |
|
| 182 | - // Only keep the annotations declared in this package. |
|
| 183 | - /** @var array<AbstractAnnotation> */ |
|
| 184 | - $aAnnotations = array_filter( |
|
| 185 | - $this->xManager->getMethodAnnotations($sClass, $sMethod), |
|
| 186 | - fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class) |
|
| 187 | - ); |
|
| 188 | - foreach($aAnnotations as $xAnnotation) |
|
| 189 | - { |
|
| 190 | - $xAnnotation->saveValue($this->xMetadata, $sMethod); |
|
| 191 | - } |
|
| 192 | - } |
|
| 180 | +private function getMethodAttrs(string $sClass, string $sMethod): void |
|
| 181 | +{ |
|
| 182 | +// Only keep the annotations declared in this package. |
|
| 183 | +/** @var array<AbstractAnnotation> */ |
|
| 184 | +$aAnnotations = array_filter( |
|
| 185 | +$this->xManager->getMethodAnnotations($sClass, $sMethod), |
|
| 186 | +fn($xAnnotation) => is_a($xAnnotation, AbstractAnnotation::class) |
|
| 187 | +); |
|
| 188 | +foreach($aAnnotations as $xAnnotation) |
|
| 189 | +{ |
|
| 190 | +$xAnnotation->saveValue($this->xMetadata, $sMethod); |
|
| 191 | +} |
|
| 192 | +} |
|
| 193 | 193 | |
| 194 | - /** |
|
| 194 | +/** |
|
| 195 | 195 | * @inheritDoc |
| 196 | 196 | * @throws SetupException |
| 197 | 197 | */ |
| 198 | - public function getAttributes(InputData $xInput): ?Metadata |
|
| 199 | - { |
|
| 200 | - ContainerAnnotation::$xReader = $this; |
|
| 201 | - $this->aPropTypes = []; |
|
| 202 | - $this->xMetadata = new Metadata(); |
|
| 203 | - $sClass = $xInput->getReflectionClass()->getName(); |
|
| 204 | - |
|
| 205 | - try |
|
| 206 | - { |
|
| 207 | - // Processing class annotations |
|
| 208 | - $this->sCurrMemberType = AnnotationManager::MEMBER_CLASS; |
|
| 209 | - |
|
| 210 | - $this->getClassAttrs($sClass); |
|
| 211 | - if($this->xMetadata->isExcluded()) |
|
| 212 | - { |
|
| 213 | - // The entire class is not to be exported. |
|
| 214 | - return $this->xMetadata; |
|
| 215 | - } |
|
| 216 | - |
|
| 217 | - // Processing properties annotations |
|
| 218 | - $this->sCurrMemberType = AnnotationManager::MEMBER_PROPERTY; |
|
| 219 | - |
|
| 220 | - // Properties annotations |
|
| 221 | - foreach($xInput->getProperties() as $sProperty) |
|
| 222 | - { |
|
| 223 | - $this->getPropertyAttrs($sClass, $sProperty); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - // Processing methods annotations |
|
| 227 | - $this->sCurrMemberType = AnnotationManager::MEMBER_METHOD; |
|
| 228 | - |
|
| 229 | - foreach($xInput->getMethods() as $sMethod) |
|
| 230 | - { |
|
| 231 | - $this->getMethodAttrs($sClass, $sMethod); |
|
| 232 | - } |
|
| 233 | - |
|
| 234 | - return $this->xMetadata; |
|
| 235 | - } |
|
| 236 | - catch(AnnotationException $e) |
|
| 237 | - { |
|
| 238 | - throw new SetupException($e->getMessage()); |
|
| 239 | - } |
|
| 240 | - } |
|
| 198 | +public function getAttributes(InputData $xInput): ?Metadata |
|
| 199 | +{ |
|
| 200 | +ContainerAnnotation::$xReader = $this; |
|
| 201 | +$this->aPropTypes = []; |
|
| 202 | +$this->xMetadata = new Metadata(); |
|
| 203 | +$sClass = $xInput->getReflectionClass()->getName(); |
|
| 204 | + |
|
| 205 | +try |
|
| 206 | +{ |
|
| 207 | +// Processing class annotations |
|
| 208 | +$this->sCurrMemberType = AnnotationManager::MEMBER_CLASS; |
|
| 209 | + |
|
| 210 | +$this->getClassAttrs($sClass); |
|
| 211 | +if($this->xMetadata->isExcluded()) |
|
| 212 | +{ |
|
| 213 | + // The entire class is not to be exported. |
|
| 214 | + return $this->xMetadata; |
|
| 215 | +} |
|
| 216 | + |
|
| 217 | +// Processing properties annotations |
|
| 218 | +$this->sCurrMemberType = AnnotationManager::MEMBER_PROPERTY; |
|
| 219 | + |
|
| 220 | +// Properties annotations |
|
| 221 | +foreach($xInput->getProperties() as $sProperty) |
|
| 222 | +{ |
|
| 223 | + $this->getPropertyAttrs($sClass, $sProperty); |
|
| 224 | +} |
|
| 225 | + |
|
| 226 | +// Processing methods annotations |
|
| 227 | +$this->sCurrMemberType = AnnotationManager::MEMBER_METHOD; |
|
| 228 | + |
|
| 229 | +foreach($xInput->getMethods() as $sMethod) |
|
| 230 | +{ |
|
| 231 | + $this->getMethodAttrs($sClass, $sMethod); |
|
| 232 | +} |
|
| 233 | + |
|
| 234 | +return $this->xMetadata; |
|
| 235 | +} |
|
| 236 | +catch(AnnotationException $e) |
|
| 237 | +{ |
|
| 238 | +throw new SetupException($e->getMessage()); |
|
| 239 | +} |
|
| 240 | +} |
|
| 241 | 241 | } |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | { |
| 25 | 25 | $jaxon = jaxon(); |
| 26 | 26 | $di = $jaxon->di(); |
| 27 | - if($di->h(UploadHandler::class)) |
|
| 27 | + if ($di->h(UploadHandler::class)) |
|
| 28 | 28 | { |
| 29 | 29 | return; |
| 30 | 30 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $xUploadHandler = $di->g(UploadHandler::class); |
| 77 | 77 | // The HTTP request |
| 78 | 78 | $xRequest = $di->getRequest(); |
| 79 | - if($xUploadHandler->canProcessRequest($xRequest)) |
|
| 79 | + if ($xUploadHandler->canProcessRequest($xRequest)) |
|
| 80 | 80 | { |
| 81 | 81 | $xUploadHandler->processRequest($xRequest); |
| 82 | 82 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | { |
| 93 | 93 | $jaxon = jaxon(); |
| 94 | 94 | $jaxon->callback()->boot(function() use($jaxon) { |
| 95 | - if($jaxon->getOption('core.upload.enabled')) |
|
| 95 | + if ($jaxon->getOption('core.upload.enabled')) |
|
| 96 | 96 | { |
| 97 | 97 | registerUpload(); |
| 98 | 98 | } |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | function register() |
| 103 | 103 | { |
| 104 | 104 | // Do nothing if running in cli. |
| 105 | - if(php_sapi_name() !== 'cli') |
|
| 105 | + if (php_sapi_name() !== 'cli') |
|
| 106 | 106 | { |
| 107 | 107 | _register(); |
| 108 | 108 | }; |
@@ -80,8 +80,7 @@ discard block |
||
| 80 | 80 | { |
| 81 | 81 | // Local file system adapter |
| 82 | 82 | $this->registerAdapter('local', function(string $sRootDir, $xOptions) { |
| 83 | - return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) : |
|
| 84 | - new LocalFilesystemAdapter($sRootDir, $xOptions); |
|
| 83 | + return empty($xOptions) ? new LocalFilesystemAdapter($sRootDir) : new LocalFilesystemAdapter($sRootDir, $xOptions); |
|
| 85 | 84 | }); |
| 86 | 85 | |
| 87 | 86 | // In memory file system adapter |
@@ -144,7 +143,7 @@ discard block |
||
| 144 | 143 | public function filesystem(string $sField = ''): Filesystem |
| 145 | 144 | { |
| 146 | 145 | $sField = trim($sField); |
| 147 | - if(isset($this->aFilesystems[$sField])) |
|
| 146 | + if (isset($this->aFilesystems[$sField])) |
|
| 148 | 147 | { |
| 149 | 148 | return $this->aFilesystems[$sField]; |
| 150 | 149 | } |
@@ -154,18 +153,18 @@ discard block |
||
| 154 | 153 | $sRootDir = $this->xConfigManager->getOption('upload.default.dir', ''); |
| 155 | 154 | $aOptions = $this->xConfigManager->getOption('upload.default.options'); |
| 156 | 155 | $sConfigKey = "upload.files.$sField"; |
| 157 | - if($sField !== '' && $this->xConfigManager->hasOption($sConfigKey)) |
|
| 156 | + if ($sField !== '' && $this->xConfigManager->hasOption($sConfigKey)) |
|
| 158 | 157 | { |
| 159 | 158 | $sStorage = $this->xConfigManager->getOption("$sConfigKey.storage", $sStorage); |
| 160 | 159 | $sRootDir = $this->xConfigManager->getOption("$sConfigKey.dir", $sRootDir); |
| 161 | 160 | $aOptions = $this->xConfigManager->getOption("$sConfigKey.options", $aOptions); |
| 162 | 161 | } |
| 163 | 162 | |
| 164 | - if(!is_string($sRootDir)) |
|
| 163 | + if (!is_string($sRootDir)) |
|
| 165 | 164 | { |
| 166 | 165 | throw new RequestException($this->xTranslator->trans('errors.upload.dir')); |
| 167 | 166 | } |
| 168 | - if(!isset($this->aAdapters[$sStorage])) |
|
| 167 | + if (!isset($this->aAdapters[$sStorage])) |
|
| 169 | 168 | { |
| 170 | 169 | throw new RequestException($this->xTranslator->trans('errors.upload.adapter')); |
| 171 | 170 | } |