Contao\CoreBundle\Util\SymlinkUtil::validateSymlink PHP Method

    public static function validateSymlink($target, $link, $rootDir)
    {
        if ('' === $target) {
            throw new \InvalidArgumentException('The symlink target must not be empty.');
        }
        if ('' === $link) {
            throw new \InvalidArgumentException('The symlink path must not be empty.');
        }
        if (false !== strpos($link, '../')) {
            throw new \InvalidArgumentException('The symlink path must not be relative.');
        }
        $fs = new Filesystem();
        if ($fs->exists($rootDir . '/' . $link) && !is_link($rootDir . '/' . $link)) {
            throw new \LogicException(sprintf('The path "%s" exists and is not a symlink.', $link));
        }
    }