public function addResource($resource, $parent = NULL)
{
$this->checkResource($resource, FALSE);
if (isset($this->resources[$resource])) {
throw new Nette\InvalidStateException("Resource '{$resource}' already exists in the list.");
}
if ($parent !== NULL) {
$this->checkResource($parent);
$this->resources[$parent]['children'][$resource] = TRUE;
}
$this->resources[$resource] = ['parent' => $parent, 'children' => []];
return $this;
}