public static function isContextPath($contextPath) { return strpos($contextPath, '@') !== false; }
/** * @param string $path an absolute or relative node path which possibly contains context information, for example "/sites/somesite/the/node/path@some-workspace" * @return string the same path without context information */ protected function removeContextFromPath($path) { if ($path === '' || NodePaths::isContextPath($path) === false) { return $path; } try { $nodePathAndContext = NodePaths::explodeContextPath($path); // This is a workaround as we potentially prepend the context path with "/" in buildContextFromRequestPath to create a valid context path, // the code in this class expects an empty nodePath though for the site node, so we remove it again at this point. return $nodePathAndContext['nodePath'] === '/' ? '' : $nodePathAndContext['nodePath']; } catch (\InvalidArgumentException $exception) { } return null; }