本文整理汇总了PHP中ExtensionManager::_providers方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager::_providers方法的具体用法?PHP ExtensionManager::_providers怎么用?PHP ExtensionManager::_providers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtensionManager
的用法示例。
在下文中一共展示了ExtensionManager::_providers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProvidersOf
/**
* Return an array all the Provider objects supplied by extensions,
* optionally filtered by a given `$type`.
*
* @since Symphony 2.3
* @todo Add information about the possible types
* @param string $type
* This will only return Providers of this type. If null, which is
* default, all providers will be returned.
* @return array
* An array of objects
*/
public static function getProvidersOf($type = null)
{
// Loop over all extensions and build an array of providable objects
if (empty(self::$_providers)) {
self::$_providers = array();
foreach (self::listInstalledHandles() as $handle) {
$obj = self::getInstance($handle);
if (!method_exists($obj, 'providerOf')) {
continue;
}
$providers = $obj->providerOf();
if (empty($providers)) {
continue;
}
// For each of the matching objects (by $type), resolve the object path
self::$_providers = array_merge_recursive(self::$_providers, $obj->providerOf());
}
}
// Return an array of objects
if (is_null($type)) {
return self::$_providers;
}
if (!isset(self::$_providers[$type])) {
return array();
}
return self::$_providers[$type];
}