本文整理汇总了PHP中Nette\DI\ContainerBuilder::getDependencies方法的典型用法代码示例。如果您正苦于以下问题:PHP ContainerBuilder::getDependencies方法的具体用法?PHP ContainerBuilder::getDependencies怎么用?PHP ContainerBuilder::getDependencies使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\DI\ContainerBuilder
的用法示例。
在下文中一共展示了ContainerBuilder::getDependencies方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateCode
/** @internal */
public function generateCode(string $className, string $parentName = NULL) : array
{
$this->builder->prepareClassList();
foreach ($this->extensions as $extension) {
$extension->beforeCompile();
$this->dependencies[] = (new \ReflectionClass($extension))->getFileName();
}
$classes = $this->builder->generateClasses($className, $parentName);
$classes[0]->addMethod('initialize');
$this->addDependencies($this->builder->getDependencies());
foreach ($this->extensions as $extension) {
$extension->afterCompile($classes[0]);
}
return $classes;
}
示例2: generateCode
/** @internal */
public function generateCode()
{
if (func_num_args()) {
trigger_error(__METHOD__ . ' arguments are deprecated, use Compiler::setClassName().', E_USER_DEPRECATED);
$this->className = func_get_arg(0) ?: $this->className;
}
$this->builder->prepareClassList();
foreach ($this->extensions as $extension) {
$extension->beforeCompile();
$this->dependencies->add([(new \ReflectionClass($extension))->getFileName()]);
}
$generator = new PhpGenerator($this->builder);
$classes = $generator->generate($this->className);
$classes[0]->addMethod('initialize');
$this->dependencies->add($this->builder->getDependencies());
foreach ($this->extensions as $extension) {
$extension->afterCompile($classes[0]);
}
return $classes;
}
示例3: generateCode
/** @internal */
public function generateCode($className, $parentName = NULL)
{
$this->builder->prepareClassList();
$state = serialize($this->builder->getDefinitions());
foreach ($this->extensions as $extension) {
$extension->beforeCompile();
$rc = new \ReflectionClass($extension);
$this->dependencies[] = $rc->getFileName();
if ($state !== serialize($this->builder->getDefinitions())) {
$this->builder->prepareClassList();
$state = serialize($this->builder->getDefinitions());
}
}
$classes = $this->builder->generateClasses($className, $parentName);
$classes[0]->addMethod('initialize');
$this->addDependencies($this->builder->getDependencies());
foreach ($this->extensions as $extension) {
$extension->afterCompile($classes[0]);
}
return $classes;
}