@@ -85,11 +85,11 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public static function register(Container $di, bool $bForce = false) |
| 87 | 87 | { |
| 88 | - if(!$bForce && $di->h(AnnotationReader::class)) |
|
| 88 | + if (!$bForce && $di->h(AnnotationReader::class)) |
|
| 89 | 89 | { |
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | - if(!$di->h('jaxon_annotations_cache_dir')) |
|
| 92 | + if (!$di->h('jaxon_annotations_cache_dir')) |
|
| 93 | 93 | { |
| 94 | 94 | $di->val('jaxon_annotations_cache_dir', sys_get_temp_dir()); |
| 95 | 95 | } |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | }); |
| 132 | 132 | |
| 133 | 133 | $aAttributes = []; |
| 134 | - foreach($aAnnotations as $xAnnotation) |
|
| 134 | + foreach ($aAnnotations as $xAnnotation) |
|
| 135 | 135 | { |
| 136 | 136 | $xAnnotation->setReader($this); |
| 137 | 137 | $sName = $xAnnotation->getName(); |
| 138 | 138 | $xAnnotation->setPrevValue($aAttributes[$sName] ?? null); |
| 139 | 139 | $xValue = $xAnnotation->getValue(); |
| 140 | - if($sName === 'protected' && !$xValue) |
|
| 140 | + if ($sName === 'protected' && !$xValue) |
|
| 141 | 141 | { |
| 142 | 142 | continue; // Ignore annotation @exclude with value false |
| 143 | 143 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // Only keep the annotations declared in this package. |
| 159 | 159 | $aAnnotations = array_filter($aAnnotations, function($xAnnotation) use($sProperty) { |
| 160 | 160 | // Save the property type |
| 161 | - if(is_a($xAnnotation, VarAnnotation::class)) |
|
| 161 | + if (is_a($xAnnotation, VarAnnotation::class)) |
|
| 162 | 162 | { |
| 163 | 163 | $this->aPropTypes[$sProperty] = $xAnnotation->type; |
| 164 | 164 | } |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | }); |
| 168 | 168 | |
| 169 | 169 | $nCount = count($aAnnotations); |
| 170 | - if($nCount === 0) |
|
| 170 | + if ($nCount === 0) |
|
| 171 | 171 | { |
| 172 | 172 | return ['', null]; |
| 173 | 173 | } |
| 174 | - if($nCount > 1) |
|
| 174 | + if ($nCount > 1) |
|
| 175 | 175 | { |
| 176 | 176 | throw new AnnotationException('Only one @di annotation is allowed on a property'); |
| 177 | 177 | } |
@@ -202,10 +202,10 @@ discard block |
||
| 202 | 202 | $this->aPropTypes = []; |
| 203 | 203 | $aPropAttrs = []; |
| 204 | 204 | // Properties annotations |
| 205 | - foreach($aProperties as $sProperty) |
|
| 205 | + foreach ($aProperties as $sProperty) |
|
| 206 | 206 | { |
| 207 | 207 | [$sName, $xValue] = $this->propAnnotations($sProperty, $this->xManager->getPropertyAnnotations($sClass, $sProperty)); |
| 208 | - if(!$xValue) |
|
| 208 | + if (!$xValue) |
|
| 209 | 209 | { |
| 210 | 210 | continue; |
| 211 | 211 | } |
@@ -216,19 +216,19 @@ discard block |
||
| 216 | 216 | $this->sMemberType = AnnotationManager::MEMBER_CLASS; |
| 217 | 217 | |
| 218 | 218 | $aClassAttrs = $this->filterAnnotations($this->xManager->getClassAnnotations($sClass)); |
| 219 | - if(isset($aClassAttrs['protected'])) |
|
| 219 | + if (isset($aClassAttrs['protected'])) |
|
| 220 | 220 | { |
| 221 | 221 | return [true, [], []]; // The entire class is not to be exported. |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | // Merge attributes and class annotations |
| 225 | - foreach($aPropAttrs as $sName => $xValue) |
|
| 225 | + foreach ($aPropAttrs as $sName => $xValue) |
|
| 226 | 226 | { |
| 227 | 227 | $aClassAttrs[$sName] = array_merge($aClassAttrs[$sName] ?? [], $xValue); |
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | $aAttributes = []; |
| 231 | - if(count($aClassAttrs) > 0) |
|
| 231 | + if (count($aClassAttrs) > 0) |
|
| 232 | 232 | { |
| 233 | 233 | $aAttributes['*'] = $aClassAttrs; |
| 234 | 234 | } |
@@ -237,21 +237,21 @@ discard block |
||
| 237 | 237 | $this->sMemberType = AnnotationManager::MEMBER_METHOD; |
| 238 | 238 | |
| 239 | 239 | $aProtected = []; |
| 240 | - foreach($aMethods as $sMethod) |
|
| 240 | + foreach ($aMethods as $sMethod) |
|
| 241 | 241 | { |
| 242 | 242 | $aMethodAttrs = $this->filterAnnotations($this->xManager->getMethodAnnotations($sClass, $sMethod)); |
| 243 | - if(isset($aMethodAttrs['protected'])) |
|
| 243 | + if (isset($aMethodAttrs['protected'])) |
|
| 244 | 244 | { |
| 245 | 245 | $aProtected[] = $sMethod; // The method is not to be exported. |
| 246 | 246 | } |
| 247 | - elseif(count($aMethodAttrs) > 0) |
|
| 247 | + elseif (count($aMethodAttrs) > 0) |
|
| 248 | 248 | { |
| 249 | 249 | $aAttributes[$sMethod] = $aMethodAttrs; |
| 250 | 250 | } |
| 251 | 251 | } |
| 252 | 252 | return [false, $aAttributes, $aProtected]; |
| 253 | 253 | } |
| 254 | - catch(AnnotationException $e) |
|
| 254 | + catch (AnnotationException $e) |
|
| 255 | 255 | { |
| 256 | 256 | throw new SetupException($e->getMessage()); |
| 257 | 257 | } |