PHP Class ZF\Apigility\Admin\Model\ModuleModel

Datei anzeigen Open project: zfcampus/zf-apigility-admin Class Usage Examples

Protected Properties

Property Type Description
$moduleManager Zend\ModuleManager\ModuleManager
$modules array
$restConfig array
$rpcConfig array
$services array Services for each module
$useShortArrayNotation boolean
$valueGenerator Zend\Code\Generator\ValueGenerator

Public Methods

Method Description
__construct ( Zend\ModuleManager\ModuleManager $moduleManager, array $restConfig, array $rpcConfig )
createModule ( string $module, ModulePathSpec $pathSpec ) : boolean Create a module
deleteModule ( string $module, string $path = '.', boolean $recursive = false ) : boolean Delete an existing module
exportConfig ( array $config, integer $indent ) : string Export the $config array in a human readable format
getModule ( string $moduleName ) : null | ModuleEntity
getModules ( ) : ModuleEntity[] Retrieve modules
setUseShortArrayNotation ( $flag = true ) : void Set the flag indicating whether or not generated config files should use short array notation.
updateModule ( string $module ) : boolean Update a module (adding the ApigilityModule interface)

Protected Methods

Method Description
discoverServicesByModule ( string $module, array $config ) : array Loops through an array of controllers, determining which match the given module.
getEnabledModules ( ) : array Returns list of all API-First-enabled modules
getModuleDefaultVersion ( ZF\Apigility\ApigilityModuleInterface | ZF\Apigility\Provider\ApigilityProviderInterface $module ) : integer Retrieves the configured default version for the specified module.
getServicesByModule ( string $module ) : null | array Retrieve all services for a given module
getVersionsByModule ( string $moduleName, ZF\Apigility\Provider\ApigilityProviderInterface | ZF\Apigility\ApigilityModuleInterface $module ) : array Retrieve versions by module
writeApplicationConfig ( array $application, string $path ) : boolean Write application configuration.
writeConfigFile ( array $config, string $configFile ) : boolean Write a configuration file.

Private Methods

Method Description
detectSourcePathFromModule ( string $moduleName, ZF\Apigility\Provider\ApigilityProviderInterface | ZF\Apigility\ApigilityModuleInterface $module ) : string Determine where the source path is for a module.

Method Details

__construct() public method

public __construct ( Zend\ModuleManager\ModuleManager $moduleManager, array $restConfig, array $rpcConfig )
$moduleManager Zend\ModuleManager\ModuleManager
$restConfig array
$rpcConfig array

createModule() public method

Create a module
public createModule ( string $module, ModulePathSpec $pathSpec ) : boolean
$module string
$pathSpec ModulePathSpec
return boolean

deleteModule() public method

Delete an existing module
public deleteModule ( string $module, string $path = '.', boolean $recursive = false ) : boolean
$module string
$path string
$recursive boolean
return boolean

discoverServicesByModule() protected method

Loops through an array of controllers, determining which match the given module.
protected discoverServicesByModule ( string $module, array $config ) : array
$module string
$config array
return array

exportConfig() public static method

Export the $config array in a human readable format
public static exportConfig ( array $config, integer $indent ) : string
$config array
$indent integer the initial indentation value
return string

getEnabledModules() protected method

Returns list of all API-First-enabled modules
protected getEnabledModules ( ) : array
return array

getModule() public method

public getModule ( string $moduleName ) : null | ModuleEntity
$moduleName string
return null | ModuleEntity

getModuleDefaultVersion() protected method

Retrieves the configured default version for the specified module.
protected getModuleDefaultVersion ( ZF\Apigility\ApigilityModuleInterface | ZF\Apigility\Provider\ApigilityProviderInterface $module ) : integer
$module ZF\Apigility\ApigilityModuleInterface | ZF\Apigility\Provider\ApigilityProviderInterface
return integer

getModules() public method

Retrieve modules
public getModules ( ) : ModuleEntity[]
return ModuleEntity[]

getServicesByModule() protected method

Returns null if the module is not API-enabled. Returns an array with the elements "rest" and "rpc" on success, with each being an array of controller service names.
protected getServicesByModule ( string $module ) : null | array
$module string
return null | array

getVersionsByModule() protected method

Checks each REST and RPC service name for a version subnamespace; if found, that version is added to the list.
protected getVersionsByModule ( string $moduleName, ZF\Apigility\Provider\ApigilityProviderInterface | ZF\Apigility\ApigilityModuleInterface $module ) : array
$moduleName string
$module ZF\Apigility\Provider\ApigilityProviderInterface | ZF\Apigility\ApigilityModuleInterface
return array

setUseShortArrayNotation() public method

Set the flag indicating whether or not generated config files should use short array notation.
public setUseShortArrayNotation ( $flag = true ) : void
return void

updateModule() public method

Update a module (adding the ApigilityModule interface)
public updateModule ( string $module ) : boolean
$module string
return boolean

writeApplicationConfig() protected method

If a "modules.config.php" exists, writes to that with the "modules" subkey of the provided configuration; otherwise, writes to application.config.php.
protected writeApplicationConfig ( array $application, string $path ) : boolean
$application array Application configuration.
$path string Base path of the application.
return boolean Whether or not the operation was successful.

writeConfigFile() protected method

Writes a configuration file, after first creating an archived version of it with the suffix '.old'.
protected writeConfigFile ( array $config, string $configFile ) : boolean
$config array Configuration to export.
$configFile string Configuration file to write.
return boolean

Property Details

$moduleManager protected_oe property

protected ModuleManager,Zend\ModuleManager $moduleManager
return Zend\ModuleManager\ModuleManager

$modules protected_oe property

protected array $modules
return array

$restConfig protected_oe property

protected array $restConfig
return array

$rpcConfig protected_oe property

protected array $rpcConfig
return array

$services protected_oe property

Services for each module
protected array $services
return array

$useShortArrayNotation protected_oe static_oe property

protected static bool $useShortArrayNotation
return boolean

$valueGenerator protected_oe static_oe property

protected static ValueGenerator,Zend\Code\Generator $valueGenerator
return Zend\Code\Generator\ValueGenerator