PHP Класс Puli\Manager\Api\Container

Use this class to access the managers provided by this module: php $puli = new Puli(getcwd()); $puli->start(); $moduleManager = $puli->getModuleManager(); The Puli class either operates in the global or a project context: * The "global context" is not tied to a specific root module. A global context only loads the settings of the "config.json" file in the home directory. The Puli class operates in the global context if no project root directory is passed to the constructor. In the global context, only the global config file manager is available. * The "project context" is tied to a specific Puli project. You need to pass the path to the project's root directory to the constructor or to {@link setRootDirectory()}. The configuration of the "puli.json" file in the root directory is used to configure the managers. The Puli class creates four kinds of managers: * The "config file manager" allows you to modify entries of the "config.json" file in the home directory. * The "module file manager" manages modifications to the "puli.json" file of a Puli project. * The "module manager" manages the module repository of a Puli project. * The "repository manager" manages the resource repository of a Puli project. * The "discovery manager" manages the resource discovery of a Puli project. The home directory is read from the context variable "PULI_HOME". If this variable is not set, the home directory defaults to: * $HOME/.puli on Linux, where $HOME is the context variable "HOME". * $APPDATA/Puli on Windows, where $APPDATA is the context variable "APPDATA". If none of these variables can be found, an exception is thrown. A .htaccess file is put into the home directory to protect it from web access.
С версии: 1.0
Автор: Bernhard Schussek ([email protected])
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( string | null $rootDir = null, string $env = Environment::DEV ) Creates a new instance for the given Puli project.
arePluginsEnabled ( ) : boolean Returns whether Puli plugins are enabled.
disablePlugins ( ) Disables all Puli plugins.
enablePlugins ( ) Enables all Puli plugins.
getAssetManager ( ) : Puli\Manager\Api\Asset\AssetManager Returns the asset manager.
getConfigFileConverter ( ) : Puli\Manager\Config\ConfigFileConverter Returns the configuration file serializer.
getConfigFileManager ( ) : Puli\Manager\Api\Config\ConfigFileManager Returns the configuration file manager.
getContext ( ) : Puli\Manager\Api\Context\Context | Puli\Manager\Api\Context\ProjectContext Returns the context.
getDiscovery ( ) : Puli\Discovery\Api\EditableDiscovery Returns the resource discovery of the project.
getDiscoveryManager ( ) : Puli\Manager\Api\Discovery\DiscoveryManager Returns the resource discovery manager.
getEnvironment ( ) : string Retturns the environment of the managed Puli project.
getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface | null Returns the used event dispatcher.
getFactory ( ) : object
getFactoryManager ( ) : Puli\Manager\Api\Factory\FactoryManager
getInstallationManager ( ) : Puli\Manager\Api\Installation\InstallationManager Returns the installation manager.
getInstallerManager ( ) : Puli\Manager\Api\Installer\InstallerManager Returns the installer manager.
getJsonDecoder ( ) : JsonDecoder Returns the JSON decoder.
getJsonEncoder ( ) : JsonEncoder Returns the JSON encoder.
getJsonValidator ( ) : JsonValidator Returns the JSON validator.
getLegacyModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter Returns the module file serializer with support for legacy versions.
getLegacyRootModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter Returns the module file serializer with support for legacy versions.
getLogger ( ) : Psr\Log\LoggerInterface Returns the logger.
getModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter Returns the module file converter.
getModuleManager ( ) : Puli\Manager\Api\Module\ModuleManager Returns the module manager.
getRepository ( ) : Puli\Repository\Api\EditableRepository Returns the resource repository of the project.
getRepositoryManager ( ) : Puli\Manager\Api\Repository\RepositoryManager Returns the resource repository manager.
getRootDirectory ( ) : string | null Returns the root directory of the managed Puli project.
getRootModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter Returns the module file converter.
getRootModuleFileManager ( ) : Puli\Manager\Api\Module\RootModuleFileManager Returns the root module file manager.
getServerManager ( ) : Puli\Manager\Api\Server\ServerManager Returns the server manager.
getStorage ( ) : Puli\Manager\Api\Storage\Storage Returns the file storage.
getUrlGenerator ( ) : Puli\UrlGenerator\Api\UrlGenerator Returns the resource URL generator.
isStarted ( ) : boolean Returns whether the service container is started.
setEnvironment ( string $env ) Sets the environment of the managed Puli project.
setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher ) Sets the event dispatcher to use.
setLogger ( Psr\Log\LoggerInterface $logger ) Sets the logger to use.
setRootDirectory ( string | null $rootDir ) Sets the root directory of the managed Puli project.
start ( ) Starts the service container.

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

Метод Описание
activatePlugins ( )
createGlobalContext ( )
createProjectContext ( string $rootDir, $env ) : Puli\Manager\Api\Context\ProjectContext Creates the context of a Puli project.
createValidatingConverter ( Webmozart\Json\Conversion\JsonConverter $innerConverter, string | callable | null $schema = null ) : ValidatingConverter Decorates a converter with a {@link ValidatingConverter}.
getJsonStorage ( ) : JsonStorage Returns the JSON file storage.
getJsonVersioner ( ) : Webmozart\Json\Versioning\JsonVersioner Returns the JSON versioner.
getModuleFileMigrationManager ( ) : MigrationManager Returns the migration manager for module files.
loadConfigFile ( $homeDir, Puli\Manager\Api\Config\Config $baseConfig )
parseHomeDirectory ( ) : null | string Parses the system context for a home directory.
validatePluginClass ( string $pluginClass ) Validates the given plugin class name.

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

__construct() публичный Метод

Creates a new instance for the given Puli project.
public __construct ( string | null $rootDir = null, string $env = Environment::DEV )
$rootDir string | null The root directory of the Puli project. If none is passed, the object operates in the global context. You can set or switch the root directories later on by calling {@link setRootDirectory()}.
$env string One of the {@link Environment} constants.

arePluginsEnabled() публичный Метод

Returns whether Puli plugins are enabled.
public arePluginsEnabled ( ) : boolean
Результат boolean Returns `true` if Puli plugins will be loaded and `false` otherwise.

disablePlugins() публичный Метод

Disables all Puli plugins.
public disablePlugins ( )

enablePlugins() публичный Метод

Enables all Puli plugins.
public enablePlugins ( )

getAssetManager() публичный Метод

Returns the asset manager.
public getAssetManager ( ) : Puli\Manager\Api\Asset\AssetManager
Результат Puli\Manager\Api\Asset\AssetManager The asset manager.

getConfigFileConverter() публичный Метод

Returns the configuration file serializer.
public getConfigFileConverter ( ) : Puli\Manager\Config\ConfigFileConverter
Результат Puli\Manager\Config\ConfigFileConverter The configuration file serializer.

getConfigFileManager() публичный Метод

Returns the configuration file manager.
public getConfigFileManager ( ) : Puli\Manager\Api\Config\ConfigFileManager
Результат Puli\Manager\Api\Config\ConfigFileManager The configuration file manager.

getContext() публичный Метод

Returns the context.
public getContext ( ) : Puli\Manager\Api\Context\Context | Puli\Manager\Api\Context\ProjectContext
Результат Puli\Manager\Api\Context\Context | Puli\Manager\Api\Context\ProjectContext The context.

getDiscovery() публичный Метод

Returns the resource discovery of the project.
public getDiscovery ( ) : Puli\Discovery\Api\EditableDiscovery
Результат Puli\Discovery\Api\EditableDiscovery The resource discovery.

getDiscoveryManager() публичный Метод

Returns the resource discovery manager.
public getDiscoveryManager ( ) : Puli\Manager\Api\Discovery\DiscoveryManager
Результат Puli\Manager\Api\Discovery\DiscoveryManager The discovery manager.

getEnvironment() публичный Метод

Retturns the environment of the managed Puli project.
public getEnvironment ( ) : string
Результат string One of the {@link Environment} constants.

getEventDispatcher() публичный Метод

Returns the used event dispatcher.
public getEventDispatcher ( ) : Symfony\Component\EventDispatcher\EventDispatcherInterface | null
Результат Symfony\Component\EventDispatcher\EventDispatcherInterface | null The used logger.

getFactory() публичный Метод

public getFactory ( ) : object
Результат object

getFactoryManager() публичный Метод

public getFactoryManager ( ) : Puli\Manager\Api\Factory\FactoryManager
Результат Puli\Manager\Api\Factory\FactoryManager

getInstallationManager() публичный Метод

Returns the installation manager.
public getInstallationManager ( ) : Puli\Manager\Api\Installation\InstallationManager
Результат Puli\Manager\Api\Installation\InstallationManager The installation manager.

getInstallerManager() публичный Метод

Returns the installer manager.
public getInstallerManager ( ) : Puli\Manager\Api\Installer\InstallerManager
Результат Puli\Manager\Api\Installer\InstallerManager The installer manager.

getJsonDecoder() публичный Метод

Returns the JSON decoder.
public getJsonDecoder ( ) : JsonDecoder
Результат Webmozart\Json\JsonDecoder The JSON decoder.

getJsonEncoder() публичный Метод

Returns the JSON encoder.
public getJsonEncoder ( ) : JsonEncoder
Результат Webmozart\Json\JsonEncoder The JSON encoder.

getJsonValidator() публичный Метод

Returns the JSON validator.
public getJsonValidator ( ) : JsonValidator
Результат Webmozart\Json\JsonValidator The JSON validator.

getLegacyModuleFileConverter() публичный Метод

Returns the module file serializer with support for legacy versions.
public getLegacyModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter
Результат Webmozart\Json\Conversion\JsonConverter The module file converter.

getLegacyRootModuleFileConverter() публичный Метод

Returns the module file serializer with support for legacy versions.
public getLegacyRootModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter
Результат Webmozart\Json\Conversion\JsonConverter The module file converter.

getLogger() публичный Метод

Returns the logger.
public getLogger ( ) : Psr\Log\LoggerInterface
Результат Psr\Log\LoggerInterface The logger.

getModuleFileConverter() публичный Метод

Returns the module file converter.
public getModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter
Результат Webmozart\Json\Conversion\JsonConverter The module file converter.

getModuleManager() публичный Метод

Returns the module manager.
public getModuleManager ( ) : Puli\Manager\Api\Module\ModuleManager
Результат Puli\Manager\Api\Module\ModuleManager The module manager.

getRepository() публичный Метод

Returns the resource repository of the project.
public getRepository ( ) : Puli\Repository\Api\EditableRepository
Результат Puli\Repository\Api\EditableRepository The resource repository.

getRepositoryManager() публичный Метод

Returns the resource repository manager.
public getRepositoryManager ( ) : Puli\Manager\Api\Repository\RepositoryManager
Результат Puli\Manager\Api\Repository\RepositoryManager The repository manager.

getRootDirectory() публичный Метод

If no Puli project is managed at the moment, null is returned.
public getRootDirectory ( ) : string | null
Результат string | null The root directory of the managed Puli project or `null` if none is set.

getRootModuleFileConverter() публичный Метод

Returns the module file converter.
public getRootModuleFileConverter ( ) : Webmozart\Json\Conversion\JsonConverter
Результат Webmozart\Json\Conversion\JsonConverter The module file converter.

getRootModuleFileManager() публичный Метод

Returns the root module file manager.
public getRootModuleFileManager ( ) : Puli\Manager\Api\Module\RootModuleFileManager
Результат Puli\Manager\Api\Module\RootModuleFileManager The module file manager.

getServerManager() публичный Метод

Returns the server manager.
public getServerManager ( ) : Puli\Manager\Api\Server\ServerManager
Результат Puli\Manager\Api\Server\ServerManager The server manager.

getStorage() публичный Метод

Returns the file storage.
public getStorage ( ) : Puli\Manager\Api\Storage\Storage
Результат Puli\Manager\Api\Storage\Storage The storage.

getUrlGenerator() публичный Метод

Returns the resource URL generator.
public getUrlGenerator ( ) : Puli\UrlGenerator\Api\UrlGenerator
Результат Puli\UrlGenerator\Api\UrlGenerator The resource URL generator.

isStarted() публичный Метод

Returns whether the service container is started.
public isStarted ( ) : boolean
Результат boolean Returns `true` if the container is started and `false` otherwise.

setEnvironment() публичный Метод

Sets the environment of the managed Puli project.
public setEnvironment ( string $env )
$env string One of the {@link Environment} constants.

setEventDispatcher() публичный Метод

Sets the event dispatcher to use.
public setEventDispatcher ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher )
$dispatcher Symfony\Component\EventDispatcher\EventDispatcherInterface The event dispatcher to use.

setLogger() публичный Метод

Sets the logger to use.
public setLogger ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface The logger to use.

setRootDirectory() публичный Метод

Sets the root directory of the managed Puli project.
public setRootDirectory ( string | null $rootDir )
$rootDir string | null The root directory of the managed Puli project or `null` to start Puli outside of a specific project.

start() публичный Метод

Starts the service container.
public start ( )