@@ -136,15 +136,13 @@ |
||
| 136 | 136 | if(isset($aMethodAttrs['protected'])) |
| 137 | 137 | { |
| 138 | 138 | $aProtected[] = $sMethod; // The method is not to be exported. |
| 139 | - } |
|
| 140 | - elseif(count($aMethodAttrs) > 0) |
|
| 139 | + } elseif(count($aMethodAttrs) > 0) |
|
| 141 | 140 | { |
| 142 | 141 | $aAttributes[$sMethod] = $aMethodAttrs; |
| 143 | 142 | } |
| 144 | 143 | } |
| 145 | 144 | return [false, $aAttributes, $aProtected]; |
| 146 | - } |
|
| 147 | - catch(AnnotationException $e) |
|
| 145 | + } catch(AnnotationException $e) |
|
| 148 | 146 | { |
| 149 | 147 | throw new SetupException($e->getMessage()); |
| 150 | 148 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | public static function register(Container $di, bool $bForce = false) |
| 71 | 71 | { |
| 72 | - if(!$bForce && $di->h(AnnotationReader::class)) |
|
| 72 | + if (!$bForce && $di->h(AnnotationReader::class)) |
|
| 73 | 73 | { |
| 74 | 74 | return; |
| 75 | 75 | } |
@@ -96,15 +96,15 @@ discard block |
||
| 96 | 96 | }); |
| 97 | 97 | |
| 98 | 98 | $aAttributes = []; |
| 99 | - foreach($aAnnotations as $xAnnotation) |
|
| 99 | + foreach ($aAnnotations as $xAnnotation) |
|
| 100 | 100 | { |
| 101 | 101 | $sName = $xAnnotation->getName(); |
| 102 | - if(isset($aAttributes[$sName])) |
|
| 102 | + if (isset($aAttributes[$sName])) |
|
| 103 | 103 | { |
| 104 | 104 | $xAnnotation->setPrevValue($aAttributes[$sName]); |
| 105 | 105 | } |
| 106 | 106 | $xValue = $xAnnotation->getValue(); |
| 107 | - if($sName === 'protected' && !$xValue) |
|
| 107 | + if ($sName === 'protected' && !$xValue) |
|
| 108 | 108 | { |
| 109 | 109 | continue; // Ignore annotation @exclude with value false |
| 110 | 110 | } |
@@ -128,34 +128,34 @@ discard block |
||
| 128 | 128 | { |
| 129 | 129 | // Class annotations |
| 130 | 130 | $aClassAttrs = $this->filterAnnotations($this->xManager->getClassAnnotations($sClass)); |
| 131 | - if(isset($aClassAttrs['protected'])) |
|
| 131 | + if (isset($aClassAttrs['protected'])) |
|
| 132 | 132 | { |
| 133 | 133 | return [true, [], []]; // The entire class is not to be exported. |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $aProtected = []; |
| 137 | 137 | $aAttributes = []; |
| 138 | - if(count($aClassAttrs) > 0) |
|
| 138 | + if (count($aClassAttrs) > 0) |
|
| 139 | 139 | { |
| 140 | 140 | $aAttributes['*'] = $aClassAttrs; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | // Methods annotations |
| 144 | - foreach($aMethods as $sMethod) |
|
| 144 | + foreach ($aMethods as $sMethod) |
|
| 145 | 145 | { |
| 146 | 146 | $aMethodAttrs = $this->filterAnnotations($this->xManager->getMethodAnnotations($sClass, $sMethod)); |
| 147 | - if(isset($aMethodAttrs['protected'])) |
|
| 147 | + if (isset($aMethodAttrs['protected'])) |
|
| 148 | 148 | { |
| 149 | 149 | $aProtected[] = $sMethod; // The method is not to be exported. |
| 150 | 150 | } |
| 151 | - elseif(count($aMethodAttrs) > 0) |
|
| 151 | + elseif (count($aMethodAttrs) > 0) |
|
| 152 | 152 | { |
| 153 | 153 | $aAttributes[$sMethod] = $aMethodAttrs; |
| 154 | 154 | } |
| 155 | 155 | } |
| 156 | 156 | return [false, $aAttributes, $aProtected]; |
| 157 | 157 | } |
| 158 | - catch(AnnotationException $e) |
|
| 158 | + catch (AnnotationException $e) |
|
| 159 | 159 | { |
| 160 | 160 | throw new SetupException($e->getMessage()); |
| 161 | 161 | } |
@@ -61,11 +61,11 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | public function initAnnotation(array $properties) |
| 63 | 63 | { |
| 64 | - if(count($properties) !== 1 || !isset($properties['name']) || !is_string($properties['name'])) |
|
| 64 | + if (count($properties) !== 1 || !isset($properties['name']) || !is_string($properties['name'])) |
|
| 65 | 65 | { |
| 66 | 66 | throw new AnnotationException('The @databag annotation requires a property "name" of type string'); |
| 67 | 67 | } |
| 68 | - if(!$this->validateDataBagName($properties['name'])) |
|
| 68 | + if (!$this->validateDataBagName($properties['name'])) |
|
| 69 | 69 | { |
| 70 | 70 | throw new AnnotationException($properties['name'] . ' is not a valid "name" value for the @databag annotation'); |
| 71 | 71 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function getValue() |
| 87 | 87 | { |
| 88 | - if(is_array($this->xPrevValue)) |
|
| 88 | + if (is_array($this->xPrevValue)) |
|
| 89 | 89 | { |
| 90 | 90 | $this->xPrevValue[] = $this->sName; // Append the current value to the array |
| 91 | 91 | return $this->xPrevValue; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | public static function parseAnnotation($value) |
| 58 | 58 | { |
| 59 | 59 | $aParams = preg_split("/[\s]+/", $value, 2); |
| 60 | - if(count($aParams) === 1) |
|
| 60 | + if (count($aParams) === 1) |
|
| 61 | 61 | { |
| 62 | 62 | return ['call' => rtrim($aParams[0])]; |
| 63 | 63 | } |
@@ -81,28 +81,28 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function initAnnotation(array $properties) |
| 83 | 83 | { |
| 84 | - if(!isset($properties['call']) || !is_string($properties['call'])) |
|
| 84 | + if (!isset($properties['call']) || !is_string($properties['call'])) |
|
| 85 | 85 | { |
| 86 | 86 | throw new AnnotationException('The @' . $this->getType() . |
| 87 | 87 | ' annotation requires a property "call" of type string'); |
| 88 | 88 | } |
| 89 | - if(!$this->validateMethodName($properties['call'])) |
|
| 89 | + if (!$this->validateMethodName($properties['call'])) |
|
| 90 | 90 | { |
| 91 | 91 | throw new AnnotationException($properties['call'] . |
| 92 | 92 | ' is not a valid "call" value for the @' . $this->getType() . ' annotation'); |
| 93 | 93 | } |
| 94 | - foreach(array_keys($properties) as $propName) |
|
| 94 | + foreach (array_keys($properties) as $propName) |
|
| 95 | 95 | { |
| 96 | - if($propName !== 'call' && $propName !== 'with') |
|
| 96 | + if ($propName !== 'call' && $propName !== 'with') |
|
| 97 | 97 | { |
| 98 | 98 | throw new AnnotationException('Unknown property "' . $propName . |
| 99 | 99 | '" in the @' . $this->getType() . ' annotation'); |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | 102 | // Cannot use isset here, because it will return false in case $properties['with'] === null |
| 103 | - if(array_key_exists('with', $properties)) |
|
| 103 | + if (array_key_exists('with', $properties)) |
|
| 104 | 104 | { |
| 105 | - if(!is_array($properties['with'])) |
|
| 105 | + if (!is_array($properties['with'])) |
|
| 106 | 106 | { |
| 107 | 107 | throw new AnnotationException('The "with" property of the @' . |
| 108 | 108 | $this->getType() . ' annotation must be of type array'); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | public function getValue() |
| 119 | 119 | { |
| 120 | - if(is_array($this->xPrevValue)) |
|
| 120 | + if (is_array($this->xPrevValue)) |
|
| 121 | 121 | { |
| 122 | 122 | // Add the current value to the array |
| 123 | 123 | $this->xPrevValue[$this->sMethodName] = $this->sMethodParams; |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | */ |
| 39 | 39 | public static function parseAnnotation($value) |
| 40 | 40 | { |
| 41 | - if($value === 'true') |
|
| 41 | + if ($value === 'true') |
|
| 42 | 42 | { |
| 43 | 43 | return [true]; |
| 44 | 44 | } |
| 45 | - if($value === 'false') |
|
| 45 | + if ($value === 'false') |
|
| 46 | 46 | { |
| 47 | 47 | return [false]; |
| 48 | 48 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | */ |
| 56 | 56 | public function initAnnotation(array $properties) |
| 57 | 57 | { |
| 58 | - if(count($properties) !== 0 && |
|
| 58 | + if (count($properties) !== 0 && |
|
| 59 | 59 | (count($properties) !== 1 || !isset($properties[0]) || !is_bool($properties[0]))) |
| 60 | 60 | { |
| 61 | 61 | throw new AnnotationException('the @exclude annotation requires a single boolean or no property'); |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | { |
| 68 | 68 | $aParams = preg_split("/[\s]+/", $value, 3); |
| 69 | 69 | $nParamCount = count($aParams); |
| 70 | - if($nParamCount === 1) |
|
| 70 | + if ($nParamCount === 1) |
|
| 71 | 71 | { |
| 72 | 72 | return ['attr' => rtrim($aParams[0])]; |
| 73 | 73 | } |
| 74 | - if($nParamCount === 2) |
|
| 74 | + if ($nParamCount === 2) |
|
| 75 | 75 | { |
| 76 | 76 | return ['attr' => rtrim($aParams[0]), 'class' => $aParams[1]]; |
| 77 | 77 | } |
@@ -104,18 +104,18 @@ discard block |
||
| 104 | 104 | */ |
| 105 | 105 | public function initAnnotation(array $properties) |
| 106 | 106 | { |
| 107 | - if(count($properties) != 2 || |
|
| 107 | + if (count($properties) != 2 || |
|
| 108 | 108 | !isset($properties['attr']) || !is_string($properties['attr']) || |
| 109 | 109 | !isset($properties['class']) || !is_string($properties['class'])) |
| 110 | 110 | { |
| 111 | 111 | throw new AnnotationException('The @di annotation requires a property "attr" of type string ' . |
| 112 | 112 | 'and a property "class" of type string'); |
| 113 | 113 | } |
| 114 | - if(!$this->validateAttrName($properties['attr'])) |
|
| 114 | + if (!$this->validateAttrName($properties['attr'])) |
|
| 115 | 115 | { |
| 116 | 116 | throw new AnnotationException($properties['attr'] . ' is not a valid "attr" value for the @di annotation'); |
| 117 | 117 | } |
| 118 | - if(!$this->validateClassName($properties['class'])) |
|
| 118 | + if (!$this->validateClassName($properties['class'])) |
|
| 119 | 119 | { |
| 120 | 120 | throw new AnnotationException($properties['class'] . ' is not a valid "class" value for the @di annotation'); |
| 121 | 121 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | */ |
| 137 | 137 | public function getValue() |
| 138 | 138 | { |
| 139 | - if(is_array($this->xPrevValue)) |
|
| 139 | + if (is_array($this->xPrevValue)) |
|
| 140 | 140 | { |
| 141 | 141 | $this->xPrevValue[$this->sAttr] = $this->sClass; // Append the current value to the array |
| 142 | 142 | return $this->xPrevValue; |
@@ -60,11 +60,11 @@ discard block |
||
| 60 | 60 | */ |
| 61 | 61 | public function initAnnotation(array $properties) |
| 62 | 62 | { |
| 63 | - if(count($properties) != 1 || !isset($properties['field']) || !is_string($properties['field'])) |
|
| 63 | + if (count($properties) != 1 || !isset($properties['field']) || !is_string($properties['field'])) |
|
| 64 | 64 | { |
| 65 | 65 | throw new AnnotationException('The @upload annotation requires a property "field" of type string'); |
| 66 | 66 | } |
| 67 | - if(!$this->validateUploadField($properties['field'])) |
|
| 67 | + if (!$this->validateUploadField($properties['field'])) |
|
| 68 | 68 | { |
| 69 | 69 | throw new AnnotationException($properties['field'] . ' is not a valid "field" value for the @upload annotation'); |
| 70 | 70 | } |
@@ -84,6 +84,6 @@ discard block |
||
| 84 | 84 | */ |
| 85 | 85 | public function getValue() |
| 86 | 86 | { |
| 87 | - return "'" . $this->sField . "'" ; // The field id is surrounded with simple quotes. |
|
| 87 | + return "'" . $this->sField . "'"; // The field id is surrounded with simple quotes. |
|
| 88 | 88 | } |
| 89 | 89 | } |