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; }