public function setPublicPath($path)
    {
        if ($path === null) {
            $this->publicPath = null;
            return $this;
        }

        if (!is_string($path)) {
            throw new InvalidArgumentException(
                'The public path must be a string'
            );
        }

        $this->publicPath = rtrim(realpath($path), '\\/').DIRECTORY_SEPARATOR;
        return $this;
    }