@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function initAnnotation(array $properties) |
41 | 41 | { |
42 | - if(count($properties) != 1 || !isset($properties['name']) || !is_string($properties['name'])) |
|
42 | + if (count($properties) != 1 || !isset($properties['name']) || !is_string($properties['name'])) |
|
43 | 43 | { |
44 | 44 | throw new AnnotationException('The @databag annotation requires a property "name" of type string'); |
45 | 45 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getValue() |
61 | 61 | { |
62 | - if(is_array($this->xPrevValue)) |
|
62 | + if (is_array($this->xPrevValue)) |
|
63 | 63 | { |
64 | 64 | $this->xPrevValue[] = $this->sName; // Append the current value to the array |
65 | 65 | return $this->xPrevValue; |
@@ -38,7 +38,7 @@ |
||
38 | 38 | */ |
39 | 39 | public function initAnnotation(array $properties) |
40 | 40 | { |
41 | - if(count($properties) !== 0 && |
|
41 | + if (count($properties) !== 0 && |
|
42 | 42 | (count($properties) !== 1 || !isset($properties[0]) || !is_bool($properties[0]))) |
43 | 43 | { |
44 | 44 | throw new AnnotationException('the @exclude annotation requires a boolean or no property'); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function initAnnotation(array $properties) |
41 | 41 | { |
42 | - if(count($properties) != 1 || !isset($properties['field']) || !is_string($properties['field'])) |
|
42 | + if (count($properties) != 1 || !isset($properties['field']) || !is_string($properties['field'])) |
|
43 | 43 | { |
44 | 44 | throw new AnnotationException('The @upload annotation requires a property "field" of type string'); |
45 | 45 | } |
@@ -59,6 +59,6 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getValue() |
61 | 61 | { |
62 | - return "'" . $this->sField . "'" ; // The field id is surrounded with simple quotes. |
|
62 | + return "'" . $this->sField . "'"; // The field id is surrounded with simple quotes. |
|
63 | 63 | } |
64 | 64 | } |
@@ -42,20 +42,20 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function initAnnotation(array $properties) |
44 | 44 | { |
45 | - if(!isset($properties['call']) || !is_string($properties['call'])) |
|
45 | + if (!isset($properties['call']) || !is_string($properties['call'])) |
|
46 | 46 | { |
47 | 47 | throw new AnnotationException('The @after annotation requires a property "call" of type string'); |
48 | 48 | } |
49 | - foreach(array_keys($properties) as $propName) |
|
49 | + foreach (array_keys($properties) as $propName) |
|
50 | 50 | { |
51 | - if($propName !== 'call' && $propName !== 'with') |
|
51 | + if ($propName !== 'call' && $propName !== 'with') |
|
52 | 52 | { |
53 | 53 | throw new AnnotationException('Unknown property "' . $propName . '" in the @after annotation'); |
54 | 54 | } |
55 | 55 | } |
56 | - if(isset($properties['with'])) |
|
56 | + if (isset($properties['with'])) |
|
57 | 57 | { |
58 | - if(!is_array($properties['with'])) |
|
58 | + if (!is_array($properties['with'])) |
|
59 | 59 | { |
60 | 60 | throw new AnnotationException('The "with" property of the @after annotation must be of type array'); |
61 | 61 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getValue() |
79 | 79 | { |
80 | - if(is_array($this->xPrevValue)) |
|
80 | + if (is_array($this->xPrevValue)) |
|
81 | 81 | { |
82 | 82 | // Add the current value to the array |
83 | 83 | $this->xPrevValue[$this->sMethodName] = $this->sMethodParams; |
@@ -42,20 +42,20 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public function initAnnotation(array $properties) |
44 | 44 | { |
45 | - if(!isset($properties['call']) || !is_string($properties['call'])) |
|
45 | + if (!isset($properties['call']) || !is_string($properties['call'])) |
|
46 | 46 | { |
47 | 47 | throw new AnnotationException('The @before annotation requires a property "call" of type string'); |
48 | 48 | } |
49 | - foreach(array_keys($properties) as $propName) |
|
49 | + foreach (array_keys($properties) as $propName) |
|
50 | 50 | { |
51 | - if($propName !== 'call' && $propName !== 'with') |
|
51 | + if ($propName !== 'call' && $propName !== 'with') |
|
52 | 52 | { |
53 | 53 | throw new AnnotationException('Unknown property "' . $propName . '" in the @before annotation'); |
54 | 54 | } |
55 | 55 | } |
56 | - if(isset($properties['with'])) |
|
56 | + if (isset($properties['with'])) |
|
57 | 57 | { |
58 | - if(!is_array($properties['with'])) |
|
58 | + if (!is_array($properties['with'])) |
|
59 | 59 | { |
60 | 60 | throw new AnnotationException('The "with" property of the @before annotation must be of type array'); |
61 | 61 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | */ |
78 | 78 | public function getValue() |
79 | 79 | { |
80 | - if(is_array($this->xPrevValue)) |
|
80 | + if (is_array($this->xPrevValue)) |
|
81 | 81 | { |
82 | 82 | // Add the current value to the array |
83 | 83 | $this->xPrevValue[$this->sMethodName] = $this->sMethodParams; |
@@ -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 | } |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | $this->xManager->registry['upload'] = UploadAnnotation::class; |
48 | 48 | $this->xManager->registry['databag'] = DataBagAnnotation::class; |
49 | 49 | $this->xManager->registry['exclude'] = ExcludeAnnotation::class; |
50 | - $this->xManager->registry['before'] = BeforeAnnotation::class;; |
|
51 | - $this->xManager->registry['after'] = AfterAnnotation::class;; |
|
50 | + $this->xManager->registry['before'] = BeforeAnnotation::class; ; |
|
51 | + $this->xManager->registry['after'] = AfterAnnotation::class; ; |
|
52 | 52 | // Missing standard annotations. |
53 | 53 | // We need to define this, otherwise they throw an exception, and make the whole processing fail. |
54 | 54 | $this->xManager->registry['const'] = false; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | public static function register(bool $bForce = false) |
66 | 66 | { |
67 | 67 | $di = jaxon()->di(); |
68 | - if(!$bForce && $di->h(AnnotationReader::class)) |
|
68 | + if (!$bForce && $di->h(AnnotationReader::class)) |
|
69 | 69 | { |
70 | 70 | return; |
71 | 71 | } |
@@ -92,15 +92,15 @@ discard block |
||
92 | 92 | }); |
93 | 93 | |
94 | 94 | $aAttributes = []; |
95 | - foreach($aAnnotations as $xAnnotation) |
|
95 | + foreach ($aAnnotations as $xAnnotation) |
|
96 | 96 | { |
97 | 97 | $sName = $xAnnotation->getName(); |
98 | - if(isset($aAttributes[$sName])) |
|
98 | + if (isset($aAttributes[$sName])) |
|
99 | 99 | { |
100 | 100 | $xAnnotation->setPrevValue($aAttributes[$sName]); |
101 | 101 | } |
102 | 102 | $xValue = $xAnnotation->getValue(); |
103 | - if($sName === 'protected' && !$xValue) |
|
103 | + if ($sName === 'protected' && !$xValue) |
|
104 | 104 | { |
105 | 105 | continue; // Ignore annotation @exclude with value false |
106 | 106 | } |
@@ -124,34 +124,34 @@ discard block |
||
124 | 124 | { |
125 | 125 | // Class annotations |
126 | 126 | $aClassAttrs = $this->filterAnnotations($this->xManager->getClassAnnotations($sClass)); |
127 | - if(isset($aClassAttrs['protected'])) |
|
127 | + if (isset($aClassAttrs['protected'])) |
|
128 | 128 | { |
129 | 129 | return [true, [], []]; // The entire class is not to be exported. |
130 | 130 | } |
131 | 131 | |
132 | 132 | $aProtected = []; |
133 | 133 | $aAttributes = []; |
134 | - if(count($aClassAttrs) > 0) |
|
134 | + if (count($aClassAttrs) > 0) |
|
135 | 135 | { |
136 | 136 | $aAttributes['*'] = $aClassAttrs; |
137 | 137 | } |
138 | 138 | |
139 | 139 | // Methods annotations |
140 | - foreach($aMethods as $sMethod) |
|
140 | + foreach ($aMethods as $sMethod) |
|
141 | 141 | { |
142 | 142 | $aMethodAttrs = $this->filterAnnotations($this->xManager->getMethodAnnotations($sClass, $sMethod)); |
143 | - if(isset($aMethodAttrs['protected'])) |
|
143 | + if (isset($aMethodAttrs['protected'])) |
|
144 | 144 | { |
145 | 145 | $aProtected[] = $sMethod; // The method is not to be exported. |
146 | 146 | } |
147 | - elseif(count($aMethodAttrs) > 0) |
|
147 | + elseif (count($aMethodAttrs) > 0) |
|
148 | 148 | { |
149 | 149 | $aAttributes[$sMethod] = $aMethodAttrs; |
150 | 150 | } |
151 | 151 | } |
152 | 152 | return [false, $aAttributes, $aProtected]; |
153 | 153 | } |
154 | - catch(AnnotationException $e) |
|
154 | + catch (AnnotationException $e) |
|
155 | 155 | { |
156 | 156 | throw new SetupException($e->getMessage()); |
157 | 157 | } |