diff --git a/.github/workflows/codacy.yml b/.github/workflows/codacy.yml index 7485bcd..358df03 100644 --- a/.github/workflows/codacy.yml +++ b/.github/workflows/codacy.yml @@ -55,6 +55,6 @@ jobs: # Upload the SARIF file generated in the previous step - name: Upload SARIF results file - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: results.sarif diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 228ce46..b6f5381 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,9 +2,9 @@ name: PHP on: push: - branches: [ develop ] + branches: [ main, develop ] pull_request: - branches: [ develop ] + branches: [ main, develop ] permissions: contents: read diff --git a/.gitignore b/.gitignore index fbd2f08..e342f1b 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ build/ cache/ coverage.xml *.phar -docs/ # Ignore documentation generation script documentation.php diff --git a/README.md b/README.md index 2c507d5..d7d9c4e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ ## Installation ### Using composer - - Run the command bellow on your project root.
+ - Run the command below on your project root.
`composer require lvieira/arangodb-php-odm` ## Usage @@ -27,7 +27,7 @@ $connection = new Connection([ 'database' => 'YourDatabase', ]); -// Alternatively, you can set an host and a port to connect +// Alternatively, you can set a host and a port to connect $connection = new Connection([ 'host' => 'http://yourarangohost', 'port' => 8529, @@ -68,25 +68,25 @@ $connection = new Connection([ $database = $connection->getDatabase(); -// With database object, we can retrive informations about it. +// With a database object, we can retrieve information about it. $infoAboutCurrentDatabase = $database->getInfo(); -// Check if database has a collection +// Check if the database has a collection if($database->hasCollection('my_collection_name')){ echo "Collection exists!"; } else { - echo "Collection doesn't exists"; + echo "Collection doesn't exist"; } -// We can also create collections in database +// We can also create collections in the database $collection = $database->createCollection('my_new_colletion'); // Or retrieve existing collections $collection = $database->getCollection('my_existing_collection'); -// With Database class we can create and drop databases +// With the Database class we can create and drop databases -// Lists the databases on server +// Lists the databases on the server $dbList = Database::list($connection); // You can create a new database using the existing connection @@ -116,13 +116,13 @@ $connection = new Connection([ $database = $connection->getDatabase(); -// If collection exists on database, the object will be a representation of it. +// If a collection exists on a database, the object will represent it. $collection = new Collection('my_collection_name', $database); -// If collection not exists, you can create it with method 'save' +// If the collection does not exist, you can create it with the method 'save' $collection->save(); -// Get all documents from collection +// Get all documents from the collection foreach ($collection->all() as $document){ // Do something. } @@ -175,7 +175,7 @@ $document->save(); $document->status = 'active'; $document->save(); // Will update your document on server; -// Delete the document from collection. +// Delete the document from the collection. $document->delete(); ``` @@ -206,7 +206,7 @@ try { $transaction = new JavascriptTransaction($this->getConnectionObject(), $action, $options); $result = $transaction->execute(); // Will return 1. } catch (TransactionException $transactionException) { - // Throws an TransactionException in case of error. + // Throws a TransactionException in case of error. return $transactionException->getMessage(); } ``` @@ -265,8 +265,8 @@ try { ## Documentation -Check the [full documentation](https://lucassouzavieira.github.io/arangodb-php-odm/v1.0.0/index.html) of project: +Check the [API Reference](https://lucassouzavieira.github.io/arangodb-php-odm/). ## Contributing -[Check how contribute in this project](CONTRIBUTING.md) +[Check how to contribute to this project](CONTRIBUTING.md) diff --git a/docs/classes/ArangoDB-AQL-AQL.html b/docs/classes/ArangoDB-AQL-AQL.html index 21b0466..c792cf7 100644 --- a/docs/classes/ArangoDB-AQL-AQL.html +++ b/docs/classes/ArangoDB-AQL-AQL.html @@ -355,9 +355,9 @@

Returns all registered AQL user functions.

diff --git a/docs/classes/ArangoDB-AQL-BindContainer.html b/docs/classes/ArangoDB-AQL-BindContainer.html index 5daa7be..ec25eaa 100644 --- a/docs/classes/ArangoDB-AQL-BindContainer.html +++ b/docs/classes/ArangoDB-AQL-BindContainer.html @@ -360,7 +360,7 @@

 : mixed -
Get a value by it's key
+
Get a value by its key
getAll() @@ -705,11 +705,11 @@

-

Get a value by it's key

+

Get a value by its key

public - get( $key) : mixed + get(int|string $key) : mixed
@@ -718,7 +718,7 @@

Parameters
$key - : + : int|string

Key to verify on list.

diff --git a/docs/classes/ArangoDB-AQL-Functions-AQLFunction.html b/docs/classes/ArangoDB-AQL-Functions-AQLFunction.html index fce1629..6e162a9 100644 --- a/docs/classes/ArangoDB-AQL-Functions-AQLFunction.html +++ b/docs/classes/ArangoDB-AQL-Functions-AQLFunction.html @@ -271,7 +271,7 @@

-

Represents an user defined aql function on server.

+

Represents a user defined AQL function on server.

@@ -436,9 +436,9 @@

AQLFunction constructor.

@@ -517,9 +517,9 @@

Removes an AQL function from server, if possible

@@ -573,9 +573,9 @@

Returns the AQL function code.

@@ -610,9 +610,9 @@

If the object has performed a delete operation, this method will return the deletion data.

@@ -647,9 +647,9 @@

Returns the AQL function name.

@@ -684,9 +684,9 @@

If this AQL function has a connection set or not.

@@ -705,7 +705,7 @@

Return values
bool — -

True if has a connection object. False otherwise.

+

True if it has a connection object. False otherwise.

@@ -725,9 +725,9 @@

Indicates if the function results are deterministic. <br>

@@ -762,9 +762,9 @@

If the AQLFunction object is a new created AQLFunction (and not exists on server) <br> @@ -800,9 +800,9 @@

Return a JSON representation of AQL function object.

@@ -837,9 +837,9 @@

Saves the AQL function on server.

@@ -893,9 +893,9 @@

Sets a connection to use.

@@ -938,9 +938,9 @@

Returns a array representation of AQL function object.

diff --git a/docs/classes/ArangoDB-Admin-Admin.html b/docs/classes/ArangoDB-Admin-Admin.html index df50d7d..15d3a47 100644 --- a/docs/classes/ArangoDB-Admin-Admin.html +++ b/docs/classes/ArangoDB-Admin-Admin.html @@ -394,9 +394,9 @@

Flushes the <b>write-ahead log</b>. By flushing the currently active write-ahead @@ -552,9 +552,9 @@

Returns all tasks of server information.

@@ -620,9 +620,9 @@

Returns the system time.

@@ -765,9 +765,9 @@

Retrieves the configuration of the <b>write-ahead log</b>.

@@ -847,9 +847,9 @@

Returns information about the currently running transactions.

diff --git a/docs/classes/ArangoDB-Admin-Server.html b/docs/classes/ArangoDB-Admin-Server.html index ed3bb2f..eb450e5 100644 --- a/docs/classes/ArangoDB-Admin-Server.html +++ b/docs/classes/ArangoDB-Admin-Server.html @@ -456,9 +456,9 @@

Checks if the Arango server is available for arbitrary operations.<br> @@ -526,9 +526,9 @@

Returns the server's current log level settings.

@@ -594,9 +594,9 @@

Returns the role of a server in a cluster.

diff --git a/docs/classes/ArangoDB-Admin-Task-Task.html b/docs/classes/ArangoDB-Admin-Task-Task.html index 30cf497..83c32f3 100644 --- a/docs/classes/ArangoDB-Admin-Task-Task.html +++ b/docs/classes/ArangoDB-Admin-Task-Task.html @@ -530,9 +530,9 @@

Removes a task from server, if possible.

@@ -780,9 +780,9 @@

Return a JSON representation of Task object.

diff --git a/docs/classes/ArangoDB-Auth-User.html b/docs/classes/ArangoDB-Auth-User.html index 921c573..ba40d50 100644 --- a/docs/classes/ArangoDB-Auth-User.html +++ b/docs/classes/ArangoDB-Auth-User.html @@ -344,7 +344,7 @@

__toString() -  : false|mixed|string +  : string
String representation of User object.
@@ -447,9 +447,9 @@

User constructor.

@@ -525,9 +525,9 @@

Proper debug dump for User objects.

@@ -562,9 +562,9 @@

Get some attribute.

@@ -615,16 +615,16 @@

String representation of User object.

public - __toString() : false|mixed|string + __toString() : string
@@ -634,7 +634,7 @@

Return values
- false|mixed|string + string
@@ -652,9 +652,9 @@

Removes an user from server.

@@ -708,9 +708,9 @@

Returns extra data about user.

@@ -745,9 +745,9 @@

Returns the username.

@@ -782,9 +782,9 @@

Get the activation status of the user.

@@ -819,9 +819,9 @@

Returns true if is a new user.

@@ -856,9 +856,9 @@

Return a JSON representation of list.

@@ -893,9 +893,9 @@

Saves (or update) a user on server

@@ -949,9 +949,9 @@

Set the activation status of the user.

@@ -992,9 +992,9 @@

Set extra data for user.

@@ -1035,9 +1035,9 @@

Returns a array representation of user

diff --git a/docs/classes/ArangoDB-Connection-Connection.html b/docs/classes/ArangoDB-Connection-Connection.html index edc021f..0533958 100644 --- a/docs/classes/ArangoDB-Connection-Connection.html +++ b/docs/classes/ArangoDB-Connection-Connection.html @@ -447,9 +447,9 @@

Connection constructor.

@@ -507,9 +507,9 @@

Proper debug dump for connection objects.

@@ -544,9 +544,9 @@

Makes a custom HTTP request.

@@ -635,9 +635,9 @@

Executes a DELETE request on server.

@@ -717,9 +717,9 @@

Executes a GET request on server.

@@ -799,9 +799,9 @@

Return the base endpoint URI.

@@ -836,9 +836,9 @@

Return the database object for this connection

@@ -888,9 +888,9 @@

Return the name of database handled

@@ -925,9 +925,9 @@

Return the connection default headers.

@@ -962,9 +962,9 @@

Returns the name of user on server

@@ -999,9 +999,9 @@

If connection is authenticated.

@@ -1040,9 +1040,9 @@

Executes a PATCH request on server.

@@ -1122,9 +1122,9 @@

Executes a POST request on server.

@@ -1204,9 +1204,9 @@

Executes a PUT request on server.

@@ -1286,9 +1286,9 @@

Set the connection default headers.

diff --git a/docs/classes/ArangoDB-DataStructures-ArrayList.html b/docs/classes/ArangoDB-DataStructures-ArrayList.html index 2b4a81b..c22f994 100644 --- a/docs/classes/ArangoDB-DataStructures-ArrayList.html +++ b/docs/classes/ArangoDB-DataStructures-ArrayList.html @@ -367,7 +367,7 @@

 : mixed

-
Get a value by it's key
+
Get a value by its key
has() @@ -715,11 +715,11 @@

-

Get a value by it's key

+

Get a value by its key

public - get( $key) : mixed + get(int|string $key) : mixed
@@ -728,7 +728,7 @@

Parameters
$key - : + : int|string

Key to verify on list.

diff --git a/docs/classes/ArangoDB-Document-Document.html b/docs/classes/ArangoDB-Document-Document.html index 7092fa3..ef14bd7 100644 --- a/docs/classes/ArangoDB-Document-Document.html +++ b/docs/classes/ArangoDB-Document-Document.html @@ -353,7 +353,7 @@

 : string

-
Return an string representation of document.
+
Return a string representation of document.
__unset() @@ -460,9 +460,9 @@

Document constructor.

@@ -529,9 +529,9 @@

Get some attribute.

@@ -582,9 +582,9 @@

Verifies if an attribute is set on document

@@ -629,9 +629,9 @@

Set a attribute

@@ -694,12 +694,12 @@

-

Return an string representation of document.

+

Return a string representation of document.

public @@ -731,9 +731,9 @@

Unset the given attribute of document

@@ -774,9 +774,9 @@

Removes a document on server, if possible

@@ -830,9 +830,9 @@

Returns the document collection

@@ -871,9 +871,9 @@

Returns the document Id

@@ -912,9 +912,9 @@

Returns the document key

@@ -953,9 +953,9 @@

Returns the document revision

@@ -994,9 +994,9 @@

Returns true if is a new object

@@ -1031,9 +1031,9 @@

@@ -1082,9 +1082,9 @@

Save or update the document, if possible

@@ -1150,9 +1150,9 @@

Sets the collection to add this document

@@ -1193,9 +1193,9 @@

Returns a array representation of document

diff --git a/docs/classes/ArangoDB-Document-Edge.html b/docs/classes/ArangoDB-Document-Edge.html index cedbdff..b09a902 100644 --- a/docs/classes/ArangoDB-Document-Edge.html +++ b/docs/classes/ArangoDB-Document-Edge.html @@ -346,7 +346,7 @@

 : string

-
Return an string representation of document.
+
Return a string representation of document.
__unset() @@ -532,9 +532,9 @@

Get some attribute.

@@ -585,9 +585,9 @@

Verifies if an attribute is set on document

@@ -632,9 +632,9 @@

Set a attribute

@@ -697,12 +697,12 @@

-

Return an string representation of document.

+

Return a string representation of document.

public @@ -734,9 +734,9 @@

Unset the given attribute of document

@@ -777,9 +777,9 @@

Removes a document on server, if possible

@@ -885,9 +885,9 @@

Returns the document collection

@@ -926,9 +926,9 @@

Returns the document Id

@@ -967,9 +967,9 @@

Returns the document key

@@ -1008,9 +1008,9 @@

Returns the document revision

@@ -1049,9 +1049,9 @@

Returns true if is a new object

@@ -1086,9 +1086,9 @@

@@ -1137,9 +1137,9 @@

Save or update the document, if possible

@@ -1205,9 +1205,9 @@

Sets the collection to add this document

@@ -1300,9 +1300,9 @@

Returns a array representation of document

diff --git a/docs/classes/ArangoDB-Document-Vertex.html b/docs/classes/ArangoDB-Document-Vertex.html index 340ce99..6d740b4 100644 --- a/docs/classes/ArangoDB-Document-Vertex.html +++ b/docs/classes/ArangoDB-Document-Vertex.html @@ -346,7 +346,7 @@

 : string

-
Return an string representation of document.
+
Return a string representation of document.
__unset() @@ -453,9 +453,9 @@

Document constructor.

@@ -522,9 +522,9 @@

Get some attribute.

@@ -575,9 +575,9 @@

Verifies if an attribute is set on document

@@ -622,9 +622,9 @@

Set a attribute

@@ -687,12 +687,12 @@

-

Return an string representation of document.

+

Return a string representation of document.

public @@ -724,9 +724,9 @@

Unset the given attribute of document

@@ -767,9 +767,9 @@

Removes a document on server, if possible

@@ -823,9 +823,9 @@

Returns the document collection

@@ -864,9 +864,9 @@

Returns the document Id

@@ -905,9 +905,9 @@

Returns the document key

@@ -946,9 +946,9 @@

Returns the document revision

@@ -987,9 +987,9 @@

Returns true if is a new object

@@ -1024,9 +1024,9 @@

@@ -1075,9 +1075,9 @@

Save or update the document, if possible

@@ -1143,9 +1143,9 @@

Sets the collection to add this document

@@ -1186,9 +1186,9 @@

Returns a array representation of document

diff --git a/docs/classes/ArangoDB-Graph-Graph.html b/docs/classes/ArangoDB-Graph-Graph.html index c57b8cf..b4ac82f 100644 --- a/docs/classes/ArangoDB-Graph-Graph.html +++ b/docs/classes/ArangoDB-Graph-Graph.html @@ -264,9 +264,9 @@

Represents an ArangoDB Graph.

@@ -337,10 +337,11 @@

addEdge() -  : Edge|false +  : bool
Creates a new edge in the collection.<br> -Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph.
+Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph +Furthermore, the edge has to be valid in the definition of the used.
addEdgeDefinition() @@ -382,7 +383,7 @@

 : bool

-
Remove one edge definition from the graph.<br> +
Remove one edge definition from the graph<br> This will only remove the edge collection, the vertex collections remain untouched and can still be used in your queries.
@@ -398,7 +399,7 @@

 : bool

-
Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph.<br> +
Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph<br> It can only remove vertex collections that are no longer part of edge definitions,<br> if they are used in edge definitions you are required to modify those first.
@@ -524,7 +525,7 @@

traversal() -  : TraversalCursor +  : Traversal
Returns a graph traversal.
@@ -557,9 +558,9 @@

Graph constructor.

@@ -635,9 +636,9 @@

Returns a string representation of graph object.

@@ -672,23 +673,22 @@

Creates a new edge in the collection.<br> -Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph.

+Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph +Furthermore, the edge has to be valid in the definition of the used.

public - addEdge(string $collection[, array<string|int, mixed> $attributes = [] ][, bool $waitForSync = true ][, bool $returnNew = false ]) : Edge|false + addEdge(string $collection[, array<string|int, mixed> $attributes = [] ][, bool $waitForSync = true ][, bool $returnNew = false ]) : bool
-

Furthermore the edge has to be valid in the definition of the used.

-
- +

Parameters
@@ -705,7 +705,7 @@
Parameters
: array<string|int, mixed> = []
-

The object attributes to be stored. Must contains '_to' and '_from' keys.

+

The object attributes to be stored. Must contain '_to' and '_from' keys.

@@ -748,9 +748,9 @@
Return values
- Edge|false + bool — -

A Edge object if edge exists. False if no graph with this name could be found
+

True if Edge object exists. False if no graph with this name could be found
or this collection is not part of the graph or one of the vertices ('_to' or '_from') does not exist.

@@ -771,9 +771,9 @@

Adds an edge definition to graph.

@@ -853,9 +853,9 @@

Adds a vertex to graph.

@@ -949,9 +949,9 @@

Adds a vertex collection to the set of orphan collections of the graph.

@@ -1015,9 +1015,9 @@

Removes a graph from server, if possible.

@@ -1084,9 +1084,9 @@

Drops an edge from graph.

@@ -1180,12 +1180,12 @@

-

Remove one edge definition from the graph.<br> +

Remove one edge definition from the graph<br> This will only remove the edge collection, the vertex collections remain untouched and can still be used in your queries.

@@ -1264,9 +1264,9 @@

Drops a vertex from graph.

@@ -1360,12 +1360,12 @@

-

Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph.<br> +

Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph<br> It can only remove vertex collections that are no longer part of edge definitions,<br> if they are used in edge definitions you are required to modify those first.

@@ -1435,9 +1435,9 @@

Returns an edge document.

@@ -1513,9 +1513,9 @@

Return all edge definitions of graph.

@@ -1550,9 +1550,9 @@

Returns the graph ID.

@@ -1587,9 +1587,9 @@

Returns the graph key.

@@ -1624,9 +1624,9 @@

Returns the minimal replication factor used for every new collection in the graph.

@@ -1661,9 +1661,9 @@

Gets the graph name.

@@ -1698,9 +1698,9 @@

Returns the number of shards that is used for every collection within this graph.

@@ -1735,9 +1735,9 @@

Returns the orphan collections in the graph.

@@ -1772,9 +1772,9 @@

Returns the replication factor used when initially creating collections for this graph.

@@ -1809,9 +1809,9 @@

Gets the graph revision.

@@ -1846,9 +1846,9 @@

Gets a vertex from the given collection.

@@ -1924,9 +1924,9 @@

Lists all vertex collections within this graph.

@@ -1976,9 +1976,9 @@

Returns true if is a new graph.

@@ -2013,9 +2013,9 @@

If this graph is a smartGraph.

@@ -2050,9 +2050,9 @@

Return a JSON representation of graph attributes.

@@ -2087,9 +2087,9 @@

Save the Graph on server, if possible.

@@ -2143,9 +2143,9 @@

Returns a array representation of graph.

@@ -2180,16 +2180,16 @@

Returns a graph traversal.

public - traversal(Vertex $vertex[, string $direction = Traversal::GRAPH_DIRECTION_ANY ][, int $depth = 0 ]) : TraversalCursor + traversal(Vertex $vertex[, string $direction = Traversal::GRAPH_DIRECTION_ANY ][, int $depth = 0 ]) : Traversal
@@ -2244,7 +2244,7 @@

Return values
- TraversalCursor + Traversal
diff --git a/docs/classes/ArangoDB-Http-RestClient.html b/docs/classes/ArangoDB-Http-RestClient.html index 18f40dc..c117f11 100644 --- a/docs/classes/ArangoDB-Http-RestClient.html +++ b/docs/classes/ArangoDB-Http-RestClient.html @@ -327,28 +327,28 @@

delete() -  : mixed|ResponseInterface +  : ResponseInterface
Performs a DELETE request.
get() -  : mixed|ResponseInterface +  : ResponseInterface
Performs a GET request.
patch() -  : mixed|ResponseInterface +  : ResponseInterface
Performs a PATCH request
post() -  : mixed|ResponseInterface +  : ResponseInterface
Performs a POST request.
@@ -388,9 +388,9 @@

RestClient constructor.

@@ -459,9 +459,9 @@

Makes a custom HTTP request.

@@ -498,7 +498,7 @@

Parameters
: string = ""
-

Body to sent.

+

Body to be sent.

@@ -550,16 +550,16 @@

Performs a DELETE request.

public - delete(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : mixed|ResponseInterface + delete(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
@@ -614,7 +614,7 @@

Return values
- mixed|ResponseInterface + ResponseInterface
@@ -632,16 +632,16 @@

Performs a GET request.

public - get(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : mixed|ResponseInterface + get(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
@@ -696,7 +696,7 @@

Return values
- mixed|ResponseInterface + ResponseInterface
@@ -714,16 +714,16 @@

Performs a PATCH request

public - patch(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : mixed|ResponseInterface + patch(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
@@ -778,7 +778,7 @@

Return values
- mixed|ResponseInterface + ResponseInterface
@@ -796,16 +796,16 @@

Performs a POST request.

public - post(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : mixed|ResponseInterface + post(string $url[, mixed $data = [] ][, array<string|int, mixed> $headers = [] ]) : ResponseInterface
@@ -860,7 +860,7 @@

Return values
- mixed|ResponseInterface + ResponseInterface
@@ -878,9 +878,9 @@

Performs a PUT request.

diff --git a/docs/classes/ArangoDB-Transaction-StreamTransaction.html b/docs/classes/ArangoDB-Transaction-StreamTransaction.html index b4b031e..70502d6 100644 --- a/docs/classes/ArangoDB-Transaction-StreamTransaction.html +++ b/docs/classes/ArangoDB-Transaction-StreamTransaction.html @@ -439,9 +439,9 @@

Abort transaction

diff --git a/docs/classes/ArangoDB-View-View.html b/docs/classes/ArangoDB-View-View.html index 734fe19..ab0992c 100644 --- a/docs/classes/ArangoDB-View-View.html +++ b/docs/classes/ArangoDB-View-View.html @@ -353,9 +353,9 @@

View constructor.

@@ -431,9 +431,9 @@

Returns true if is a new object

diff --git a/docs/files/src-aql-functions-aqlfunction.html b/docs/files/src-aql-functions-aqlfunction.html index fdd0583..7e1b530 100644 --- a/docs/files/src-aql-functions-aqlfunction.html +++ b/docs/files/src-aql-functions-aqlfunction.html @@ -259,7 +259,7 @@

-
AQLFunction
Represents an user defined aql function on server.
+
AQLFunction
Represents a user defined AQL function on server.
diff --git a/docs/files/src/AQL/AQL.php.txt b/docs/files/src/AQL/AQL.php.txt index f216920..bb560c8 100644 --- a/docs/files/src/AQL/AQL.php.txt +++ b/docs/files/src/AQL/AQL.php.txt @@ -45,8 +45,7 @@ abstract class AQL // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $aqlException = new AQLException($response['errorMessage'], $exception, $response['errorNum']); - throw $aqlException; + throw new AQLException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -76,8 +75,7 @@ abstract class AQL } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/docs/files/src/AQL/Functions/AQLFunction.php.txt b/docs/files/src/AQL/Functions/AQLFunction.php.txt index f806fbf..4a01eb8 100644 --- a/docs/files/src/AQL/Functions/AQLFunction.php.txt +++ b/docs/files/src/AQL/Functions/AQLFunction.php.txt @@ -11,7 +11,7 @@ use GuzzleHttp\Exception\GuzzleException; use ArangoDB\Entity\Contracts\EntityInterface; /** - * Represents an user defined aql function on server. + * Represents a user defined AQL function on server. * * @package ArangoDB\AQL\Functions * @author Lucas S. Vieira @@ -20,56 +20,44 @@ class AQLFunction implements EntityInterface { /** * Fully qualified name of user function. - * - * @var string */ - protected $name; + protected string $name; /** * String representation of function body. - * - * @var string */ - protected $code; + protected string $code; /** * An optional boolean value to indicate whether the function results are fully deterministic.
* (function return value solely depends on the input value and return value is the same for repeated calls with same input) - * - * @var bool */ - protected $isDeterministic; + protected bool $isDeterministic; /** - * If the entity is not an representation of a existing user function on server, + * If the entity is not a representation of an existing user function on server, * this property is true. - * - * @var bool */ - protected $isNew; + protected bool $isNew; /** * Connection object. - * - * @var Connection */ - protected $connection; + protected Connection|null $connection; /** * Stores the deletion data for an AQLFunction object. - * - * @var array */ - protected $deletion = []; + protected array $deletion = []; /** * AQLFunction constructor. * - * @param string $name The AQL function name. - * @param string $code The AQL function code. - * @param Connection|null $connection Connection object to use. - * @param bool $isDeterministic Indicates if the function results are deterministic. - * @param bool $isNew Indicates if the function object is a new one or not. + * @param string $name The AQL function name. + * @param string $code The AQL function code. + * @param Connection|null $connection Connection object to use. + * @param bool $isDeterministic Indicates if the function results are deterministic. + * @param bool $isNew Indicates if the function object is a new one or not. */ public function __construct(string $name, string $code, Connection $connection = null, bool $isDeterministic = true, bool $isNew = true) { @@ -134,7 +122,7 @@ class AQLFunction implements EntityInterface /** * If this AQL function has a connection set or not. * - * @return bool True if has a connection object. False otherwise. + * @return bool True if it has a connection object. False otherwise. */ public function hasConnection(): bool { @@ -171,8 +159,7 @@ class AQLFunction implements EntityInterface } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -197,8 +184,7 @@ class AQLFunction implements EntityInterface } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } diff --git a/docs/files/src/AQL/Statement.php.txt b/docs/files/src/AQL/Statement.php.txt index 6dfbf53..c75728b 100644 --- a/docs/files/src/AQL/Statement.php.txt +++ b/docs/files/src/AQL/Statement.php.txt @@ -169,7 +169,7 @@ class Statement implements StatementInterface * * @return string */ - private function output(string $parameter) + private function output(string $parameter): string { $value = $this->container->get($parameter); $format = $this->formats[gettype($value)]; diff --git a/docs/files/src/Admin/Admin.php.txt b/docs/files/src/Admin/Admin.php.txt index 543c800..6888505 100644 --- a/docs/files/src/Admin/Admin.php.txt +++ b/docs/files/src/Admin/Admin.php.txt @@ -74,8 +74,7 @@ abstract class Admin } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -97,8 +96,7 @@ abstract class Admin } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -127,8 +125,7 @@ abstract class Admin } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -160,8 +157,7 @@ abstract class Admin } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -200,8 +196,7 @@ abstract class Admin $message = "Not Implemented"; } - $serverException = new ServerException($message, $exception, $code); - throw $serverException; + throw new ServerException($message, $exception, $code); } } @@ -226,8 +221,7 @@ abstract class Admin $response = json_decode((string)$exception->getResponse()->getBody(), true); $message = isset($response['errorMessage']) ? $response['errorMessage'] : "Unknown error"; $code = isset($response['errorNum']) ? $response['errorNum'] : $exception->getResponse()->getStatusCode(); - $serverException = new ServerException($message, $exception, $code); - throw $serverException; + throw new ServerException($message, $exception, $code); } } } diff --git a/docs/files/src/Admin/Server.php.txt b/docs/files/src/Admin/Server.php.txt index 15b827c..6b10256 100644 --- a/docs/files/src/Admin/Server.php.txt +++ b/docs/files/src/Admin/Server.php.txt @@ -60,8 +60,7 @@ abstract class Server return $data['name']; } catch (\Exception $exception) { // Unknown error. - $serverException = new ServerException($exception->getMessage(), $exception, $exception->getCode()); - throw $serverException; + throw new ServerException($exception->getMessage(), $exception, $exception->getCode()); } } @@ -88,8 +87,7 @@ abstract class Server return strtolower($data['role']); } catch (\Exception $exception) { // Unknown error. - $serverException = new ServerException($exception->getMessage(), $exception, $exception->getCode()); - throw $serverException; + throw new ServerException($exception->getMessage(), $exception, $exception->getCode()); } } @@ -117,8 +115,7 @@ abstract class Server // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -139,8 +136,7 @@ abstract class Server return $data; } catch (BadResponseException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/docs/files/src/Admin/Task/Task.php.txt b/docs/files/src/Admin/Task/Task.php.txt index 447cdf3..3ba1be9 100644 --- a/docs/files/src/Admin/Task/Task.php.txt +++ b/docs/files/src/Admin/Task/Task.php.txt @@ -224,8 +224,7 @@ class Task implements EntityInterface } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -253,8 +252,7 @@ class Task implements EntityInterface // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } diff --git a/docs/files/src/Auth/Authenticable.php.txt b/docs/files/src/Auth/Authenticable.php.txt index c7eff7d..5f7ac40 100644 --- a/docs/files/src/Auth/Authenticable.php.txt +++ b/docs/files/src/Auth/Authenticable.php.txt @@ -24,17 +24,17 @@ abstract class Authenticable /** * @var array */ - protected $options; + protected array $options; /** * @var array JWT token */ - protected $authToken; + protected array $authToken; /** * @var RestClient */ - protected $restClient; + protected RestClient $restClient; /** * Authenticable constructor. @@ -62,11 +62,9 @@ abstract class Authenticable $this->authToken = json_decode((string)$response->getBody(), true); } catch (BadResponseException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $authException = new AuthException($response['errorMessage'], $exception, $response['errorNum']); - throw $authException; + throw new AuthException($response['errorMessage'], $exception, $response['errorNum']); } catch (ConnectException $exception) { - $connectionException = new ConnectionException($exception->getMessage(), $exception); - throw $connectionException; + throw new ConnectionException($exception->getMessage(), $exception); } } diff --git a/docs/files/src/Auth/Exceptions/AuthException.php.txt b/docs/files/src/Auth/Exceptions/AuthException.php.txt index c509cad..7c0d2b2 100644 --- a/docs/files/src/Auth/Exceptions/AuthException.php.txt +++ b/docs/files/src/Auth/Exceptions/AuthException.php.txt @@ -17,11 +17,11 @@ class AuthException extends BaseException /** * AuthException constructor. * - * @param $message + * @param string $message * @param Throwable|null $previous * @param int $code */ - public function __construct($message, Throwable $previous = null, $code = 0) + public function __construct(string $message, Throwable $previous = null, $code = 0) { parent::__construct($message, $previous, $code); } diff --git a/docs/files/src/Auth/Exceptions/UserException.php.txt b/docs/files/src/Auth/Exceptions/UserException.php.txt index 4988d9a..ad285ca 100644 --- a/docs/files/src/Auth/Exceptions/UserException.php.txt +++ b/docs/files/src/Auth/Exceptions/UserException.php.txt @@ -17,11 +17,11 @@ class UserException extends BaseException /** * UserException constructor. * - * @param $message + * @param string $message * @param Throwable|null $previous * @param int $code */ - public function __construct($message, Throwable $previous = null, $code = 0) + public function __construct(string $message, Throwable $previous = null, int $code = 0) { parent::__construct($message, $previous, $code); } diff --git a/docs/files/src/Auth/User.php.txt b/docs/files/src/Auth/User.php.txt index dfc55be..1af674e 100644 --- a/docs/files/src/Auth/User.php.txt +++ b/docs/files/src/Auth/User.php.txt @@ -23,46 +23,34 @@ class User implements EntityInterface { /** * Name of user on server. - * - * @var string */ - protected $user; + protected string $user; /** * Password of user. * Used only of new users that will be created on server. - * - * @var string */ - protected $password = ''; + protected string $password = ''; /** * If user is active or not on database. - * - * @var bool */ - protected $active; + protected bool $active; /** * Extra data about the user. - * - * @var array|null */ - protected $extra = null; + protected array|null $extra = null; /** * If user is a new User or an existing one. - * - * @var bool */ - protected $isNew; + protected bool $isNew; /** * Connection object to use. - * - * @var Connection */ - protected $connection; + protected Connection|null $connection; /** * User constructor. @@ -105,7 +93,7 @@ class User implements EntityInterface /** * String representation of User object. * - * @return false|mixed|string + * @return string */ public function __toString() { @@ -119,7 +107,7 @@ class User implements EntityInterface * * @return mixed|null Attribute value. */ - public function __get($name) + public function __get(string $name) { if (in_array($name, ['extra', 'user', 'active'])) { return $this->{$name}; @@ -173,7 +161,7 @@ class User implements EntityInterface * * @return array|null */ - public function getExtra() + public function getExtra(): array|null { return $this->extra; } @@ -221,13 +209,12 @@ class User implements EntityInterface $this->connection->$method($uri, $data); $this->isNew = false; - $this->password = null; + $this->password = ''; return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $duplicatedException = new UserException($response['errorMessage'], $exception, $response['errorNum']); - throw $duplicatedException; + throw new UserException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -246,7 +233,7 @@ class User implements EntityInterface $response = $this->connection->delete($uri); $this->isNew = false; - $this->password = null; + $this->password = ''; return true; } catch (ClientException $exception) { diff --git a/docs/files/src/Batch/Import.php.txt b/docs/files/src/Batch/Import.php.txt index feeae35..99165d4 100644 --- a/docs/files/src/Batch/Import.php.txt +++ b/docs/files/src/Batch/Import.php.txt @@ -80,11 +80,9 @@ abstract class Import } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } catch (DatabaseException $exception) { - $serverException = new ServerException($exception->getMessage(), $exception, $exception->getCode()); - throw $serverException; + throw new ServerException($exception->getMessage(), $exception, $exception->getCode()); } } } diff --git a/docs/files/src/Connection/Connection.php.txt b/docs/files/src/Connection/Connection.php.txt index 97e044e..69984e5 100644 --- a/docs/files/src/Connection/Connection.php.txt +++ b/docs/files/src/Connection/Connection.php.txt @@ -24,10 +24,8 @@ class Connection extends Authenticable { /** * Default headers to send to server. - * - * @var array */ - protected $defaultHeaders = []; + protected array $defaultHeaders = []; /** * Connection constructor. diff --git a/docs/files/src/DataStructures/ArrayList.php.txt b/docs/files/src/DataStructures/ArrayList.php.txt index 5c21f0e..dbd9d67 100644 --- a/docs/files/src/DataStructures/ArrayList.php.txt +++ b/docs/files/src/DataStructures/ArrayList.php.txt @@ -68,9 +68,9 @@ class ArrayList implements ListInterface } /** - * Get a value by it's key + * Get a value by its key * - * @param $key Key to verify on list. + * @param int|string $key Key to verify on list. * @return mixed */ public function get($key) diff --git a/docs/files/src/Database/Database.php.txt b/docs/files/src/Database/Database.php.txt index 593a3d3..f9b4e93 100644 --- a/docs/files/src/Database/Database.php.txt +++ b/docs/files/src/Database/Database.php.txt @@ -282,8 +282,7 @@ class Database extends DatabaseHandler return $collectionList; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/docs/files/src/Document/Document.php.txt b/docs/files/src/Document/Document.php.txt index cecf8a4..9401e6d 100644 --- a/docs/files/src/Document/Document.php.txt +++ b/docs/files/src/Document/Document.php.txt @@ -82,10 +82,8 @@ class Document implements EntityInterface /** * Default patch options - * - * @var array */ - protected $patchDefaultOptions = [ + protected array $patchDefaultOptions = [ 'keepNull' => false, 'mergeObjects' => true, 'waitForSync' => true, @@ -96,10 +94,8 @@ class Document implements EntityInterface /** * Default update options - * - * @var array */ - protected $updateDefaultOptions = [ + protected array $updateDefaultOptions = [ 'waitForSync' => true, 'ignoreRevs' => true, 'returnOld' => false, @@ -140,7 +136,7 @@ class Document implements EntityInterface } /** - * Return an string representation of document. + * Return a string representation of document. * * @return string */ @@ -291,8 +287,7 @@ class Document implements EntityInterface return $this->update($options); } catch (GuzzleException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -315,8 +310,7 @@ class Document implements EntityInterface return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -338,8 +332,7 @@ class Document implements EntityInterface return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } diff --git a/docs/files/src/Exceptions/Factory.php.txt b/docs/files/src/Exceptions/Factory.php.txt index 3b49328..39a257e 100644 --- a/docs/files/src/Exceptions/Factory.php.txt +++ b/docs/files/src/Exceptions/Factory.php.txt @@ -12,7 +12,7 @@ use ArangoDB\Exceptions\Storage\DataSourceNotFoundException; */ abstract class Factory { - protected static $exceptions = [ + protected static array $exceptions = [ 1203 => DataSourceNotFoundException::class ]; diff --git a/docs/files/src/Graph/EdgeDefinition.php.txt b/docs/files/src/Graph/EdgeDefinition.php.txt index 9f74af8..46de29f 100644 --- a/docs/files/src/Graph/EdgeDefinition.php.txt +++ b/docs/files/src/Graph/EdgeDefinition.php.txt @@ -17,7 +17,7 @@ class EdgeDefinition * * @var array */ - protected $to = []; + protected array $to = []; /** * List of vertex collection names.
@@ -25,14 +25,14 @@ class EdgeDefinition * * @var array */ - protected $from = []; + protected array $from = []; /** * Name of the edge collection. * * @var string */ - protected $collection; + protected string $collection; /** * EdgeDefinition constructor. diff --git a/docs/files/src/Graph/Graph.php.txt b/docs/files/src/Graph/Graph.php.txt index 0370677..fc51c8c 100644 --- a/docs/files/src/Graph/Graph.php.txt +++ b/docs/files/src/Graph/Graph.php.txt @@ -7,7 +7,6 @@ use ArangoDB\Http\Api; use ArangoDB\Document\Edge; use ArangoDB\Document\Vertex; use ArangoDB\Database\Database; -use ArangoDB\Cursor\TraversalCursor; use ArangoDB\DataStructures\ArrayList; use ArangoDB\Graph\Traversal\Traversal; use GuzzleHttp\Exception\ClientException; @@ -29,69 +28,51 @@ class Graph implements \JsonSerializable { /** * The internal id of this graph. - * - * @var string */ - protected $id; + protected string $id; /** * The name of graph. - * - * @var string */ - protected $key; + protected string $key; /** * If this graph is a new one or a representation of existing document. - * - * @var bool */ - protected $isNew; + protected bool $isNew; /** * Graph name. - * - * @var string */ - protected $name; + protected string $name; /** * Flag if the graph is a smart graph. - * - * @var bool */ - protected $isSmart; + protected bool $isSmart; /** * The revision of graph. * Can be used to make sure to not override concurrent modifications to this graph. - * - * @var string */ - protected $revision; + protected string $revision; /** * Number of shards created for every new collection in the graph. - * - * @var int */ - protected $numberOfShards; + protected int $numberOfShards; /** * The replication factor used for every new collection in the graph. - * - * @var int */ - protected $replicationFactor; + protected int $replicationFactor; /** * The minimal replication factor used for every new collection in the graph.
* If one shard has less than minReplicationFactor copies, * we cannot write to this shard, but to all others. - * - * @var int */ - protected $minReplicationFactor; + protected int $minReplicationFactor; /** * An array of definitions for the relations of graph. @@ -106,7 +87,7 @@ class Graph implements \JsonSerializable * * @var array */ - protected $orphanCollections = []; + protected array $orphanCollections = []; /** * Database object of graph @@ -307,8 +288,7 @@ class Graph implements \JsonSerializable return false; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -342,8 +322,7 @@ class Graph implements \JsonSerializable return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -418,13 +397,12 @@ class Graph implements \JsonSerializable return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } /** - * Remove one edge definition from the graph.
+ * Remove one edge definition from the graph
* This will only remove the edge collection, * the vertex collections remain untouched and can still be used in your queries. * @@ -470,8 +448,7 @@ class Graph implements \JsonSerializable return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -502,8 +479,7 @@ class Graph implements \JsonSerializable return new ArrayList($data['collections']); } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -539,13 +515,12 @@ class Graph implements \JsonSerializable return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } /** - * Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph.
+ * Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph
* It can only remove vertex collections that are no longer part of edge definitions,
* if they are used in edge definitions you are required to modify those first. * @@ -579,8 +554,7 @@ class Graph implements \JsonSerializable return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -620,8 +594,7 @@ class Graph implements \JsonSerializable return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -663,8 +636,7 @@ class Graph implements \JsonSerializable return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -708,8 +680,7 @@ class Graph implements \JsonSerializable return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -749,22 +720,21 @@ class Graph implements \JsonSerializable return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } /** * Creates a new edge in the collection.
- * Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph. - * Furthermore the edge has to be valid in the definition of the used. + * Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph + * Furthermore, the edge has to be valid in the definition of the used. * * @param string $collection The name of the edge collection the edge belongs to. - * @param array $attributes The object attributes to be stored. Must contains '_to' and '_from' keys. + * @param array $attributes The object attributes to be stored. Must contain '_to' and '_from' keys. * @param bool $waitForSync Define if the request should wait until synced to disk. Default is true. * @param bool $returnNew Define if the response should contain the complete new version of the document. Default is false. * - * @return Edge|false A Edge object if edge exists. False if no graph with this name could be found
+ * @return bool True if Edge object exists. False if no graph with this name could be found
* or this collection is not part of the graph or one of the vertices ('_to' or '_from') does not exist. * * @throws DatabaseException|GuzzleException|ArangoException @@ -794,8 +764,7 @@ class Graph implements \JsonSerializable return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -839,8 +808,7 @@ class Graph implements \JsonSerializable return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -851,7 +819,7 @@ class Graph implements \JsonSerializable * @param int $depth Visits only nodes in at least the given depth. * @param string $direction Direction for traversal. Must be either "outbound", "inbound", or "any". * - * @return TraversalCursor + * @return Traversal * * @throws CursorException|GuzzleException|ArangoException */ diff --git a/docs/files/src/Http/RestClient.php.txt b/docs/files/src/Http/RestClient.php.txt index d7cb6ff..ab91a7b 100644 --- a/docs/files/src/Http/RestClient.php.txt +++ b/docs/files/src/Http/RestClient.php.txt @@ -20,17 +20,13 @@ class RestClient { /** * Base URI string. - * - * @var string */ - protected $baseUri; + protected string $baseUri; /** * Guzzle HTTP client. - * - * @var Client */ - protected $httpClient; + protected Client $httpClient; /** * RestClient constructor. @@ -59,11 +55,11 @@ class RestClient * @param mixed $data Data to send. * @param array $headers Additional headers. * - * @return mixed|ResponseInterface + * @return ResponseInterface * * @throws GuzzleException */ - public function get($url, $data = [], $headers = []): ResponseInterface + public function get(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('GET', $url, $headers, json_encode($data)); return $this->httpClient->send($request->withoutHeader('content-length')); @@ -76,11 +72,11 @@ class RestClient * @param mixed $data Data to send. * @param array $headers Additional headers. * - * @return mixed|ResponseInterface + * @return ResponseInterface * * @throws GuzzleException */ - public function post($url, $data = [], $headers = []): ResponseInterface + public function post(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('POST', $url, $headers, json_encode($data)); return $this->httpClient->send($request); @@ -97,7 +93,7 @@ class RestClient * * @throws GuzzleException */ - public function put($url, $data = [], $headers = []): ResponseInterface + public function put(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('PUT', $url, $headers, json_encode($data)); return $this->httpClient->send($request); @@ -110,11 +106,11 @@ class RestClient * @param mixed $data Data to send * @param array $headers Additional headers. * - * @return mixed|ResponseInterface + * @return ResponseInterface * * @throws GuzzleException */ - public function patch($url, $data = [], $headers = []): ResponseInterface + public function patch(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('PATCH', $url, $headers, json_encode($data)); return $this->httpClient->send($request); @@ -127,11 +123,11 @@ class RestClient * @param mixed $data Data to send. * @param array $headers Additional headers. * - * @return mixed|ResponseInterface + * @return ResponseInterface * * @throws GuzzleException */ - public function delete($url, $data = [], $headers = []): ResponseInterface + public function delete(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('DELETE', $url, $headers, json_encode($data)); return $this->httpClient->send($request); @@ -142,7 +138,7 @@ class RestClient * * @param string $method HTTP method to use. * @param string $url URL to request. - * @param string $body Body to sent. + * @param string $body Body to be sent. * @param array $headers Additional headers. * * @return ResponseInterface diff --git a/docs/files/src/Transaction/JavascriptTransaction.php.txt b/docs/files/src/Transaction/JavascriptTransaction.php.txt index 5224200..d6c0b6a 100644 --- a/docs/files/src/Transaction/JavascriptTransaction.php.txt +++ b/docs/files/src/Transaction/JavascriptTransaction.php.txt @@ -59,8 +59,7 @@ final class JavascriptTransaction extends Transaction } catch (BadResponseException $exception) { // An error was returned from server. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $transactionException = new TransactionException($response['errorMessage'], $exception, $response['errorNum']); - throw $transactionException; + throw new TransactionException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/docs/files/src/Transaction/StreamTransaction.php.txt b/docs/files/src/Transaction/StreamTransaction.php.txt index e95ed90..77120e0 100644 --- a/docs/files/src/Transaction/StreamTransaction.php.txt +++ b/docs/files/src/Transaction/StreamTransaction.php.txt @@ -117,8 +117,7 @@ final class StreamTransaction extends Transaction } catch (BadResponseException $exception) { // An error was returned from server. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $transactionException = new TransactionException($response['errorMessage'], $exception, $response['errorNum']); - throw $transactionException; + throw new TransactionException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -144,8 +143,7 @@ final class StreamTransaction extends Transaction } catch (BadResponseException $exception) { // An error was returned from server. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $transactionException = new TransactionException($response['errorMessage'], $exception, $response['errorNum']); - throw $transactionException; + throw new TransactionException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/docs/files/src/View/View.php.txt b/docs/files/src/View/View.php.txt index 31a9c5d..fbe1ad3 100644 --- a/docs/files/src/View/View.php.txt +++ b/docs/files/src/View/View.php.txt @@ -13,38 +13,28 @@ class View { /** * View ID. - * - * @var string */ - protected $id; + protected string $id; /** * Globally unique ID. - * - * @var string */ - protected $globallyUniqueId; + protected string $globallyUniqueId; /** * The name of the View. - * - * @var string */ - protected $name; + protected string $name; /** * The type of View - * - * @var string */ - protected $type; + protected string $type; /** * If the View is a new one or a representation of an existing view on server. - * - * @var bool */ - protected $isNew; + protected bool $isNew; /** * The view links @@ -58,19 +48,17 @@ class View * View properties. * Check ArangoDB Server documentation for more details. * - * @var array * @see https://www.arangodb.com/docs/stable/arangosearch-views.html#view-properties */ - protected $attributes = []; + protected array $attributes = []; /** * View properties default values. * Check ArangoDB Server documentation for more details. * - * @var array * @see https://www.arangodb.com/docs/stable/arangosearch-views.html#view-properties */ - protected $defaults = [ + protected array $defaults = [ 'writebufferActive' => 0, 'writebufferSizeMax' => 33554432, 'writebufferIdle' => 64, diff --git a/docs/js/searchIndex.js b/docs/js/searchIndex.js index 4ef918d..b5bf766 100644 --- a/docs/js/searchIndex.js +++ b/docs/js/searchIndex.js @@ -238,7 +238,7 @@ Search.appendIndex( }, { "fqsen": "\\ArangoDB\\AQL\\Functions\\AQLFunction", "name": "AQLFunction", - "summary": "Represents\u0020an\u0020user\u0020defined\u0020aql\u0020function\u0020on\u0020server.", + "summary": "Represents\u0020a\u0020user\u0020defined\u0020AQL\u0020function\u0020on\u0020server.", "url": "classes/ArangoDB-AQL-Functions-AQLFunction.html" }, { "fqsen": "\\ArangoDB\\AQL\\Functions\\AQLFunction\u003A\u003A__construct\u0028\u0029", @@ -1243,7 +1243,7 @@ Search.appendIndex( }, { "fqsen": "\\ArangoDB\\DataStructures\\ArrayList\u003A\u003Aget\u0028\u0029", "name": "get", - "summary": "Get\u0020a\u0020value\u0020by\u0020it\u0027s\u0020key", + "summary": "Get\u0020a\u0020value\u0020by\u0020its\u0020key", "url": "classes/ArangoDB-DataStructures-ArrayList.html#method_get" }, { "fqsen": "\\ArangoDB\\DataStructures\\ArrayList\u003A\u003Apush\u0028\u0029", @@ -1383,7 +1383,7 @@ Search.appendIndex( }, { "fqsen": "\\ArangoDB\\Document\\Document\u003A\u003A__toString\u0028\u0029", "name": "__toString", - "summary": "Return\u0020an\u0020string\u0020representation\u0020of\u0020document.", + "summary": "Return\u0020a\u0020string\u0020representation\u0020of\u0020document.", "url": "classes/ArangoDB-Document-Document.html#method___toString" }, { "fqsen": "\\ArangoDB\\Document\\Document\u003A\u003A__get\u0028\u0029", @@ -1688,7 +1688,7 @@ Search.appendIndex( }, { "fqsen": "\\ArangoDB\\Graph\\Graph\u003A\u003AdropEdgeDefinition\u0028\u0029", "name": "dropEdgeDefinition", - "summary": "Remove\u0020one\u0020edge\u0020definition\u0020from\u0020the\u0020graph.\u003Cbr\u003E\nThis\u0020will\u0020only\u0020remove\u0020the\u0020edge\u0020collection,\nthe\u0020vertex\u0020collections\u0020remain\u0020untouched\u0020and\u0020can\u0020still\u0020be\u0020used\u0020in\u0020your\u0020queries.", + "summary": "Remove\u0020one\u0020edge\u0020definition\u0020from\u0020the\u0020graph\u003Cbr\u003E\nThis\u0020will\u0020only\u0020remove\u0020the\u0020edge\u0020collection,\nthe\u0020vertex\u0020collections\u0020remain\u0020untouched\u0020and\u0020can\u0020still\u0020be\u0020used\u0020in\u0020your\u0020queries.", "url": "classes/ArangoDB-Graph-Graph.html#method_dropEdgeDefinition" }, { "fqsen": "\\ArangoDB\\Graph\\Graph\u003A\u003AgetVertexCollections\u0028\u0029", @@ -1703,7 +1703,7 @@ Search.appendIndex( }, { "fqsen": "\\ArangoDB\\Graph\\Graph\u003A\u003AdropVertexCollection\u0028\u0029", "name": "dropVertexCollection", - "summary": "Removes\u0020a\u0020vertex\u0020collection\u0020from\u0020the\u0020graph\u0020and\u0020optionally\u0020deletes\u0020the\u0020collection,\u0020if\u0020it\u0020is\u0020not\u0020used\u0020in\u0020any\u0020other\u0020graph.\u003Cbr\u003E\nIt\u0020can\u0020only\u0020remove\u0020vertex\u0020collections\u0020that\u0020are\u0020no\u0020longer\u0020part\u0020of\u0020edge\u0020definitions,\u003Cbr\u003E\nif\u0020they\u0020are\u0020used\u0020in\u0020edge\u0020definitions\u0020you\u0020are\u0020required\u0020to\u0020modify\u0020those\u0020first.", + "summary": "Removes\u0020a\u0020vertex\u0020collection\u0020from\u0020the\u0020graph\u0020and\u0020optionally\u0020deletes\u0020the\u0020collection,\u0020if\u0020it\u0020is\u0020not\u0020used\u0020in\u0020any\u0020other\u0020graph\u003Cbr\u003E\nIt\u0020can\u0020only\u0020remove\u0020vertex\u0020collections\u0020that\u0020are\u0020no\u0020longer\u0020part\u0020of\u0020edge\u0020definitions,\u003Cbr\u003E\nif\u0020they\u0020are\u0020used\u0020in\u0020edge\u0020definitions\u0020you\u0020are\u0020required\u0020to\u0020modify\u0020those\u0020first.", "url": "classes/ArangoDB-Graph-Graph.html#method_dropVertexCollection" }, { "fqsen": "\\ArangoDB\\Graph\\Graph\u003A\u003AgetVertex\u0028\u0029", @@ -1728,7 +1728,7 @@ Search.appendIndex( }, { "fqsen": "\\ArangoDB\\Graph\\Graph\u003A\u003AaddEdge\u0028\u0029", "name": "addEdge", - "summary": "Creates\u0020a\u0020new\u0020edge\u0020in\u0020the\u0020collection.\u003Cbr\u003E\nWithin\u0020the\u0020attributes\u0020the\u0020edge\u0020has\u0020to\u0020contain\u0020a\u0020_from\u0020and\u0020_to\u0020value\u0020referencing\u0020to\u0020valid\u0020vertices\u0020in\u0020the\u0020graph.", + "summary": "Creates\u0020a\u0020new\u0020edge\u0020in\u0020the\u0020collection.\u003Cbr\u003E\nWithin\u0020the\u0020attributes\u0020the\u0020edge\u0020has\u0020to\u0020contain\u0020a\u0020_from\u0020and\u0020_to\u0020value\u0020referencing\u0020to\u0020valid\u0020vertices\u0020in\u0020the\u0020graph\nFurthermore,\u0020the\u0020edge\u0020has\u0020to\u0020be\u0020valid\u0020in\u0020the\u0020definition\u0020of\u0020the\u0020used.", "url": "classes/ArangoDB-Graph-Graph.html#method_addEdge" }, { "fqsen": "\\ArangoDB\\Graph\\Graph\u003A\u003AdropEdge\u0028\u0029", diff --git a/docs/namespaces/arangodb-aql-functions.html b/docs/namespaces/arangodb-aql-functions.html index 9f9c687..d8b4b2c 100644 --- a/docs/namespaces/arangodb-aql-functions.html +++ b/docs/namespaces/arangodb-aql-functions.html @@ -256,7 +256,7 @@

-
AQLFunction
Represents an user defined aql function on server.
+
AQLFunction
Represents a user defined AQL function on server.
diff --git a/docs/packages/ArangoDB-AQL-Functions.html b/docs/packages/ArangoDB-AQL-Functions.html index a01d83e..7ab9184 100644 --- a/docs/packages/ArangoDB-AQL-Functions.html +++ b/docs/packages/ArangoDB-AQL-Functions.html @@ -256,7 +256,7 @@

-
AQLFunction
Represents an user defined aql function on server.
+
AQLFunction
Represents a user defined AQL function on server.
diff --git a/src/AQL/AQL.php b/src/AQL/AQL.php index f216920..bb560c8 100644 --- a/src/AQL/AQL.php +++ b/src/AQL/AQL.php @@ -45,8 +45,7 @@ public static function validateQuery(StatementInterface $statement, Connection $ // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $aqlException = new AQLException($response['errorMessage'], $exception, $response['errorNum']); - throw $aqlException; + throw new AQLException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -76,8 +75,7 @@ public static function functions(Connection $connection, string $namespace = "") } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/src/AQL/Functions/AQLFunction.php b/src/AQL/Functions/AQLFunction.php index f806fbf..4a01eb8 100644 --- a/src/AQL/Functions/AQLFunction.php +++ b/src/AQL/Functions/AQLFunction.php @@ -11,7 +11,7 @@ use ArangoDB\Entity\Contracts\EntityInterface; /** - * Represents an user defined aql function on server. + * Represents a user defined AQL function on server. * * @package ArangoDB\AQL\Functions * @author Lucas S. Vieira @@ -20,56 +20,44 @@ class AQLFunction implements EntityInterface { /** * Fully qualified name of user function. - * - * @var string */ - protected $name; + protected string $name; /** * String representation of function body. - * - * @var string */ - protected $code; + protected string $code; /** * An optional boolean value to indicate whether the function results are fully deterministic.
* (function return value solely depends on the input value and return value is the same for repeated calls with same input) - * - * @var bool */ - protected $isDeterministic; + protected bool $isDeterministic; /** - * If the entity is not an representation of a existing user function on server, + * If the entity is not a representation of an existing user function on server, * this property is true. - * - * @var bool */ - protected $isNew; + protected bool $isNew; /** * Connection object. - * - * @var Connection */ - protected $connection; + protected Connection|null $connection; /** * Stores the deletion data for an AQLFunction object. - * - * @var array */ - protected $deletion = []; + protected array $deletion = []; /** * AQLFunction constructor. * - * @param string $name The AQL function name. - * @param string $code The AQL function code. - * @param Connection|null $connection Connection object to use. - * @param bool $isDeterministic Indicates if the function results are deterministic. - * @param bool $isNew Indicates if the function object is a new one or not. + * @param string $name The AQL function name. + * @param string $code The AQL function code. + * @param Connection|null $connection Connection object to use. + * @param bool $isDeterministic Indicates if the function results are deterministic. + * @param bool $isNew Indicates if the function object is a new one or not. */ public function __construct(string $name, string $code, Connection $connection = null, bool $isDeterministic = true, bool $isNew = true) { @@ -134,7 +122,7 @@ public function getDeletionData(): array /** * If this AQL function has a connection set or not. * - * @return bool True if has a connection object. False otherwise. + * @return bool True if it has a connection object. False otherwise. */ public function hasConnection(): bool { @@ -171,8 +159,7 @@ public function save(): bool } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -197,8 +184,7 @@ public function delete(): bool } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } diff --git a/src/AQL/Statement.php b/src/AQL/Statement.php index 6dfbf53..c75728b 100644 --- a/src/AQL/Statement.php +++ b/src/AQL/Statement.php @@ -169,7 +169,7 @@ public function toAql(): string * * @return string */ - private function output(string $parameter) + private function output(string $parameter): string { $value = $this->container->get($parameter); $format = $this->formats[gettype($value)]; diff --git a/src/Admin/Admin.php b/src/Admin/Admin.php index 543c800..6888505 100644 --- a/src/Admin/Admin.php +++ b/src/Admin/Admin.php @@ -74,8 +74,7 @@ public static function statistics(Connection $connection) } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -97,8 +96,7 @@ public static function time(Connection $connection): float } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -127,8 +125,7 @@ public static function tasks(Connection $connection): ArrayList } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -160,8 +157,7 @@ public static function flushWal(Connection $connection, bool $waitForSync = true } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -200,8 +196,7 @@ public static function walProperties(Connection $connection): array $message = "Not Implemented"; } - $serverException = new ServerException($message, $exception, $code); - throw $serverException; + throw new ServerException($message, $exception, $code); } } @@ -226,8 +221,7 @@ public static function walTransactions(Connection $connection): array $response = json_decode((string)$exception->getResponse()->getBody(), true); $message = isset($response['errorMessage']) ? $response['errorMessage'] : "Unknown error"; $code = isset($response['errorNum']) ? $response['errorNum'] : $exception->getResponse()->getStatusCode(); - $serverException = new ServerException($message, $exception, $code); - throw $serverException; + throw new ServerException($message, $exception, $code); } } } diff --git a/src/Admin/Server.php b/src/Admin/Server.php index 15b827c..6b10256 100644 --- a/src/Admin/Server.php +++ b/src/Admin/Server.php @@ -60,8 +60,7 @@ public static function engine(Connection $connection): string return $data['name']; } catch (\Exception $exception) { // Unknown error. - $serverException = new ServerException($exception->getMessage(), $exception, $exception->getCode()); - throw $serverException; + throw new ServerException($exception->getMessage(), $exception, $exception->getCode()); } } @@ -88,8 +87,7 @@ public static function role(Connection $connection): string return strtolower($data['role']); } catch (\Exception $exception) { // Unknown error. - $serverException = new ServerException($exception->getMessage(), $exception, $exception->getCode()); - throw $serverException; + throw new ServerException($exception->getMessage(), $exception, $exception->getCode()); } } @@ -117,8 +115,7 @@ public static function isAvailable(Connection $connection): bool // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -139,8 +136,7 @@ public static function logLevel(Connection $connection): array return $data; } catch (BadResponseException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/src/Admin/Task/Task.php b/src/Admin/Task/Task.php index 447cdf3..3ba1be9 100644 --- a/src/Admin/Task/Task.php +++ b/src/Admin/Task/Task.php @@ -224,8 +224,7 @@ public function save(): bool } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -253,8 +252,7 @@ public function delete(): bool // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } } diff --git a/src/Auth/Authenticable.php b/src/Auth/Authenticable.php index c7eff7d..5f7ac40 100644 --- a/src/Auth/Authenticable.php +++ b/src/Auth/Authenticable.php @@ -24,17 +24,17 @@ abstract class Authenticable /** * @var array */ - protected $options; + protected array $options; /** * @var array JWT token */ - protected $authToken; + protected array $authToken; /** * @var RestClient */ - protected $restClient; + protected RestClient $restClient; /** * Authenticable constructor. @@ -62,11 +62,9 @@ protected function authenticate(array $credentials): void $this->authToken = json_decode((string)$response->getBody(), true); } catch (BadResponseException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $authException = new AuthException($response['errorMessage'], $exception, $response['errorNum']); - throw $authException; + throw new AuthException($response['errorMessage'], $exception, $response['errorNum']); } catch (ConnectException $exception) { - $connectionException = new ConnectionException($exception->getMessage(), $exception); - throw $connectionException; + throw new ConnectionException($exception->getMessage(), $exception); } } diff --git a/src/Auth/Exceptions/AuthException.php b/src/Auth/Exceptions/AuthException.php index c509cad..7c0d2b2 100644 --- a/src/Auth/Exceptions/AuthException.php +++ b/src/Auth/Exceptions/AuthException.php @@ -17,11 +17,11 @@ class AuthException extends BaseException /** * AuthException constructor. * - * @param $message + * @param string $message * @param Throwable|null $previous * @param int $code */ - public function __construct($message, Throwable $previous = null, $code = 0) + public function __construct(string $message, Throwable $previous = null, $code = 0) { parent::__construct($message, $previous, $code); } diff --git a/src/Auth/Exceptions/UserException.php b/src/Auth/Exceptions/UserException.php index 4988d9a..ad285ca 100644 --- a/src/Auth/Exceptions/UserException.php +++ b/src/Auth/Exceptions/UserException.php @@ -17,11 +17,11 @@ class UserException extends BaseException /** * UserException constructor. * - * @param $message + * @param string $message * @param Throwable|null $previous * @param int $code */ - public function __construct($message, Throwable $previous = null, $code = 0) + public function __construct(string $message, Throwable $previous = null, int $code = 0) { parent::__construct($message, $previous, $code); } diff --git a/src/Auth/User.php b/src/Auth/User.php index dfc55be..1af674e 100644 --- a/src/Auth/User.php +++ b/src/Auth/User.php @@ -23,46 +23,34 @@ class User implements EntityInterface { /** * Name of user on server. - * - * @var string */ - protected $user; + protected string $user; /** * Password of user. * Used only of new users that will be created on server. - * - * @var string */ - protected $password = ''; + protected string $password = ''; /** * If user is active or not on database. - * - * @var bool */ - protected $active; + protected bool $active; /** * Extra data about the user. - * - * @var array|null */ - protected $extra = null; + protected array|null $extra = null; /** * If user is a new User or an existing one. - * - * @var bool */ - protected $isNew; + protected bool $isNew; /** * Connection object to use. - * - * @var Connection */ - protected $connection; + protected Connection|null $connection; /** * User constructor. @@ -105,7 +93,7 @@ public function __debugInfo() /** * String representation of User object. * - * @return false|mixed|string + * @return string */ public function __toString() { @@ -119,7 +107,7 @@ public function __toString() * * @return mixed|null Attribute value. */ - public function __get($name) + public function __get(string $name) { if (in_array($name, ['extra', 'user', 'active'])) { return $this->{$name}; @@ -173,7 +161,7 @@ public function getUsername(): string * * @return array|null */ - public function getExtra() + public function getExtra(): array|null { return $this->extra; } @@ -221,13 +209,12 @@ public function save(): bool $this->connection->$method($uri, $data); $this->isNew = false; - $this->password = null; + $this->password = ''; return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $duplicatedException = new UserException($response['errorMessage'], $exception, $response['errorNum']); - throw $duplicatedException; + throw new UserException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -246,7 +233,7 @@ public function delete(): bool $response = $this->connection->delete($uri); $this->isNew = false; - $this->password = null; + $this->password = ''; return true; } catch (ClientException $exception) { diff --git a/src/Batch/Import.php b/src/Batch/Import.php index feeae35..99165d4 100644 --- a/src/Batch/Import.php +++ b/src/Batch/Import.php @@ -80,11 +80,9 @@ public static function importArrayDocuments(Connection $connection, string $coll } catch (ClientException $exception) { // Unknown error. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $serverException = new ServerException($response['errorMessage'], $exception, $response['errorNum']); - throw $serverException; + throw new ServerException($response['errorMessage'], $exception, $response['errorNum']); } catch (DatabaseException $exception) { - $serverException = new ServerException($exception->getMessage(), $exception, $exception->getCode()); - throw $serverException; + throw new ServerException($exception->getMessage(), $exception, $exception->getCode()); } } } diff --git a/src/Connection/Connection.php b/src/Connection/Connection.php index 97e044e..69984e5 100644 --- a/src/Connection/Connection.php +++ b/src/Connection/Connection.php @@ -24,10 +24,8 @@ class Connection extends Authenticable { /** * Default headers to send to server. - * - * @var array */ - protected $defaultHeaders = []; + protected array $defaultHeaders = []; /** * Connection constructor. diff --git a/src/DataStructures/ArrayList.php b/src/DataStructures/ArrayList.php index 5c21f0e..dbd9d67 100644 --- a/src/DataStructures/ArrayList.php +++ b/src/DataStructures/ArrayList.php @@ -68,9 +68,9 @@ public function last() } /** - * Get a value by it's key + * Get a value by its key * - * @param $key Key to verify on list. + * @param int|string $key Key to verify on list. * @return mixed */ public function get($key) diff --git a/src/Database/Database.php b/src/Database/Database.php index 593a3d3..f9b4e93 100644 --- a/src/Database/Database.php +++ b/src/Database/Database.php @@ -282,8 +282,7 @@ private function retrieveCollections(): ArrayList return $collectionList; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/src/Document/Document.php b/src/Document/Document.php index cecf8a4..9401e6d 100644 --- a/src/Document/Document.php +++ b/src/Document/Document.php @@ -82,10 +82,8 @@ class Document implements EntityInterface /** * Default patch options - * - * @var array */ - protected $patchDefaultOptions = [ + protected array $patchDefaultOptions = [ 'keepNull' => false, 'mergeObjects' => true, 'waitForSync' => true, @@ -96,10 +94,8 @@ class Document implements EntityInterface /** * Default update options - * - * @var array */ - protected $updateDefaultOptions = [ + protected array $updateDefaultOptions = [ 'waitForSync' => true, 'ignoreRevs' => true, 'returnOld' => false, @@ -140,7 +136,7 @@ public function __construct(array $attributes = [], Collection $collection = nul } /** - * Return an string representation of document. + * Return a string representation of document. * * @return string */ @@ -291,8 +287,7 @@ public function save(array $options = []): bool return $this->update($options); } catch (GuzzleException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -315,8 +310,7 @@ protected function update(array $options = []): bool return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -338,8 +332,7 @@ public function delete(): bool return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } diff --git a/src/Exceptions/Factory.php b/src/Exceptions/Factory.php index 3b49328..39a257e 100644 --- a/src/Exceptions/Factory.php +++ b/src/Exceptions/Factory.php @@ -12,7 +12,7 @@ */ abstract class Factory { - protected static $exceptions = [ + protected static array $exceptions = [ 1203 => DataSourceNotFoundException::class ]; diff --git a/src/Graph/EdgeDefinition.php b/src/Graph/EdgeDefinition.php index 9f74af8..46de29f 100644 --- a/src/Graph/EdgeDefinition.php +++ b/src/Graph/EdgeDefinition.php @@ -17,7 +17,7 @@ class EdgeDefinition * * @var array */ - protected $to = []; + protected array $to = []; /** * List of vertex collection names.
@@ -25,14 +25,14 @@ class EdgeDefinition * * @var array */ - protected $from = []; + protected array $from = []; /** * Name of the edge collection. * * @var string */ - protected $collection; + protected string $collection; /** * EdgeDefinition constructor. diff --git a/src/Graph/Graph.php b/src/Graph/Graph.php index 0370677..fc51c8c 100644 --- a/src/Graph/Graph.php +++ b/src/Graph/Graph.php @@ -7,7 +7,6 @@ use ArangoDB\Document\Edge; use ArangoDB\Document\Vertex; use ArangoDB\Database\Database; -use ArangoDB\Cursor\TraversalCursor; use ArangoDB\DataStructures\ArrayList; use ArangoDB\Graph\Traversal\Traversal; use GuzzleHttp\Exception\ClientException; @@ -29,69 +28,51 @@ class Graph implements \JsonSerializable { /** * The internal id of this graph. - * - * @var string */ - protected $id; + protected string $id; /** * The name of graph. - * - * @var string */ - protected $key; + protected string $key; /** * If this graph is a new one or a representation of existing document. - * - * @var bool */ - protected $isNew; + protected bool $isNew; /** * Graph name. - * - * @var string */ - protected $name; + protected string $name; /** * Flag if the graph is a smart graph. - * - * @var bool */ - protected $isSmart; + protected bool $isSmart; /** * The revision of graph. * Can be used to make sure to not override concurrent modifications to this graph. - * - * @var string */ - protected $revision; + protected string $revision; /** * Number of shards created for every new collection in the graph. - * - * @var int */ - protected $numberOfShards; + protected int $numberOfShards; /** * The replication factor used for every new collection in the graph. - * - * @var int */ - protected $replicationFactor; + protected int $replicationFactor; /** * The minimal replication factor used for every new collection in the graph.
* If one shard has less than minReplicationFactor copies, * we cannot write to this shard, but to all others. - * - * @var int */ - protected $minReplicationFactor; + protected int $minReplicationFactor; /** * An array of definitions for the relations of graph. @@ -106,7 +87,7 @@ class Graph implements \JsonSerializable * * @var array */ - protected $orphanCollections = []; + protected array $orphanCollections = []; /** * Database object of graph @@ -307,8 +288,7 @@ public function save(): bool return false; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -342,8 +322,7 @@ public function delete($dropCollections = false): bool return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -418,13 +397,12 @@ public function addEdgeDefinition(string $collection, array $from, array $to): b return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } /** - * Remove one edge definition from the graph.
+ * Remove one edge definition from the graph
* This will only remove the edge collection, * the vertex collections remain untouched and can still be used in your queries. * @@ -470,8 +448,7 @@ public function dropEdgeDefinition(string $collection, bool $dropCollection = fa return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -502,8 +479,7 @@ public function getVertexCollections(): ArrayList return new ArrayList($data['collections']); } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -539,13 +515,12 @@ public function addVertexCollection(string $collection): bool return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } /** - * Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph.
+ * Removes a vertex collection from the graph and optionally deletes the collection, if it is not used in any other graph
* It can only remove vertex collections that are no longer part of edge definitions,
* if they are used in edge definitions you are required to modify those first. * @@ -579,8 +554,7 @@ public function dropVertexCollection(string $collection, bool $dropCollection = return true; } catch (ClientException $exception) { $response = json_decode((string)$exception->getResponse()->getBody(), true); - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -620,8 +594,7 @@ public function getVertex(string $collection, string $vertex) return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -663,8 +636,7 @@ public function addVertex(string $collection, array $attributes = [], bool $wait return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -708,8 +680,7 @@ public function dropVertex(string $collection, string $vertex, bool $waitForSync return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -749,22 +720,21 @@ public function getEdge(string $collection, string $edge) return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } /** * Creates a new edge in the collection.
- * Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph. - * Furthermore the edge has to be valid in the definition of the used. + * Within the attributes the edge has to contain a _from and _to value referencing to valid vertices in the graph + * Furthermore, the edge has to be valid in the definition of the used. * * @param string $collection The name of the edge collection the edge belongs to. - * @param array $attributes The object attributes to be stored. Must contains '_to' and '_from' keys. + * @param array $attributes The object attributes to be stored. Must contain '_to' and '_from' keys. * @param bool $waitForSync Define if the request should wait until synced to disk. Default is true. * @param bool $returnNew Define if the response should contain the complete new version of the document. Default is false. * - * @return Edge|false A Edge object if edge exists. False if no graph with this name could be found
+ * @return bool True if Edge object exists. False if no graph with this name could be found
* or this collection is not part of the graph or one of the vertices ('_to' or '_from') does not exist. * * @throws DatabaseException|GuzzleException|ArangoException @@ -794,8 +764,7 @@ public function addEdge(string $collection, array $attributes = [], bool $waitFo return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -839,8 +808,7 @@ public function dropEdge(string $collection, string $edge, bool $waitForSync = t return false; } - $databaseException = new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); - throw $databaseException; + throw new DatabaseException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -851,7 +819,7 @@ public function dropEdge(string $collection, string $edge, bool $waitForSync = t * @param int $depth Visits only nodes in at least the given depth. * @param string $direction Direction for traversal. Must be either "outbound", "inbound", or "any". * - * @return TraversalCursor + * @return Traversal * * @throws CursorException|GuzzleException|ArangoException */ diff --git a/src/Http/RestClient.php b/src/Http/RestClient.php index d7cb6ff..ab91a7b 100644 --- a/src/Http/RestClient.php +++ b/src/Http/RestClient.php @@ -20,17 +20,13 @@ class RestClient { /** * Base URI string. - * - * @var string */ - protected $baseUri; + protected string $baseUri; /** * Guzzle HTTP client. - * - * @var Client */ - protected $httpClient; + protected Client $httpClient; /** * RestClient constructor. @@ -59,11 +55,11 @@ public function __construct(string $baseUri, array $options = []) * @param mixed $data Data to send. * @param array $headers Additional headers. * - * @return mixed|ResponseInterface + * @return ResponseInterface * * @throws GuzzleException */ - public function get($url, $data = [], $headers = []): ResponseInterface + public function get(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('GET', $url, $headers, json_encode($data)); return $this->httpClient->send($request->withoutHeader('content-length')); @@ -76,11 +72,11 @@ public function get($url, $data = [], $headers = []): ResponseInterface * @param mixed $data Data to send. * @param array $headers Additional headers. * - * @return mixed|ResponseInterface + * @return ResponseInterface * * @throws GuzzleException */ - public function post($url, $data = [], $headers = []): ResponseInterface + public function post(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('POST', $url, $headers, json_encode($data)); return $this->httpClient->send($request); @@ -97,7 +93,7 @@ public function post($url, $data = [], $headers = []): ResponseInterface * * @throws GuzzleException */ - public function put($url, $data = [], $headers = []): ResponseInterface + public function put(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('PUT', $url, $headers, json_encode($data)); return $this->httpClient->send($request); @@ -110,11 +106,11 @@ public function put($url, $data = [], $headers = []): ResponseInterface * @param mixed $data Data to send * @param array $headers Additional headers. * - * @return mixed|ResponseInterface + * @return ResponseInterface * * @throws GuzzleException */ - public function patch($url, $data = [], $headers = []): ResponseInterface + public function patch(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('PATCH', $url, $headers, json_encode($data)); return $this->httpClient->send($request); @@ -127,11 +123,11 @@ public function patch($url, $data = [], $headers = []): ResponseInterface * @param mixed $data Data to send. * @param array $headers Additional headers. * - * @return mixed|ResponseInterface + * @return ResponseInterface * * @throws GuzzleException */ - public function delete($url, $data = [], $headers = []): ResponseInterface + public function delete(string $url, array $data = [], array $headers = []): ResponseInterface { $request = new Request('DELETE', $url, $headers, json_encode($data)); return $this->httpClient->send($request); @@ -142,7 +138,7 @@ public function delete($url, $data = [], $headers = []): ResponseInterface * * @param string $method HTTP method to use. * @param string $url URL to request. - * @param string $body Body to sent. + * @param string $body Body to be sent. * @param array $headers Additional headers. * * @return ResponseInterface diff --git a/src/Transaction/JavascriptTransaction.php b/src/Transaction/JavascriptTransaction.php index 5224200..d6c0b6a 100644 --- a/src/Transaction/JavascriptTransaction.php +++ b/src/Transaction/JavascriptTransaction.php @@ -59,8 +59,7 @@ public function execute() } catch (BadResponseException $exception) { // An error was returned from server. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $transactionException = new TransactionException($response['errorMessage'], $exception, $response['errorNum']); - throw $transactionException; + throw new TransactionException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/src/Transaction/StreamTransaction.php b/src/Transaction/StreamTransaction.php index e95ed90..77120e0 100644 --- a/src/Transaction/StreamTransaction.php +++ b/src/Transaction/StreamTransaction.php @@ -117,8 +117,7 @@ public function commit() } catch (BadResponseException $exception) { // An error was returned from server. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $transactionException = new TransactionException($response['errorMessage'], $exception, $response['errorNum']); - throw $transactionException; + throw new TransactionException($response['errorMessage'], $exception, $response['errorNum']); } } @@ -144,8 +143,7 @@ public function abort() } catch (BadResponseException $exception) { // An error was returned from server. $response = json_decode((string)$exception->getResponse()->getBody(), true); - $transactionException = new TransactionException($response['errorMessage'], $exception, $response['errorNum']); - throw $transactionException; + throw new TransactionException($response['errorMessage'], $exception, $response['errorNum']); } } } diff --git a/src/View/View.php b/src/View/View.php index 31a9c5d..fbe1ad3 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -13,38 +13,28 @@ class View { /** * View ID. - * - * @var string */ - protected $id; + protected string $id; /** * Globally unique ID. - * - * @var string */ - protected $globallyUniqueId; + protected string $globallyUniqueId; /** * The name of the View. - * - * @var string */ - protected $name; + protected string $name; /** * The type of View - * - * @var string */ - protected $type; + protected string $type; /** * If the View is a new one or a representation of an existing view on server. - * - * @var bool */ - protected $isNew; + protected bool $isNew; /** * The view links @@ -58,19 +48,17 @@ class View * View properties. * Check ArangoDB Server documentation for more details. * - * @var array * @see https://www.arangodb.com/docs/stable/arangosearch-views.html#view-properties */ - protected $attributes = []; + protected array $attributes = []; /** * View properties default values. * Check ArangoDB Server documentation for more details. * - * @var array * @see https://www.arangodb.com/docs/stable/arangosearch-views.html#view-properties */ - protected $defaults = [ + protected array $defaults = [ 'writebufferActive' => 0, 'writebufferSizeMax' => 33554432, 'writebufferIdle' => 64,