Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update to latest devel branch
  • Loading branch information
diabl0 committed Feb 27, 2017
commit 99eb66f13eba72a2eae022b950b165cf1bc61f7c
60 changes: 59 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,60 @@
/composer.json
/apigen.phar
/apigen.phar
.idea/php.xml


# Created by https://www.gitignore.io/api/jetbrains

### JetBrains ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml

# Sensitive or high-churn files:
.idea/dataSources/
.idea/dataSources.ids
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml

# Gradle:
.idea/gradle.xml
.idea/libraries

# Mongo Explorer plugin:
.idea/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

### JetBrains Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# End of https://www.gitignore.io/api/jetbrains
8 changes: 8 additions & 0 deletions .idea/php.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: php

matrix:
include:
- php: '5.5'
- php: '5.6'
- php: '7.0'
- php: '7.1'
Expand All @@ -13,7 +12,8 @@ before_script:
- ./tests/travis/setup_arangodb.sh

script:
- phpunit --configuration ./tests/phpunit.xml
- phpunit --configuration ./tests/phpunit-connection-close.xml
- phpunit --configuration ./tests/phpunit-connection-keep-alive.xml

after_script:
- ./tests/travis/teardown_arangodb.sh
5 changes: 4 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
Release notes for the ArangoDB-PHP driver 3.2.0 (currently in development)
==========================================================================

The namespace `\triagens\ArangoDb` was replaced with `\ArangoDBClient`.
- The namespace `\triagens\ArangoDb` was replaced with `\ArangoDBClient`.
For each class in the old namespace there is now a class alias that points
from the new namespace to the old namespace, so existing applications can
still use the class names from the `\triagens\ArangoDb` namespace

- Support for PHP 5.5 has been removed.


Release notes for the ArangoDB-PHP driver 3.1.0
===============================================

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ There is an example for this kind of statements in the file examples/select.php.
To use the PHP client, you must include the file autoloader.php from the main directory.
The autoloader will care about loading additionally required classes on the fly. The autoloader can be nested with other autoloaders.

The ArangoDB PHP client is an API that allows you to send and retrieve documents from ArangoDB from out of your PHP application. The client library itself is written in PHP and has no further dependencies but just plain PHP 5.5 (or higher).
The ArangoDB PHP client is an API that allows you to send and retrieve documents from ArangoDB from out of your PHP application. The client library itself is written in PHP and has no further dependencies but just plain PHP 5.6 (or higher).

The client library provides document and collection classes you can use to work with documents and collections in an OO fashion. When exchanging document data with the server, the library internally will use the [HTTP REST interface of ArangoDB](https://docs.arangodb.com/HttpApi/index.html). The library user does not have to care about this fact as all the details of the REST interface are abstracted by the client library.

Expand All @@ -65,7 +65,13 @@ The client library provides document and collection classes you can use to work

* ArangoDB database server version 3.0 or higher. Detailed info [here](https://github.com/arangodb/arangodb-php/wiki/Important-versioning-information-on-ArangoDB-PHP#arangodb-php-client-to-arangodb-server-interoperability-matrix)

* PHP version 5.5 or higher (Travis-tested with PHP 5.5, 5.6, 7.0, 7.1 and hhvm)
* PHP version 5.6 or higher (Travis-tested with PHP 5.6, 7.0, 7.1 and hhvm)

Note on PHP version support:

This driver will cease to support old PHP versions as soon as they have reached end-of-life status. Support will be removed with the next minor or patch version of the driver to be released.

In general, it is recommended to always use the latest PHP versions (currently those in the PHP 7 line) in order to take advantage of all the improvements (especially in performance).

<br>

Expand All @@ -74,7 +80,7 @@ The client library provides document and collection classes you can use to work
<a name="installing"></a>
## Installing the PHP client

To get started you need PHP 5.5 or higher plus an ArangoDB server running on any host that you can access.
To get started you need PHP 5.6 or higher plus an ArangoDB server running on any host that you can access.

There are two alternative ways to get the ArangoDB PHP client:

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
}
],
"require": {
"php": ">=5.5.0"
"php": ">=5.6.0"
},
"autoload": {
"psr-0": {
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/AdminHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
* @since 1.2
*/

class AdminHandler extends
Handler
class AdminHandler extends Handler
{
/**
* details for server version
Expand Down
4 changes: 2 additions & 2 deletions lib/ArangoDBClient/Autoloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ private static function checkEnvironment()
{
list($major, $minor) = explode('.', phpversion());

if ((int) $major < 5 || ((int) $major === 5 && (int) $minor < 5)) {
throw new ClientException('Incompatible PHP environment. Expecting PHP 5.5 or higher');
if ((int) $major < 5 || ((int) $major === 5 && (int) $minor < 6)) {
throw new ClientException('Incompatible PHP environment. Expecting PHP 5.6 or higher');
}
}
}
Expand Down
17 changes: 11 additions & 6 deletions lib/ArangoDBClient/Batch.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ public function append($method, $request)
}

if (null === $this->_nextBatchPartId) {
if (is_a($this->_batchParts, 'SplFixedArray')) {
if (is_a($this->_batchParts, \SplFixedArray::class)) {
$nextNumeric = $this->_nextId;
$this->_nextId++;
} else {
Expand Down Expand Up @@ -421,29 +421,34 @@ public function process()
throw new ClientException('Can\'t process empty batch.');
}

$combinedDataHeader = '--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL;
$combinedDataHeader .= 'Content-Type: application/x-arango-batchpart' . HttpHelper::EOL;

/** @var $partValue BatchPart */
foreach ($batchParts as $partValue) {
if (null !== $partValue) {
$data .= '--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL;
$data .= 'Content-Type: application/x-arango-batchpart' . HttpHelper::EOL;

if (null !== $partValue->getId()) {
$data .= 'Content-Id: ' . (string) $partValue->getId() . HttpHelper::EOL . HttpHelper::EOL;
$data .= $combinedDataHeader;
if (null !== $partValueId = $partValue->getId()) {
$data .= 'Content-Id: ' . (string) $partValueId . HttpHelper::SEPARATOR;
} else {
$data .= HttpHelper::EOL;
}

$data .= (string) $partValue->getRequest() . HttpHelper::EOL;
}
}
$data .= '--' . HttpHelper::MIME_BOUNDARY . '--' . HttpHelper::EOL . HttpHelper::EOL;

$data .= '--' . HttpHelper::MIME_BOUNDARY . '--' . HttpHelper::SEPARATOR;

$params = [];
$url = UrlHelper::appendParamsUrl(Urls::URL_BATCH, $params);
$this->_batchResponse = $this->_connection->post($url, $data);

if ($this->_batchResponse->getHttpCode() !== 200) {
return $this->_batchResponse;
}

$body = $this->_batchResponse->getBody();
$body = trim($body, '--' . HttpHelper::MIME_BOUNDARY . '--');
$batchParts = $this->splitWithContentIdKey('--' . HttpHelper::MIME_BOUNDARY . HttpHelper::EOL, $body);
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/ClientException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* @package ArangoDBClient
* @since 0.2
*/
class ClientException extends
Exception
class ClientException extends Exception
{
/**
* Return a string representation of the exception
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/CollectionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
* @package ArangoDBClient
* @since 0.2
*/
class CollectionHandler extends
Handler
class CollectionHandler extends Handler
{

/**
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/ConnectException.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* @package ArangoDBClient
* @since 0.2
*/
class ConnectException extends
Exception
class ConnectException extends Exception
{
/**
* Return a string representation of the exception
Expand Down
2 changes: 1 addition & 1 deletion lib/ArangoDBClient/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ private function executeRequest($method, $url, $data, array $customHeaders = [])
$startTime = microtime(true);
}

$result = HttpHelper::transfer($handle, $request);
$result = HttpHelper::transfer($handle, $request, $method);

if ($traceFunc) {
// only issue syscall if we need it
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/ConnectionOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
* @package ArangoDBClient
* @since 0.2
*/
class ConnectionOptions implements
\ArrayAccess
class ConnectionOptions implements \ArrayAccess
{
/**
* The current options
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/Cursor.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* @package ArangoDBClient
* @since 0.2
*/
class Cursor implements
\Iterator
class Cursor implements \Iterator
{
/**
* The connection object
Expand Down
10 changes: 5 additions & 5 deletions lib/ArangoDBClient/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ class Document implements \JsonSerializable
protected $_doValidate = false;

/**
* Flag to indicate whether document was changed locally
* An array, that defines which attributes should be treated as hidden.
*
* @var bool
* @var array
*/
protected $_hiddenAttributes = [];

/**
* Flag to indicate whether document was changed locally
* Flag to indicate whether hidden attributes should be ignored or included in returned data-sets
*
* @var bool
*/
Expand Down Expand Up @@ -636,7 +636,7 @@ public function setInternalId($id)
}


if (!preg_match('/^[a-zA-Z0-9_-]{1,64}\/[a-zA-Z0-9_:\.@\-()+,=;$!*\'%]{1,254}$/', $id)) {
if (!preg_match('/^[a-zA-Z0-9_-]{1,64}\/[a-zA-Z0-9_:.@\-()+,=;$!*\'%]{1,254}$/', $id)) {
throw new ClientException('Invalid format for document id');
}

Expand All @@ -660,7 +660,7 @@ public function setInternalKey($key)
throw new ClientException('Should not update the key of an existing document');
}

if (!preg_match('/^[a-zA-Z0-9_:\.@\-()+,=;$!*\'%]{1,254}$/', $key)) {
if (!preg_match('/^[a-zA-Z0-9_:.@\-()+,=;$!*\'%]{1,254}$/', $key)) {
throw new ClientException('Invalid format for document key');
}

Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/DocumentHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
* @package ArangoDBClient
* @since 0.2
*/
class DocumentHandler extends
Handler
class DocumentHandler extends Handler
{
/**
* documents array index
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/Edge.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* @package ArangoDBClient
* @since 1.0
*/
class Edge extends
Document
class Edge extends Document
{
/**
* The edge's from (might be NULL for new documents)
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/EdgeHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
* @package ArangoDBClient
* @since 1.0
*/
class EdgeHandler extends
DocumentHandler
class EdgeHandler extends DocumentHandler
{
/**
* documents array index
Expand Down
3 changes: 1 addition & 2 deletions lib/ArangoDBClient/Exception.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
* @package ArangoDBClient
* @since 0.2
*/
class Exception extends
\Exception
class Exception extends \Exception
{
/**
* Exception constructor.
Expand Down
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.