@@ -61,7 +61,7 @@ class AnnotationManager
61
61
/**
62
62
* @var array List of registered annotation aliases.
63
63
*/
64
- public $ registry = array (
64
+ private $ _registry = array (
65
65
'api ' => false ,
66
66
'abstract ' => false ,
67
67
'access ' => false ,
@@ -232,7 +232,7 @@ protected function getAnnotationFile(string $path): AnnotationFile
232
232
* @return string|bool The fully qualified annotation class-name, or false if the
233
233
* requested annotation has been disabled (set to false) in the registry.
234
234
*
235
- * @see $registry
235
+ * @see $_registry
236
236
*/
237
237
public function resolveName (string $ name )
238
238
{
@@ -242,8 +242,8 @@ public function resolveName(string $name)
242
242
243
243
$ type = \lcfirst ($ name );
244
244
245
- if (isset ($ this ->registry [$ type ])) {
246
- return $ this ->registry [$ type ]; // type-name is registered
245
+ if (isset ($ this ->_registry [$ type ])) {
246
+ return $ this ->_registry [$ type ]; // type-name is registered
247
247
}
248
248
249
249
$ type = \ucfirst (\strtr ($ name , '- ' , '_ ' )) . $ this ->suffix ;
@@ -467,7 +467,7 @@ protected function filterAnnotations(array $annotations, string $type): array
467
467
*/
468
468
public function getUsage (string $ class ): UsageAnnotation
469
469
{
470
- if ($ class === $ this ->registry ['usage ' ]) {
470
+ if ($ class === $ this ->_registry ['usage ' ]) {
471
471
return $ this ->_usageAnnotation ;
472
472
}
473
473
@@ -611,4 +611,15 @@ public function getPropertyAnnotations($class, string $property = null, string $
611
611
return $ this ->filterAnnotations ($ this ->getAnnotations ($ class , self ::MEMBER_PROPERTY , '$ ' . $ property ), $ type );
612
612
}
613
613
}
614
+
615
+ /**
616
+ * Adds an annotation in the registry.
617
+ *
618
+ * @param string $annotation The annotation to register.
619
+ * @param string|bool $class The full name of the class.
620
+ */
621
+ public function registerAnnotation (string $ annotation , $ class )
622
+ {
623
+ $ this ->_registry [$ annotation ] = $ class ;
624
+ }
614
625
}
0 commit comments