-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathTransferrer.php
More file actions
50 lines (41 loc) · 1.31 KB
/
Transferrer.php
File metadata and controls
50 lines (41 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
declare(strict_types = 1);
namespace FioApi;
use GuzzleHttp\ClientInterface;
abstract class Transferrer
{
protected UrlBuilder $urlBuilder;
protected ?ClientInterface $client;
protected string $certificatePath;
protected function __construct(
string $token,
ClientInterface $client = null
) {
$this->urlBuilder = new UrlBuilder($token);
$this->client = $client;
}
public function setCertificatePath(string $path)
{
$this->certificatePath = $path;
}
public function getCertificatePath(): string
{
if (isset($this->certificatePath)) {
return $this->certificatePath;
}
if (class_exists('\Composer\CaBundle\CaBundle')) {
return \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
} elseif (class_exists('\Kdyby\CurlCaBundle\CertificateHelper')) {
return \Kdyby\CurlCaBundle\CertificateHelper::getCaInfoFile();
}
//Key downloaded from https://www.geotrust.com/resources/root-certificates/
return __DIR__ . '/keys/Geotrust_PCA_G3_Root.pem';
}
public function getClient(): ClientInterface
{
if (isset($this->client) === false) {
$this->client = new \GuzzleHttp\Client();
}
return $this->client;
}
}