PHP Class Puli\Manager\Json\JsonStorage

Since: 1.0
Author: Bernhard Schussek ([email protected])
Mostra file Open project: puli/manager Class Usage Examples

Public Methods

Method Description
__construct ( Puli\Manager\Api\Storage\Storage $storage, JsonConverterProvider $converterProvider, JsonEncoder $jsonEncoder, JsonDecoder $jsonDecoder, Puli\Manager\Api\Factory\FactoryManager $factoryManager = null ) Creates a new storage.
loadConfigFile ( string $path, Puli\Manager\Api\Config\Config $baseConfig = null ) : Puli\Manager\Api\Config\ConfigFile Loads a configuration file from a path.
loadModuleFile ( string $path ) : ModuleFile Loads a module file from a file path.
loadRootModuleFile ( string $path, Puli\Manager\Api\Config\Config $baseConfig ) : RootModuleFile Loads a root module file from a file path.
saveConfigFile ( Puli\Manager\Api\Config\ConfigFile $configFile ) Saves a configuration file.
saveModuleFile ( ModuleFile $moduleFile ) Saves a module file.
saveRootModuleFile ( RootModuleFile $moduleFile ) Saves a root module file.

Private Methods

Method Description
decode ( $json, $path )
encode ( stdClass $jsonData, $path )
loadFile ( $path, $className, array $options = [] )
saveFile ( $file, $path, array $options = [] )

Method Details

__construct() public method

Creates a new storage.
public __construct ( Puli\Manager\Api\Storage\Storage $storage, JsonConverterProvider $converterProvider, JsonEncoder $jsonEncoder, JsonDecoder $jsonDecoder, Puli\Manager\Api\Factory\FactoryManager $factoryManager = null )
$storage Puli\Manager\Api\Storage\Storage The file storage.
$converterProvider JsonConverterProvider The provider for the JSON converters.
$jsonEncoder Webmozart\Json\JsonEncoder The JSON encoder.
$jsonDecoder Webmozart\Json\JsonDecoder The JSON decoder.
$factoryManager Puli\Manager\Api\Factory\FactoryManager The manager used to regenerate the factory class after saving a file.

loadConfigFile() public method

Loads a configuration file from a path.
public loadConfigFile ( string $path, Puli\Manager\Api\Config\Config $baseConfig = null ) : Puli\Manager\Api\Config\ConfigFile
$path string The path to the configuration file.
$baseConfig Puli\Manager\Api\Config\Config The configuration that the loaded configuration will inherit its values from.
return Puli\Manager\Api\Config\ConfigFile The loaded configuration file.

loadModuleFile() public method

Loads a module file from a file path.
public loadModuleFile ( string $path ) : ModuleFile
$path string The path to the module file.
return Puli\Manager\Api\Module\ModuleFile The loaded module file.

loadRootModuleFile() public method

Loads a root module file from a file path.
public loadRootModuleFile ( string $path, Puli\Manager\Api\Config\Config $baseConfig ) : RootModuleFile
$path string The path to the module configuration file.
$baseConfig Puli\Manager\Api\Config\Config The configuration that the module will inherit its configuration values from.
return Puli\Manager\Api\Module\RootModuleFile The loaded module file.

saveConfigFile() public method

The configuration file is saved to the same path that it was read from.
public saveConfigFile ( Puli\Manager\Api\Config\ConfigFile $configFile )
$configFile Puli\Manager\Api\Config\ConfigFile The configuration file to save.

saveModuleFile() public method

The module file is saved to the same path that it was read from.
public saveModuleFile ( ModuleFile $moduleFile )
$moduleFile Puli\Manager\Api\Module\ModuleFile The module file to save.

saveRootModuleFile() public method

The module file is saved to the same path that it was read from.
public saveRootModuleFile ( RootModuleFile $moduleFile )
$moduleFile Puli\Manager\Api\Module\RootModuleFile The module file to save.