- Added a try/catch for the annotations
This commit is contained in:
parent
d3270ba6e7
commit
6cbe043648
|
@ -10,23 +10,28 @@ class LanguageHandler {
|
||||||
|
|
||||||
public function verify(string $className) : ? \Notes\Annotation
|
public function verify(string $className) : ? \Notes\Annotation
|
||||||
{
|
{
|
||||||
$annotation = $this->getClassAnnotations($className);
|
if ( $annotation = $this->getClassAnnotations($className) ) {
|
||||||
|
|
||||||
# Should generate an equivalent of Ulmus's object reflection here !
|
# Should generate an equivalent of Ulmus's object reflection here !
|
||||||
if ( $annotation->key ) {
|
if ( $annotation->key ) {
|
||||||
return $annotation;
|
return $annotation;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getClassAnnotations(string $className) : \Notes\Annotation
|
protected function getClassAnnotations(string $className) : ? \Notes\Annotation
|
||||||
{
|
{
|
||||||
$objectResolver = new ObjectResolver($className, true, true, false, true);
|
$objectResolver = new ObjectResolver($className, true, true, false, true);
|
||||||
|
|
||||||
|
try {
|
||||||
if ( null !== ( $object = $objectResolver->getAnnotationFromClassname( Annotation\Language::class ) ) ) {
|
if ( null !== ( $object = $objectResolver->getAnnotationFromClassname( Annotation\Language::class ) ) ) {
|
||||||
return $object;
|
return $object;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch(\Exception $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue