Newscoop\Service\Implementation\ThemeManagementServiceLocal::getRelativePath PHP Метод

getRelativePath() защищенный Метод

This method also checks if the resource path is compatible with the theme path meaning that the resource needs to be placed in the theme.
protected getRelativePath ( Resource $rsc, string $themePath ) : string
$rsc Newscoop\Entity\Resource The resource to extract the relative path from, not null.
$themePath string The theme path, not null.
Результат string The relative [path in regards with the theme path for the resource.
    protected function getRelativePath(Resource $rsc, $themePath)
    {
        $path = $rsc->getPath();
        $lenght = strlen($themePath);
        if (strncmp($path, $themePath, $lenght) != 0) {
            throw new \Exception("The resource path '.{$path}.' is not for the provided theme path '.{$themePath}.'.");
        }
        $path = substr($path, $lenght);
        return $path;
    }