本文整理匯總了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]);
}