Skip to content

Commit f74d04e

Browse files
committed
Extract handling bind result into trait method for consistency
1 parent 20348b0 commit f74d04e

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

src/HandlesConnection.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,16 @@ public function getExtendedError(): ?string
152152
return $this->getDiagnosticMessage();
153153
}
154154

155+
/**
156+
* Handle the bind response.
157+
*/
158+
protected function handleBindResponse(LdapResultResponse $response): void
159+
{
160+
$this->bound = $response->successful();
161+
162+
$this->secure = $this->secure ?: $this->bound && $this->isUsingSSL();
163+
}
164+
155165
/**
156166
* Convert warnings to exceptions for the given operation.
157167
*

src/Ldap.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -276,9 +276,7 @@ public function bind(?string $dn = null, ?string $password = null, ?array $contr
276276

277277
$response = $this->parseResult($result);
278278

279-
$this->bound = $response && $response->successful();
280-
281-
$this->secure = $this->secure ?: $this->bound && $this->isUsingSSL();
279+
$this->handleBindResponse($response);
282280

283281
return $response;
284282
}

src/Testing/LdapFake.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public function bind(?string $dn = null, ?string $password = null, ?array $contr
368368
{
369369
$result = $this->resolveExpectation(__FUNCTION__, func_get_args());
370370

371-
$this->bound = $result->successful();
371+
$this->handleBindResponse($result);
372372

373373
return $result;
374374
}

0 commit comments

Comments
 (0)