PHP Класс Newscoop\Service\Resource\ResourceRepository

The resources can be services, configurations ...
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$repositoryProperties array
$serviceCache array

Открытые методы

Метод Описание
getInstance ( ) : Newscoop\Service\Resource\ResourceRespository Provides the singletone of the resource repository.
getRepositoryProperties ( ) : array Provides the properties of the repository.
getResourceFor ( ResourceId $resourceId ) : mixed Provides the resource for the provided resource id.

Защищенные методы

Метод Описание
cacheService ( string $key, mixed $service ) : mixed Provides to the cache the serice instance.
configureService ( mixed $service ) : mixed Configures the provided service instance with all configurations available in the properties of the repository.
extractSimpleClassName ( string $className ) : string Provides the simple class name based on the provided full class name (namespace + simple class name).
findInServiceCache ( string $key ) Find the service instance cached under the specified key.
loadProperties ( $path ) : array Load the property file at the specified path.
processConfigurationsPath ( string $className ) : string Provides the configuration path, where all property files are located.

Приватные методы

Метод Описание
__construct ( )

Описание методов

cacheService() защищенный метод

Provides to the cache the serice instance.
protected cacheService ( string $key, mixed $service ) : mixed
$key string The key to be used for caching the provided service instance, *(not null not empty).
$service mixed The service instance to cache, *(not null).
Результат mixed The cached service instance.

configureService() защищенный метод

This configurations works as folows: - if in the repository properties there is a property that has the format [simple class name].[field name] it will automatically assigne the value found to the service field. - the [simple class name] represents the service implementation simple class name (ex: 'ThemeServiceLocalFileSystem') - the [field name] represents the field name inside the instance that will be assigned the value for that property. ex: ThemeServiceLocalFileSystem.path=\usr\local This will configure the field path in the service instance with the provided value.
protected configureService ( mixed $service ) : mixed
$service mixed The service to be configured, not null.
Результат mixed The configured service instance.

extractSimpleClassName() защищенный метод

Provides the simple class name based on the provided full class name (namespace + simple class name).
protected extractSimpleClassName ( string $className ) : string
$className string The class name from where to extract the simple class name.
Результат string The config path.

findInServiceCache() защищенный метод

Find the service instance cached under the specified key.
protected findInServiceCache ( string $key )
$key string The key to search by, *(not null not empty).

getInstance() публичный статический метод

Provides the singletone of the resource repository.
public static getInstance ( ) : Newscoop\Service\Resource\ResourceRespository
Результат Newscoop\Service\Resource\ResourceRespository The singletone.

getRepositoryProperties() публичный метод

Provides the properties of the repository.
public getRepositoryProperties ( ) : array
Результат array The array containing the properties.

getResourceFor() публичный метод

The resource is located by using ResourceLocator (future).
public getResourceFor ( ResourceId $resourceId ) : mixed
$resourceId ResourceId The resource id used for obtaining the assigned resource, must not be null or empty.
Результат mixed The resource coresponding to the resource id.

loadProperties() защищенный метод

Load the property file at the specified path.
protected loadProperties ( $path ) : array
Результат array The array containing the loaded properties.

processConfigurationsPath() защищенный метод

Provides the configuration path, where all property files are located.
protected processConfigurationsPath ( string $className ) : string
$className string The class name for which to locate the property file, this done by convention the class name can contain alaso the namespace which will be removed, the property file will be considered as the simple class name with the 'properties' extension.
Результат string The config path based on the properties convention for the provided class name.

Описание свойств

$repositoryProperties защищенное свойство

protected array $repositoryProperties
Результат array

$serviceCache защищенное свойство

protected array $serviceCache
Результат array