本文整理汇总了PHP中Nette\DI\Container::isCreated方法的典型用法代码示例。如果您正苦于以下问题:PHP Container::isCreated方法的具体用法?PHP Container::isCreated怎么用?PHP Container::isCreated使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Nette\DI\Container
的用法示例。
在下文中一共展示了Container::isCreated方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: flush
public function flush()
{
$mappers = [];
foreach ($this->repositories['names'] as $name) {
if ($this->container->isCreated($name)) {
$mappers[] = $this->container->getService($name)->getMapper();
}
}
foreach ($mappers as $mapper) {
$mapper->flush();
}
}
示例2: renderListeners
private function renderListeners($ids)
{
static $addIcon;
if (empty($addIcon)) {
$addIcon = '<img width="18" height="18" src="data:image/png;base64,' . base64_encode(file_get_contents(__DIR__ . '/add.png')) . '" title="Listener" />';
}
$registeredClasses = $this->getClassMap();
$h = 'htmlspecialchars';
$shortFilename = function (Nette\Reflection\GlobalFunction $refl) {
$title = '.../' . basename($refl->getFileName()) . ':' . $refl->getStartLine();
if ($editor = Tracy\Helpers::editorUri($refl->getFileName(), $refl->getStartLine())) {
return sprintf(' defined at <a href="%s">%s</a>', htmlspecialchars($editor), $title);
}
return ' defined at ' . $title;
};
$s = '';
foreach ($ids as $id) {
if (is_callable($id)) {
$s .= '<tr><td width=18>' . $addIcon . '</td><td><pre class="nette-dump"><span class="nette-dump-object">' . Callback::toString($id) . ($id instanceof \Closure ? $shortFilename(Callback::toReflection($id)) : '') . '</span></span></th></tr>';
continue;
}
if (!$this->sl->isCreated($id) && ($class = array_search($id, $registeredClasses, TRUE))) {
$s .= '<tr><td width=18>' . $addIcon . '</td><td><pre class="nette-dump"><span class="nette-dump-object">' . $h(Nette\Reflection\ClassType::from($class)->getName()) . '</span></span></th></tr>';
} else {
try {
$s .= '<tr><td width=18>' . $addIcon . '</td><td>' . self::dumpToHtml($this->sl->getService($id)) . '</th></tr>';
} catch (\Exception $e) {
$s .= "<tr><td colspan=2>Service {$id} cannot be loaded because of exception<br><br>\n" . (string) $e . '</td></th>';
}
}
}
return $s;
}
示例3: isCreated
public function isCreated($className)
{
return $this->container->isCreated($this->repositoryNamesMap[$className]);
}