class AvatarKitAvatarServiceDiscovery in Avatar Kit 8.2
Avatar Kit library service discovery.
Hierarchy
- class \Drupal\avatars\AvatarKitAvatarServiceDiscovery extends \dpi\ak\AvatarServiceDiscovery uses UseCacheBackendTrait
Expanded class hierarchy of AvatarKitAvatarServiceDiscovery
1 string reference to 'AvatarKitAvatarServiceDiscovery'
1 service uses AvatarKitAvatarServiceDiscovery
File
- src/
AvatarKitAvatarServiceDiscovery.php, line 15
Namespace
Drupal\avatarsView source
class AvatarKitAvatarServiceDiscovery extends AvatarServiceDiscovery {
use UseCacheBackendTrait;
/**
* The class loader.
*
* @var \Composer\Autoload\ClassLoader
*/
protected $classLoader;
/**
* Backend for caching discovery results.
*
* @var \Drupal\Core\Cache\CacheBackendInterface
*/
protected $cacheBackend;
/**
* Constructs a new AvatarKitAvatarServiceDiscovery object.
*
* @param object $class_loader
* The class loader.
* @param \Drupal\Core\Cache\CacheBackendInterface $cache_backend
* Backend for caching discovery results.
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AvatarKitAvatarServiceDiscovery:: |
protected | property |
Backend for caching discovery results. Overrides UseCacheBackendTrait:: |
|
AvatarKitAvatarServiceDiscovery:: |
protected | property | The class loader. | |
AvatarKitAvatarServiceDiscovery:: |
public | function | Constructs a new AvatarKitAvatarServiceDiscovery object. | |
UseCacheBackendTrait:: |
protected | property | Flag whether caches should be used or skipped. | |
UseCacheBackendTrait:: |
protected | function | Fetches from the cache backend, respecting the use caches flag. | 1 |
UseCacheBackendTrait:: |
protected | function | Stores data in the persistent cache, respecting the use caches flag. |