本文整理汇总了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);
}