@@ -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 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public static function register(bool $bForce = false) |
68 | 68 | { |
69 | 69 | $di = jaxon()->di(); |
70 | - if(!$bForce && $di->h(AnnotationReader::class)) |
|
70 | + if (!$bForce && $di->h(AnnotationReader::class)) |
|
71 | 71 | { |
72 | 72 | return; |
73 | 73 | } |
@@ -94,15 +94,15 @@ discard block |
||
94 | 94 | }); |
95 | 95 | |
96 | 96 | $aAttributes = []; |
97 | - foreach($aAnnotations as $xAnnotation) |
|
97 | + foreach ($aAnnotations as $xAnnotation) |
|
98 | 98 | { |
99 | 99 | $sName = $xAnnotation->getName(); |
100 | - if(isset($aAttributes[$sName])) |
|
100 | + if (isset($aAttributes[$sName])) |
|
101 | 101 | { |
102 | 102 | $xAnnotation->setPrevValue($aAttributes[$sName]); |
103 | 103 | } |
104 | 104 | $xValue = $xAnnotation->getValue(); |
105 | - if($sName === 'protected' && !$xValue) |
|
105 | + if ($sName === 'protected' && !$xValue) |
|
106 | 106 | { |
107 | 107 | continue; // Ignore annotation @exclude with value false |
108 | 108 | } |
@@ -126,34 +126,34 @@ discard block |
||
126 | 126 | { |
127 | 127 | // Class annotations |
128 | 128 | $aClassAttrs = $this->filterAnnotations($this->xManager->getClassAnnotations($sClass)); |
129 | - if(isset($aClassAttrs['protected'])) |
|
129 | + if (isset($aClassAttrs['protected'])) |
|
130 | 130 | { |
131 | 131 | return [true, [], []]; // The entire class is not to be exported. |
132 | 132 | } |
133 | 133 | |
134 | 134 | $aProtected = []; |
135 | 135 | $aAttributes = []; |
136 | - if(count($aClassAttrs) > 0) |
|
136 | + if (count($aClassAttrs) > 0) |
|
137 | 137 | { |
138 | 138 | $aAttributes['*'] = $aClassAttrs; |
139 | 139 | } |
140 | 140 | |
141 | 141 | // Methods annotations |
142 | - foreach($aMethods as $sMethod) |
|
142 | + foreach ($aMethods as $sMethod) |
|
143 | 143 | { |
144 | 144 | $aMethodAttrs = $this->filterAnnotations($this->xManager->getMethodAnnotations($sClass, $sMethod)); |
145 | - if(isset($aMethodAttrs['protected'])) |
|
145 | + if (isset($aMethodAttrs['protected'])) |
|
146 | 146 | { |
147 | 147 | $aProtected[] = $sMethod; // The method is not to be exported. |
148 | 148 | } |
149 | - elseif(count($aMethodAttrs) > 0) |
|
149 | + elseif (count($aMethodAttrs) > 0) |
|
150 | 150 | { |
151 | 151 | $aAttributes[$sMethod] = $aMethodAttrs; |
152 | 152 | } |
153 | 153 | } |
154 | 154 | return [false, $aAttributes, $aProtected]; |
155 | 155 | } |
156 | - catch(AnnotationException $e) |
|
156 | + catch (AnnotationException $e) |
|
157 | 157 | { |
158 | 158 | throw new SetupException($e->getMessage()); |
159 | 159 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | */ |
47 | 47 | public function initAnnotation(array $properties) |
48 | 48 | { |
49 | - if(count($properties) != 2 || |
|
49 | + if (count($properties) != 2 || |
|
50 | 50 | !isset($properties['attr']) || !is_string($properties['attr']) || |
51 | 51 | !isset($properties['class']) || !is_string($properties['class'])) |
52 | 52 | { |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | */ |
71 | 71 | public function getValue() |
72 | 72 | { |
73 | - if(is_array($this->xPrevValue)) |
|
73 | + if (is_array($this->xPrevValue)) |
|
74 | 74 | { |
75 | 75 | $this->xPrevValue[$this->sAttr] = $this->sClass; // Append the current value to the array |
76 | 76 | return $this->xPrevValue; |