This repository has been archived on 2025-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
notes-tell/src/LanguageHandler.php
2021-10-19 12:43:32 +00:00

38 lines
943 B
PHP

<?php declare(strict_types = 1);
namespace Notes\Tell;
use Psr\Http\Message\ResponseInterface;
use Notes\ObjectResolver;
class LanguageHandler {
public function verify(string $className) : ? \Notes\Annotation
{
if ( $annotation = $this->getClassAnnotations($className) ) {
# Should generate an equivalent of Ulmus's object reflection here !
if ( $annotation->key ) {
return $annotation;
}
}
return null;
}
protected function getClassAnnotations(string $className) : ? \Notes\Annotation
{
$objectResolver = new ObjectResolver($className, true, true, false, true);
try {
if ( null !== ( $object = $objectResolver->getAnnotationFromClassname( Annotation\Language::class ) ) ) {
return $object;
}
}
catch(\Exception $e) {
return null;
}
}
}