Set a CA Certificate to validate peers
@param string $path
@param string $type Can be capath or cainfo
@throws \OtherCode\Rest\Exceptions\RestException
@return $this
191739
public function setCACertificates($path, $type)
    {
        if (!in_array($type, array('capath', 'cainfo'))) {
            throw new \OtherCode\Rest\Exceptions\RestException('Invalid param "type" in for ' . __METHOD__ . 'method.');
        }

        $this->ssl_verifypeer = true;
        $this->ssl_verifyhost = 2;
        $this->$type = $path;
        return $this;
    }
997119
public function setPath(Path $path = null)
    {
        if (!empty($this->path)) {
            $this->path->removeStep($this);
        }

        $this->path = $path;

        if (!empty($path)) {
            $path->addStep($this);
        }

        return $this;
    }
71970
protected function adapter(string $type, string $path): DriverInterface
    {
        if (!$this->corundum->exists($type))
        {
            throw new Invalid('Unknown type `' . $type . '`');
        }

        return $this->corundum->{$type}($path);
    }
1126452
public static function setSslCertificate($path, $password=false)
	{
		self::$options[CURLOPT_SSLCERT] = $path;

		if ($password) {
			self::$options[CURLOPT_SSLCERTPASSWD] = $password;
		}
	}
830919
public function permission(String $path, Int $type = 0755) : Bool
    {
        if( ftp_chmod($this->connect, $type, $path) )
        {
            return true;
        }
        else
        {
            throw new IOException(NULL, '$this->connect');
        }
    }
344871
private function createFromGif(string $path): self
    {
        $imageData = imagecreatefromgif($path);
        if (false === $imageData) {
            throw new ImageException(sprintf('Unable to create GIF image from %s!', $path));
        }
        $this->workingData = $imageData;
        $this->setTransparency();
        $this->encrypted = false;
        return $this;
    }
1225277
public function sslKey($path, $type = null, $password = null)
    {
        $this->keyPath = $path;
        if(null !== $type)
        {
            $this->keyType = $type;
        }
        if(null !== $password)
        {
            $this->keyPassword = $password;
        }
        return $this;
    }
678261
protected function createDetection($path, $type = Detection::TYPE_VIRUS, $description = null)
    {
        $detection = new Detection($path, $type, $description);

        return $detection;
    }
418195
public function save($path)
    {
        $this->validate();
        $path = rtrim($path, "\\/") . DS;
        $this->_savePackage($path);
        return $this;
    }
865701
public function upload($type, $path)
    {
        if (!file_exists($path) || !is_readable($path)) {
            throw new InvalidArgumentException("File does not exist, or the file is unreadable: '$path'");
        }

        if (!in_array($type, $this->allowTypes, true)) {
            throw new InvalidArgumentException("Unsupported media type: '{$type}'");
        }

        return $this->parseJSON('upload', [self::API_UPLOAD, ['media' => $path], [], ['type' => $type]]);
    }
1307182
public function set($type, $path)
    {
        if ($path instanceof pathmanager\FallbackInterface) {
            $this->paths[$type] = $path;
            return $this;
        }

        if (is_array($path)) {
            if (isset($this->paths[$type])) {
                $fallback = $this->paths[$type];
                if (!$fallback instanceof pathmanager\FallbackInterface) {
                    $first = $fallback;
                    $fallback = new pathmanager\DefaultFallback();
                    $fallback->addPath($first);
                }
            } else {
                $fallback = new pathmanager\DefaultFallback();
            }

            $this->paths[$type] = $fallback;
            foreach ($path as $item) {
                $this->set($type, $item);
            }

            return $this;
        }

        $path = $this->prepare($path);

        if (isset($this->paths[$type]) && ($this->paths[$type] instanceof pathmanager\FallbackInterface)) {
            $this->paths[$type]->addPath($path);
        } else {
            $this->paths[$type] = $path;
        }

        return $this;
    }
138814
private function readCertificateFromDisk($path)
    {
        $cert = @file_get_contents($path);
        if ($cert === false) {
            throw new \Exception('Can not read certificate from location: '.$path, 1);
        }

        return $cert;
    }
1115120
public function upload(string $type, string $path): array
    {
        return $this->httpClient->postFile('media/upload', $path, compact('type'));
    }
261736
public function setType(?string $type): self
    {
        $this->type                          = $this->validateType($type);
        $this->type_hint || $this->type_hint = $this->type;

        return $this;
    }
791284
private function createFromPng(string $path): self
    {
        $imageData = imagecreatefrompng($path);
        if (false === $imageData) {
            throw new ImageException(sprintf('Unable to create PNG image from %s!', $path));
        }
        $this->workingData = $imageData;
        $this->setTransparency(false, true);
        $this->encrypted = false;
        return $this;
    }
1091302
public function setPath( $path )
    {
        // Validate $path, it cant be null and must exist
        if ( ! is_string( $path ) ){ throw new InvalidPathException( 'Path must be of type string' ); }
        if ( is_null( $path ) ){ throw new InvalidPathException( 'Path can not be null' ); }
        if ( ! file_exists( $path )){ throw new InvalidPathException( '('. $path .') is invalid' ); }

        $this->path = $path;
    }
150224
public function setSSLCert($certPath, $passPhrase = null)
    {
        $this->curlOptions[CURLOPT_SSLCERT] = realpath($certPath);
        if (isset($passPhrase) && trim($passPhrase) != "") {
            $this->curlOptions[CURLOPT_SSLCERTPASSWD] = $passPhrase;
        }
    }