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
3 changes: 0 additions & 3 deletions src/Authentication/AuthenticateInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

use Psr\Http\Message\RequestInterface;

/**
* @api
*/
interface AuthenticateInterface
{
public function getHeader(): string;
Expand Down
5 changes: 1 addition & 4 deletions src/Authentication/BasicAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

use Psr\Http\Message\RequestInterface;

/**
* @api
*/
class BasicAuthentication implements AuthenticateInterface
final class BasicAuthentication implements AuthenticateInterface
{
private string $username;
private string $password;
Expand Down
5 changes: 1 addition & 4 deletions src/Authentication/BearerAuthentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

use Psr\Http\Message\RequestInterface;

/**
* @api
*/
class BearerAuthentication implements AuthenticateInterface
final class BearerAuthentication implements AuthenticateInterface
{
public function __construct(private string $token)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Authentication/NoAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

use Psr\Http\Message\RequestInterface;

/**
* @api
*/
class NoAuth implements AuthenticateInterface
final class NoAuth implements AuthenticateInterface
{
#[\Override]
public function getHeader(): string
Expand Down
33 changes: 5 additions & 28 deletions src/Exception/Neo4jException.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,12 @@

use Exception;

/**
* @api
*/
class Neo4jException extends Exception
final class Neo4jException extends Exception
{
private readonly string $errorCode;
private readonly ?string $errorType;
private readonly ?string $errorSubType;
private readonly ?string $errorName;
public readonly string $errorCode;
public readonly ?string $errorType;
public readonly ?string $errorSubType;
public readonly ?string $errorName;

public function __construct(
array $errorDetails = [],
Expand All @@ -31,7 +28,6 @@ public function __construct(

/**
* Create a Neo4jException instance from a Neo4j error response array.
*
* @param array $response The error response from Neo4j.
* @param \Throwable|null $exception Optional previous exception for chaining.
* @return self
Expand All @@ -44,23 +40,4 @@ public static function fromNeo4jResponse(array $response, ?\Throwable $exception
return new self($errorDetails, previous: $exception);
}

public function getErrorCode(): string
{
return $this->errorCode;
}

public function getType(): ?string
{
return $this->errorType;
}

public function getSubType(): ?string
{
return $this->errorSubType;
}

public function getName(): ?string
{
return $this->errorName;
}
}
3 changes: 0 additions & 3 deletions src/Neo4jQueryAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ public function __construct(
) {
}

/**
* @api
*/
public static function login(string $address, AuthenticateInterface $auth = null): self
{
$client = Psr18ClientDiscovery::find();
Expand Down
5 changes: 1 addition & 4 deletions src/Neo4jRequestFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\StreamFactoryInterface;

/**
* @api
*/
class Neo4jRequestFactory
final class Neo4jRequestFactory
{
public function __construct(
private RequestFactoryInterface $psr17Factory,
Expand Down
35 changes: 3 additions & 32 deletions src/OGM.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
use Neo4j\QueryAPI\Objects\Path;
use InvalidArgumentException;

/**
* @api
*/
class OGM
final class OGM
{
/**
* @param array<array-key, mixed> $data
Expand Down Expand Up @@ -57,44 +54,18 @@ private function mapNode(array $nodeData): Node
{
return new Node(
labels: $nodeData['_labels'] ?? [],
properties: $this->mapProperties($nodeData['_properties'] ?? []) // ✅ Fix: Ensure properties exist
properties: $this->mapProperties($nodeData['_properties'] ?? [])
);
}

private function mapRelationship(array $relationshipData): Relationship
{
return new Relationship(
type: $relationshipData['_type'] ?? 'UNKNOWN', // ✅ Fix: Default to 'UNKNOWN'
type: $relationshipData['_type'] ?? 'UNKNOWN',
properties: $this->mapProperties($relationshipData['_properties'] ?? [])
);
}


public static function parseWKT(string $wkt): Point
{
$sridPos = strpos($wkt, ';');
if ($sridPos === false) {
throw new \InvalidArgumentException("Invalid WKT format: missing ';'");
}
$sridPart = substr($wkt, 0, $sridPos);
$srid = (int)str_replace('SRID=', '', $sridPart);

$pointPos = strpos($wkt, 'POINT');
if ($pointPos === false) {
throw new \InvalidArgumentException("Invalid WKT format: missing 'POINT'");
}
$pointPart = substr($wkt, $pointPos + 6);

$pointPart = str_replace('Z', '', $pointPart);
$pointPart = trim($pointPart, ' ()');
$coordinates = explode(' ', $pointPart);

[$x, $y, $z] = array_pad(array_map('floatval', $coordinates), 3, 0.0);

return new Point($x, $y, $z, $srid);
}


private function mapPath(array $pathData): Path
{
$nodes = [];
Expand Down
5 changes: 1 addition & 4 deletions src/Objects/Authentication.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
use Neo4j\QueryAPI\Authentication\BearerAuthentication;
use Neo4j\QueryAPI\Authentication\NoAuth;

/**
* @api
*/
class Authentication
final class Authentication
{
public static function basic(string $username, string $password): AuthenticateInterface
{
Expand Down
5 changes: 1 addition & 4 deletions src/Objects/Bookmarks.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@

use JsonSerializable;

/**
* @api
*/
class Bookmarks implements \Countable, JsonSerializable
final class Bookmarks implements \Countable, JsonSerializable
{
public function __construct(private array $bookmarks)
{
Expand Down
6 changes: 0 additions & 6 deletions src/Objects/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
* Represents a Neo4j Node with labels and properties.
*/

/**
* @api
*/
class Node
{
/**
Expand All @@ -35,7 +32,6 @@ public function __construct(array $labels, array $properties)

/**
* Get the labels of the node.
* @api
* @return string[] Array of labels.
*/
public function getLabels(): array
Expand All @@ -45,7 +41,6 @@ public function getLabels(): array

/**
* Get the properties of the node.
* @api
* @return array<string, mixed> Associative array of properties.
*/
public function getProperties(): array
Expand All @@ -55,7 +50,6 @@ public function getProperties(): array

/**
* Convert the Node object to an array representation.
* @api
* @return array Node data as an array.
*/
public function toArray(): array
Expand Down
8 changes: 2 additions & 6 deletions src/Objects/Path.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
* Represents a path in a Neo4j graph, consisting of nodes and relationships.
*/

/**
* @api
*/
class Path

final class Path
{
/**
* @var Node[] Array of nodes in the path.
Expand All @@ -35,7 +33,6 @@ public function __construct(array $nodes, array $relationships)

/**
* Get the nodes in the path.
* @api
* @return Node[] Array of nodes.
*/
public function getNodes(): array
Expand All @@ -45,7 +42,6 @@ public function getNodes(): array

/**
* Get the relationships in the path.
* @api
* @return Relationship[] Array of relationships.
*/
public function getRelationships(): array
Expand Down
5 changes: 1 addition & 4 deletions src/Objects/Person.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
* @psalm-suppress UnusedClass
* Represents a Person node in the Neo4j graph.
*/
/**
* @api
*/
class Person extends Node
final class Person extends Node
{
/**
* Person constructor.
Expand Down
11 changes: 2 additions & 9 deletions src/Objects/Point.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
/**
* Represents a point with x, y, z coordinates, and SRID (Spatial Reference System Identifier).
*/
/**
* @api
*/

class Point

final class Point
{
/**
* @param float $x The x coordinate of the point.
Expand All @@ -27,7 +25,6 @@ public function __construct(

/**
* Get the x coordinate of the point.
* @api
* @return float x coordinate value.
*/
public function getX(): float
Expand All @@ -37,7 +34,6 @@ public function getX(): float

/**
* Get the y coordinate of the point.
* @api
* @return float y coordinate value.
*/
public function getY(): float
Expand All @@ -47,7 +43,6 @@ public function getY(): float

/**
* Get the z coordinate of the point.
* @api
* @return float|null z coordinate value, or null if not applicable.
*/
public function getZ(): float|null
Expand All @@ -57,7 +52,6 @@ public function getZ(): float|null

/**
* Get the SRID (Spatial Reference System Identifier) of the point.
* @api
* @return int SRID value.
*/
public function getSrid(): int
Expand All @@ -67,7 +61,6 @@ public function getSrid(): int

/**
* Convert the Point object to a string representation.
*
* @return string String representation in the format: "SRID=<srid>;POINT (<x> <y> <z>)".
*/
public function __toString(): string
Expand Down
5 changes: 1 addition & 4 deletions src/Objects/ProfiledQueryPlanArguments.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

namespace Neo4j\QueryAPI\Objects;

/**
* @api
*/
class ProfiledQueryPlanArguments
final class ProfiledQueryPlanArguments
{
public function __construct(
public readonly ?int $globalMemory = null,
Expand Down
12 changes: 3 additions & 9 deletions src/Objects/Relationship.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
* Represents a relationship in a Neo4j graph, with a type and associated properties.
*/

/**
* @api
*/
class Relationship
final class Relationship
{
/**
* @var string The type of the relationship (e.g., "FRIENDS_WITH", "WORKS_FOR").
Expand All @@ -22,8 +19,7 @@ class Relationship
private array $properties;

/**
* Relationship constructor.
*
* Relationship constructor
* @param string $type The type of the relationship.
* @param array<string, mixed> $properties Associative array of properties for the relationship.
*/
Expand All @@ -34,8 +30,7 @@ public function __construct(string $type, array $properties = [])
}

/**
* Get the type of the relationship.
* @api
* Get the type of the relationship
* @return string The type of the relationship.
*/
public function getType(): string
Expand All @@ -45,7 +40,6 @@ public function getType(): string

/**
* Get the properties of the relationship.
* @api
* @return array<string, mixed> Associative array of properties.
*/
public function getProperties(): array
Expand Down
Loading