Skip to content

Commit

Permalink
fix phpcs errors
Browse files Browse the repository at this point in the history
  • Loading branch information
daalvand committed Aug 6, 2020
1 parent dece761 commit e757b10
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
5 changes: 2 additions & 3 deletions src/ClientConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ClientConfiguration
'bigintConversion' => false,
'username' => null,
'password' => null,
'auth_type' => null //basic, digest, gssnegotiate, ntlm
'auth_type' => null, //basic, digest, gssnegotiate, ntlm
];

/**
Expand Down Expand Up @@ -83,11 +83,10 @@ public static function fromDsn(string $dsn): self
$clientConfiguration->set('password', \urldecode($parsedDsn['pass']));
}

if (isset($parsedDsn['pass']) && isset($parsedDsn['user'])) {
if (isset($parsedDsn['pass'], $parsedDsn['user'])) {
$clientConfiguration->set('auth_type', 'basic');
}


if (isset($parsedDsn['port'])) {
$clientConfiguration->set('port', $parsedDsn['port']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,6 @@ public function getPassword()
*/
public function getAuthType()
{
return $this->hasParam('auth_type') ? strtolower($this->getParam('auth_type')) : null;
return $this->hasParam('auth_type') ? \strtolower($this->getParam('auth_type')) : null;
}
}
10 changes: 5 additions & 5 deletions src/Transport/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Http extends AbstractTransport
* Makes calls to the elasticsearch server.
*
* All calls that are made to the server are done through this function
* @param Request $request
*
* @param array $params Host, Port, ...
*
* @throws ConnectionException
Expand Down Expand Up @@ -226,16 +226,16 @@ protected function _getConnection(bool $persistent = true)
protected function _getAuthType()
{
switch ($this->_connection->getAuthType()) {
case "digest":
case 'digest':
return CURLAUTH_DIGEST;
break;
case "gssnegotiate":
case 'gssnegotiate':
return CURLAUTH_GSSNEGOTIATE;
break;
case "ntlm":
case 'ntlm':
return CURLAUTH_NTLM;
break;
case "basic":
case 'basic':
return CURLAUTH_BASIC;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion tests/ClientConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function testFromEmptyArray(): void
'bigintConversion' => false,
'username' => null,
'password' => null,
'auth_type' => null
'auth_type' => null,
];

$this->assertEquals($expected, $configuration->getAll());
Expand Down

0 comments on commit e757b10

Please sign in to comment.