Skip to content

Commit c6e9e44

Browse files
author
Martin Brecht-Precht
committed
Increased the code climate of the ClientCertificateAuthentication class.
1 parent a26b023 commit c6e9e44

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

src/Request/Authentication/ClientCertificateAuthentication.php

+32-30
Original file line numberDiff line numberDiff line change
@@ -15,89 +15,91 @@ class ClientCertificateAuthentication implements AuthenticationInterface
1515
/**
1616
* @var string
1717
*/
18-
private $caCertificatePath;
18+
private $caCertPath;
19+
1920
/**
2021
* @var string
2122
*/
22-
private $clientCertificatePath;
23+
private $clientCertPath;
24+
2325
/**
2426
* @var string
2527
*/
26-
private $clientCertificatePassword;
28+
private $clientCertPassword;
2729

2830
/**
2931
* ClientCertificateAuthentication constructor.
3032
*
31-
* @param string $caCertificatePath
32-
* @param string $clientCertificatePath
33-
* @param string $clientCertificatePassword
33+
* @param string $caCertPath
34+
* @param string $clientCertPath
35+
* @param string $clientCertPassword
3436
*/
35-
public function __construct($caCertificatePath, $clientCertificatePath, $clientCertificatePassword)
37+
public function __construct($caCertPath, $clientCertPath, $clientCertPassword)
3638
{
37-
$this->setCaCertificatePath($caCertificatePath);
38-
$this->setClientCertificatePath($clientCertificatePath);
39-
$this->setClientCertificatePassword($clientCertificatePassword);
39+
$this->setCaCertPath($caCertPath);
40+
$this->setClientCertPath($clientCertPath);
41+
$this->setClientCertPassword($clientCertPassword);
4042
}
4143

4244
/**
4345
* @return mixed
4446
*/
45-
public function getCaCertificatePath()
47+
public function getCaCertPath()
4648
{
47-
return $this->caCertificatePath;
49+
return $this->caCertPath;
4850
}
4951

5052
/**
51-
* @param mixed $caCertificatePath
53+
* @param mixed $caCertPath
5254
* @return $this
5355
* @throws FileReadableException
5456
*/
55-
public function setCaCertificatePath($caCertificatePath)
57+
public function setCaCertPath($caCertPath)
5658
{
57-
if (!is_file($caCertificatePath)) {
59+
if (!is_file($caCertPath)) {
5860
throw new FileReadableException('CA certificate file not readable.');
5961
}
60-
$this->caCertificatePath = $caCertificatePath;
62+
$this->caCertPath = $caCertPath;
6163
return $this;
6264
}
6365

6466
/**
6567
* @return mixed
6668
*/
67-
public function getClientCertificatePath()
69+
public function getClientCertPath()
6870
{
69-
return $this->clientCertificatePath;
71+
return $this->clientCertPath;
7072
}
7173

7274
/**
73-
* @param mixed $clientCertificatePath
75+
* @param mixed $clientCertPath
7476
* @return $this
7577
* @throws FileReadableException
7678
*/
77-
public function setClientCertificatePath($clientCertificatePath)
79+
public function setClientCertPath($clientCertPath)
7880
{
79-
if (!is_file($clientCertificatePath)) {
81+
if (!is_file($clientCertPath)) {
8082
throw new FileReadableException('Client certificate file not readable.');
8183
}
82-
$this->clientCertificatePath = $clientCertificatePath;
84+
$this->clientCertPath = $clientCertPath;
8385
return $this;
8486
}
8587

8688
/**
8789
* @return mixed
8890
*/
89-
public function getClientCertificatePassword()
91+
public function getClientCertPassword()
9092
{
91-
return $this->clientCertificatePassword;
93+
return $this->clientCertPassword;
9294
}
9395

9496
/**
95-
* @param mixed $clientCertificatePassword
97+
* @param mixed $clientCertPassword
9698
* @return $this
9799
*/
98-
public function setClientCertificatePassword($clientCertificatePassword)
100+
public function setClientCertPassword($clientCertPassword)
99101
{
100-
$this->clientCertificatePassword = $clientCertificatePassword;
102+
$this->clientCertPassword = $clientCertPassword;
101103
return $this;
102104
}
103105

@@ -107,9 +109,9 @@ public function setClientCertificatePassword($clientCertificatePassword)
107109
*/
108110
public function configureCurl($curl)
109111
{
110-
curl_setopt($curl, CURLOPT_CAINFO, $this->caCertificatePath);
111-
curl_setopt($curl, CURLOPT_SSLCERT, $this->clientCertificatePath);
112-
curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $this->clientCertificatePassword);
112+
curl_setopt($curl, CURLOPT_CAINFO, $this->caCertPath);
113+
curl_setopt($curl, CURLOPT_SSLCERT, $this->clientCertPath);
114+
curl_setopt($curl, CURLOPT_SSLCERTPASSWD, $this->clientCertPassword);
113115
return $this;
114116
}
115117

0 commit comments

Comments
 (0)