Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/workflows/integration-test-single-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ jobs:
-e PHP_VERSION=${{ matrix.php }} \
-e CONNECTION=bolt://neo4j:testtest@neo4j \
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
- name: Test http://
run: |
docker compose run \
-e PHP_VERSION=${{ matrix.php }} \
-e CONNECTION=http://neo4j:testtest@neo4j \
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
tests-v5:
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -81,9 +75,3 @@ jobs:
-e PHP_VERSION=${{ matrix.php }} \
-e CONNECTION=bolt://neo4j:testtest@neo4j \
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
- name: Test http://
run: |
docker compose run \
-e PHP_VERSION=${{ matrix.php }} \
-e CONNECTION=http://neo4j:testtest@neo4j \
client ./vendor/bin/phpunit -c phpunit.xml.dist --testsuite Integration
17 changes: 0 additions & 17 deletions src/Authentication/BasicAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

namespace Laudis\Neo4j\Authentication;

use function base64_encode;

use Bolt\protocol\V4_4;
use Bolt\protocol\V5;
use Bolt\protocol\V5_1;
Expand All @@ -25,7 +23,6 @@
use Laudis\Neo4j\Common\Neo4jLogger;
use Laudis\Neo4j\Common\ResponseHelper;
use Laudis\Neo4j\Contracts\AuthenticateInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\UriInterface;
use Psr\Log\LogLevel;

Expand All @@ -43,20 +40,6 @@ public function __construct(
private readonly ?Neo4jLogger $logger,
) {}

public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface
{
$this->logger?->log(LogLevel::DEBUG, 'Authenticating using BasicAuth');
$combo = base64_encode($this->username.':'.$this->password);

/**
* @psalm-suppress ImpureMethodCall Request is a pure object:
*
* @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-7-http-message-meta.md#why-value-objects
*/
return $request->withHeader('Authorization', 'Basic '.$combo)
->withHeader('User-Agent', $userAgent);
}

/**
* @throws Exception
*
Expand Down
2 changes: 1 addition & 1 deletion src/ClientBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/
final class ClientBuilder
{
public const SUPPORTED_SCHEMES = ['', 'bolt', 'bolt+s', 'bolt+ssc', 'neo4j', 'neo4j+s', 'neo4j+ssc', 'http', 'https'];
public const SUPPORTED_SCHEMES = ['', 'bolt', 'bolt+s', 'bolt+ssc', 'neo4j', 'neo4j+s', 'neo4j+ssc'];

/**
* @psalm-mutation-free
Expand Down
6 changes: 0 additions & 6 deletions src/Contracts/AuthenticateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@
use Bolt\protocol\V5_2;
use Bolt\protocol\V5_3;
use Bolt\protocol\V5_4;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\UriInterface;

interface AuthenticateInterface
{
/**
* Authenticates a RequestInterface with the provided configuration Uri and userAgent.
*/
public function authenticateHttp(RequestInterface $request, UriInterface $uri, string $userAgent): RequestInterface;

/**
* Authenticates a Bolt connection with the provided configuration Uri and userAgent.
*
Expand Down
39 changes: 0 additions & 39 deletions src/Contracts/FormatterInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,10 @@
namespace Laudis\Neo4j\Contracts;

use Bolt\Bolt;
use JsonException;
use Laudis\Neo4j\Bolt\BoltConnection;
use Laudis\Neo4j\Bolt\BoltResult;
use Laudis\Neo4j\Databags\BookmarkHolder;
use Laudis\Neo4j\Databags\Statement;
use Laudis\Neo4j\Http\HttpConnection;
use Laudis\Neo4j\Types\CypherList;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
use stdClass;

/**
* A formatter (aka Hydrator) is reponsible for formatting the incoming results of the driver.
Expand Down Expand Up @@ -81,37 +75,4 @@ interface FormatterInterface
* @return ResultFormat
*/
public function formatBoltResult(array $meta, BoltResult $result, BoltConnection $connection, float $runStart, float $resultAvailableAfter, Statement $statement, BookmarkHolder $holder);

/**
* Formats the results of the HTTP protocol to the unified format.
*
* @param iterable<Statement> $statements
*
* @throws JsonException
*
* @return CypherList<ResultFormat>
*
* @psalm-mutation-free
*/
public function formatHttpResult(ResponseInterface $response, stdClass $body, HttpConnection $connection, float $resultsAvailableAfter, float $resultsConsumedAfter, iterable $statements): CypherList;

/**
* Decorates a request to make make sure it requests the correct format.
*
* @see https://neo4j.com/docs/http-api/current/actions/result-format/
*
* @psalm-mutation-free
*/
public function decorateRequest(RequestInterface $request, ConnectionInterface $connection): RequestInterface;

/**
* Overrides the statement config of the HTTP protocol.
*
* @see https://neo4j.com/docs/http-api/current/actions/result-format/
*
* @return array{resultDataContents?: list<'GRAPH'|'ROW'|'REST'>, includeStats?:bool}
*
* @psalm-mutation-free
*/
public function statementConfigOverride(ConnectionInterface $connection): array;
}
36 changes: 1 addition & 35 deletions src/Databags/DriverConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,13 @@ final class DriverConfiguration
public const DEFAULT_POOL_SIZE = 0x2F;
public const DEFAULT_CACHE_IMPLEMENTATION = Cache::class;
public const DEFAULT_ACQUIRE_CONNECTION_TIMEOUT = 2.0;
/** @var callable():(HttpPsrBindings|null)|HttpPsrBindings|null */
private $httpPsrBindings;
/** @var callable():(CacheInterface|null)|CacheInterface|null */
private $cache;
/** @var callable():(SemaphoreFactoryInterface|null)|SemaphoreFactoryInterface|null */
private $semaphoreFactory;
private ?Neo4jLogger $logger;

/**
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $httpPsrBindings
* @param callable():(CacheInterface|null)|CacheInterface|null $cache
* @param callable():(SemaphoreFactoryInterface|null)|SemaphoreFactoryInterface|null $semaphore
* @param string|null $logLevel The log level to use. If null, LogLevel::INFO is used.
Expand All @@ -57,7 +54,6 @@ final class DriverConfiguration
*/
public function __construct(
private string|null $userAgent,
callable|HttpPsrBindings|null $httpPsrBindings,
private SslConfiguration $sslConfig,
private int|null $maxPoolSize,
CacheInterface|callable|null $cache,
Expand All @@ -66,7 +62,6 @@ public function __construct(
?string $logLevel,
?LoggerInterface $logger
) {
$this->httpPsrBindings = $httpPsrBindings;
$this->cache = $cache;
$this->semaphoreFactory = $semaphore;
if ($logger !== null) {
Expand All @@ -77,13 +72,10 @@ public function __construct(
}

/**
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $httpPsrBindings
*
* @pure
*/
public static function create(
?string $userAgent,
callable|HttpPsrBindings|null $httpPsrBindings,
SslConfiguration $sslConfig,
int $maxPoolSize,
CacheInterface $cache,
Expand All @@ -94,7 +86,6 @@ public static function create(
): self {
return new self(
$userAgent,
$httpPsrBindings,
$sslConfig,
$maxPoolSize,
$cache,
Expand All @@ -107,15 +98,14 @@ public static function create(

/**
* Creates a default configuration with a user agent based on the driver version
* and HTTP PSR implementation auto-detected from the environment.
* auto-detected from the environment.
*
* @pure
*/
public static function default(): self
{
return new self(
null,
HttpPsrBindings::default(),
SslConfiguration::default(),
null,
null,
Expand Down Expand Up @@ -160,21 +150,6 @@ public function withUserAgent($userAgent): self
return $tbr;
}

/**
* Creates a new configuration with the provided bindings.
*
* @param callable():(HttpPsrBindings|null)|HttpPsrBindings|null $bindings
*
* @psalm-immutable
*/
public function withHttpPsrBindings($bindings): self
{
$tbr = clone $this;
$tbr->httpPsrBindings = $bindings;

return $tbr;
}

/**
* @psalm-immutable
*/
Expand All @@ -194,15 +169,6 @@ public function getSslConfiguration(): SslConfiguration
return $this->sslConfig;
}

public function getHttpPsrBindings(): HttpPsrBindings
{
$this->httpPsrBindings = (is_callable($this->httpPsrBindings)) ? call_user_func(
$this->httpPsrBindings
) : $this->httpPsrBindings;

return $this->httpPsrBindings ??= HttpPsrBindings::default();
}

public function getMaxPoolSize(): int
{
return $this->maxPoolSize ?? self::DEFAULT_POOL_SIZE;
Expand Down
133 changes: 0 additions & 133 deletions src/Databags/HttpPsrBindings.php

This file was deleted.

Loading
Loading