本文整理匯總了PHP中Pimple::raw方法的典型用法代碼示例。如果您正苦於以下問題:PHP Pimple::raw方法的具體用法?PHP Pimple::raw怎麽用?PHP Pimple::raw使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pimple
的用法示例。
在下文中一共展示了Pimple::raw方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: set
public function set($closure)
{
if ($closure instanceof \Closure) {
if ($this->protect) {
$closure = $this->pimple->protect($closure);
}
if (!empty($this->inject)) {
$factories = array();
foreach ($this->inject as $id) {
$factory = $this->pimple->raw($id);
if (!$factory instanceof \Closure) {
throw new \InvalidArgumentException(sprintf('Identifier "%s" does not contain an object definition.', $id));
}
$factories[] = $factory;
}
$closure = function ($c) use($closure, $factories) {
$params = array_map(function ($factory) use($c) {
return $factory($c);
}, $factories);
$params[] = $c;
return call_user_func_array($closure, $params);
};
}
if ($this->share) {
$closure = $this->pimple->share($closure);
}
}
$this->pimple[$this->key] = $closure;
$this->restore();
}
示例2: raw
/**
* {@inheritdoc}
*/
public function raw($id)
{
return $this->container->raw($id);
}