private function checkedPathFor(string $resource): string
    {
        $completePath = $this->completePath($resource);
        if (!file_exists($completePath)) {
            throw new \DomainException('Resource ' . $completePath . ' not found');
        }

        if (!$this->rootpath->contains($completePath)) {
            throw new \OutOfBoundsException(
                    'Given resource "' . $resource
                    . '" located at "' . $completePath
                    . '" is not inside root path ' . $this->rootpath
            );
        }

        return $completePath;
    }