本文整理汇总了PHP中Zend\ServiceManager\AbstractPluginManager::configure方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractPluginManager::configure方法的具体用法?PHP AbstractPluginManager::configure怎么用?PHP AbstractPluginManager::configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\ServiceManager\AbstractPluginManager
的用法示例。
在下文中一共展示了AbstractPluginManager::configure方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configure
/**
* Pre-process configuration. (v3)
*
* Checks for invokables, and, if found, maps them to the
* component-specific RouteInvokableFactory; removes the invokables entry
* before passing to the parent.
*
* @param array $config
* @return void
*/
public function configure(array $config)
{
if (isset($config['invokables']) && !empty($config['invokables'])) {
$aliases = $this->createAliasesForInvokables($config['invokables']);
$factories = $this->createFactoriesForInvokables($config['invokables']);
if (!empty($aliases)) {
$config['aliases'] = isset($config['aliases']) ? array_merge($config['aliases'], $aliases) : $aliases;
}
$config['factories'] = isset($config['factories']) ? array_merge($config['factories'], $factories) : $factories;
unset($config['invokables']);
}
parent::configure($config);
}
示例2: configure
/**
* Overrides parent::configure in order to ensure default initializers are in expected positions.
*
* Always pushes `injectFactory` to top of initializer stack, and
* `callElementInit` to the bottom.
*
* {@inheritDoc}
*/
public function configure(array $config)
{
$firstInitializer = [$this, 'injectFactory'];
$lastInitializer = [$this, 'callElementInit'];
foreach ([$firstInitializer, $lastInitializer] as $default) {
if (false === ($index = array_search($default, $this->initializers))) {
continue;
}
unset($this->initializers[$index]);
}
parent::configure($config);
array_unshift($this->initializers, $firstInitializer);
array_push($this->initializers, $lastInitializer);
return $this;
}