Skip to content

Commit

Permalink
restoring get Adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
stovak committed Jan 27, 2025
1 parent d9aee1e commit 73913af
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 15 additions & 2 deletions src/Services/PantheonGuzzle.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
*/
class PantheonGuzzle extends Client implements
ClientInterface,
LoggerAwareInterface,
AdapterInterface {
LoggerAwareInterface {
use LoggerAwareTrait;
use EndpointAwareTrait;

Expand Down Expand Up @@ -167,4 +166,18 @@ public function requestUriAlterForPantheonEnvironment(RequestInterface $request)
return $request->withUri($uri);
}

/**
* Get a PSR adapter interface based on this class.
*
* @return \Solarium\Core\Client\Adapter\AdapterInterface
* The interface in question.
*/
public function getAdapter(): AdapterInterface {
return new Psr18Adapter(
$this,
new RequestFactory(),
new StreamFactory()
);
}

}
7 changes: 1 addition & 6 deletions src/Services/SolariumClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@ public function __construct(
EventDispatcherInterface $event_dispatcher) {
$drupal_major_parts = explode('.', \Drupal::VERSION);
$drupal_major = reset($drupal_major_parts);
$psr18 = new Psr18Adapter(
$guzzle,
new RequestFactory(),
new StreamFactory(),
);
parent::__construct(
$psr18,
$psr18->getAdapter(),

Check warning on line 32 in src/Services/SolariumClient.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Services/SolariumClient.php#L32

Avoid unused local variables such as '$psr18'.

Check notice on line 32 in src/Services/SolariumClient.php

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

src/Services/SolariumClient.php#L32

Avoid using undefined variables such as '$psr18' which will lead to PHP notices.
$event_dispatcher,
['endpoint' => [$endpoint]],
);
Expand Down

0 comments on commit 73913af

Please sign in to comment.