public function AvatarKitAvatarServiceDiscovery::__construct in Avatar Kit 8.2
Constructs a new AvatarKitAvatarServiceDiscovery object.
Parameters
object $class_loader: The class loader.
\Drupal\Core\Cache\CacheBackendInterface $cache_backend: Backend for caching discovery results.
File
- src/
AvatarKitAvatarServiceDiscovery.php, line 41
Class
- AvatarKitAvatarServiceDiscovery
- Avatar Kit library service discovery.
Namespace
Drupal\avatarsCode
public function __construct($class_loader, CacheBackendInterface $cache_backend) {
$this->subdir = 'AvatarKit/AvatarServices/';
$this->serviceInterface = AvatarServiceInterface::class;
$this->annotationClass = AvatarService::class;
$this->cacheBackend = $cache_backend;
$cache_key = 'avatars_ak_service_annotations';
$annotations = $this
->cacheGet($cache_key)->data ?? NULL;
if (!isset($annotations)) {
$root_namespaces = $class_loader
->getPrefixesPsr4();
$classes = $this
->discoverClasses($root_namespaces);
$annotations = $this
->discoverAnnotations($classes);
$this
->cacheSet($cache_key, $annotations, Cache::PERMANENT);
}
$this->annotations = $annotations;
}