Skip to content

Commit d2b11b7

Browse files
committed
Fixed some inconsistencies, which were introduced during the upgrade to version 3.0.
Also fixed some other bugs. Specifically: - the document/edge options like 'keepNull' were not sent to the server, so updates that were using these option were not getting the expected result. - the unset() function on the document was not implemented, so it was not on par with the examples in the readme. - introduced more tests to also check for the aforementioned issues. - some other minor fixes
2 parents f13c718 + b675dbd commit d2b11b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+3577
-3251
lines changed

.idea/php.xml

Lines changed: 7 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/triagens/ArangoDb/AdminHandler.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ public function getServerVersion($details = false)
5555

5656
if ($details) {
5757
return $data;
58-
} else {
58+
}
59+
else {
5960
return $data['version'];
6061
}
6162
}
62-
63+
6364
/**
6465
* Get the server role
6566
*
@@ -72,7 +73,7 @@ public function getServerVersion($details = false)
7273
*/
7374
public function getServerRole()
7475
{
75-
$url = Urls::URL_ADMIN_SERVER_ROLE;
76+
$url = Urls::URL_ADMIN_SERVER_ROLE;
7677
$response = $this->getConnection()->get($url);
7778
$data = $response->getJson();
7879

lib/triagens/ArangoDb/AqlUserFunction.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
*
4444
* @property string $name - The name of the user function
4545
* @property string $code - The code of the user function
46-
* @property mixed _action
46+
* @property mixed _action
4747
*
4848
* @package triagens\ArangoDb
4949
* @since 1.3
@@ -94,8 +94,8 @@ class AqlUserFunction
9494
* )
9595
*
9696
*
97-
* @param Connection $connection - the connection to be used
98-
* @param array $attributesArray - user function initialization data
97+
* @param Connection $connection - the connection to be used
98+
* @param array $attributesArray - user function initialization data
9999
*
100100
* @return \triagens\ArangoDb\AqlUserFunction
101101
*/
@@ -136,8 +136,8 @@ public function register($name = null, $code = null)
136136
}
137137

138138
$response = $this->_connection->post(
139-
Urls::URL_AQL_USER_FUNCTION,
140-
$this->getConnection()->json_encode_wrapper($attributes)
139+
Urls::URL_AQL_USER_FUNCTION,
140+
$this->getConnection()->json_encode_wrapper($attributes)
141141
);
142142
$responseArray = $response->getJson();
143143

@@ -152,7 +152,7 @@ public function register($name = null, $code = null)
152152
*
153153
* If $name is passed, it will override the object's property with the passed one
154154
*
155-
* @param string $name
155+
* @param string $name
156156
* @param boolean $namespace
157157
*
158158
* @throws Exception throw exception if the request fails
@@ -290,8 +290,8 @@ public function set($key, $value)
290290
*
291291
* @throws ClientException
292292
*
293-
* @param string $key - attribute name
294-
* @param mixed $value - value for attribute
293+
* @param string $key - attribute name
294+
* @param mixed $value - value for attribute
295295
*
296296
* @return void
297297
*/

lib/triagens/ArangoDb/Batch.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class Batch
8181
* To disable this, pass startCapture=>false inside the options array parameter
8282
*
8383
* @param Connection $connection that this batch class will monitor for requests in order to batch them. Connection parameter is mandatory.
84-
* @param array $options An array of options for Batch construction. See below for options:
84+
* @param array $options An array of options for Batch construction. See below for options:
8585
*
8686
* <p>Options are :
8787
* <li>'_sanitize' - True to remove _id and _rev attributes from result documents returned from this batch. Defaults to false.</li>
@@ -160,7 +160,8 @@ public function stopCapture()
160160
$this->setCapture(false);
161161

162162
return $this;
163-
} else {
163+
}
164+
else {
164165
throw new ClientException('Cannot stop capturing with this batch. Batch is not active...');
165166
}
166167
}
@@ -310,7 +311,7 @@ public function nextBatchPartCursorOptions($batchPartCursorOptions)
310311
/**
311312
* Append the request to the batch-part
312313
*
313-
* @param mixed $method - The method of the request (GET, POST...)
314+
* @param mixed $method - The method of the request (GET, POST...)
314315
* @param mixed $request - The request that will get appended to the batch
315316
*
316317
* @return HttpResponse
@@ -341,7 +342,8 @@ public function append($method, $request)
341342
if (is_null($this->_nextBatchPartId)) {
342343
$nextNumeric = count($this->_batchParts);
343344
$this->_batchParts[$nextNumeric] = $batchPart;
344-
} else {
345+
}
346+
else {
345347
$this->_batchParts[$this->_nextBatchPartId] = $batchPart;
346348
$this->_nextBatchPartId = null;
347349
}
@@ -368,7 +370,8 @@ public function splitWithContentIdKey($pattern, $string)
368370

369371
if (!is_null($contentId)) {
370372
$array[$contentId] = $value;
371-
} else {
373+
}
374+
else {
372375
$array[$key] = $value;
373376
}
374377
}
@@ -401,7 +404,8 @@ public function process()
401404

402405
if (!is_null($partValue->getId())) {
403406
$data .= 'Content-Id: ' . (string) $partValue->getId() . HttpHelper::EOL . HttpHelper::EOL;
404-
} else {
407+
}
408+
else {
405409
$data .= HttpHelper::EOL;
406410
}
407411

lib/triagens/ArangoDb/BatchPart.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ class BatchPart
7878
*
7979
* @internal
8080
*
81-
* @param Batch $batch the batch object, that this part belongs to
82-
* @param mixed $id The id of the batch part. TMust be unique and wil be passed to the server in the content-id header
83-
* @param mixed $type The type of the request. This is to distinguish the different request type in order to return correct results.
84-
* @param mixed $request The request string
81+
* @param Batch $batch the batch object, that this part belongs to
82+
* @param mixed $id The id of the batch part. TMust be unique and wil be passed to the server in the content-id header
83+
* @param mixed $type The type of the request. This is to distinguish the different request type in order to return correct results.
84+
* @param mixed $request The request string
8585
* @param mixed $response The response string
86-
* @param mixed $options optional, options like sanitize, that can be passed to the request/response handler.
86+
* @param mixed $options optional, options like sanitize, that can be passed to the request/response handler.
8787
*
8888
* @return BatchPart
8989
*/

lib/triagens/ArangoDb/BindVars.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function get($name)
7575
*
7676
* @throws ClientException
7777
*
78-
* @param mixed $name - name of bind variable OR an array with all bind variables
78+
* @param mixed $name - name of bind variable OR an array with all bind variables
7979
* @param string $value - value for bind variable
8080
*
8181
* @return void
@@ -87,11 +87,13 @@ public function set($name, $value = null)
8787
ValueValidator::validate($value);
8888
}
8989
$this->_values = $name;
90-
} else {
90+
}
91+
else {
9192
if (is_int($name) || is_string($name)) {
9293
$this->_values[(string) $name] = $value;
9394
ValueValidator::validate($value);
94-
} else {
95+
}
96+
else {
9597
throw new ClientException('Bind variable name should be string or int');
9698
}
9799
}

lib/triagens/ArangoDb/Collection.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,14 @@ class Collection
6868
* @var bool - isVolatile value
6969
*/
7070
private $_isVolatile = null;
71-
71+
7272
/**
7373
* The collection numberOfShards value (might be NULL for new collections)
7474
*
7575
* @var int - numberOfShards value
7676
*/
7777
private $_numberOfShards = null;
78-
78+
7979
/**
8080
* The collection shardKeys value (might be NULL for new collections)
8181
*
@@ -141,12 +141,12 @@ class Collection
141141
* Collection 'isVolatile' index
142142
*/
143143
const ENTRY_IS_VOLATILE = 'isVolatile';
144-
144+
145145
/**
146146
* Collection 'numberOfShards' index
147147
*/
148148
const ENTRY_NUMBER_OF_SHARDS = 'numberOfShards';
149-
149+
150150
/**
151151
* Collection 'shardKeys' index
152152
*/
@@ -295,18 +295,18 @@ public function toSerialized()
295295
public function getAll()
296296
{
297297
$result = array(
298-
self::ENTRY_ID => $this->_id,
299-
self::ENTRY_NAME => $this->_name,
300-
self::ENTRY_WAIT_SYNC => $this->_waitForSync,
301-
self::ENTRY_JOURNAL_SIZE => $this->_journalSize,
302-
self::ENTRY_IS_SYSTEM => $this->_isSystem,
303-
self::ENTRY_IS_VOLATILE => $this->_isVolatile,
304-
self::ENTRY_TYPE => $this->_type,
305-
self::ENTRY_STATUS => $this->_status,
306-
self::ENTRY_KEY_OPTIONS => $this->_keyOptions
298+
self::ENTRY_ID => $this->_id,
299+
self::ENTRY_NAME => $this->_name,
300+
self::ENTRY_WAIT_SYNC => $this->_waitForSync,
301+
self::ENTRY_JOURNAL_SIZE => $this->_journalSize,
302+
self::ENTRY_IS_SYSTEM => $this->_isSystem,
303+
self::ENTRY_IS_VOLATILE => $this->_isVolatile,
304+
self::ENTRY_TYPE => $this->_type,
305+
self::ENTRY_STATUS => $this->_status,
306+
self::ENTRY_KEY_OPTIONS => $this->_keyOptions
307307
);
308308

309-
if (! is_null($this->_numberOfShards)) {
309+
if (!is_null($this->_numberOfShards)) {
310310
$result[self::ENTRY_NUMBER_OF_SHARDS] = $this->_numberOfShards;
311311
}
312312

@@ -327,8 +327,8 @@ public function getAll()
327327
*
328328
* @throws ClientException
329329
*
330-
* @param string $key - attribute name
331-
* @param mixed $value - value for attribute
330+
* @param string $key - attribute name
331+
* @param mixed $value - value for attribute
332332
*
333333
* @return void
334334
*/
@@ -391,13 +391,13 @@ public function set($key, $value)
391391

392392
return;
393393
}
394-
394+
395395
if ($key === self::ENTRY_NUMBER_OF_SHARDS) {
396396
$this->setNumberOfShards($value);
397397

398398
return;
399399
}
400-
400+
401401
if ($key === self::ENTRY_SHARD_KEYS) {
402402
$this->setShardKeys($value);
403403

@@ -530,11 +530,11 @@ public function setStatus($status)
530530
if (!in_array(
531531
$status,
532532
array(
533-
self::STATUS_NEW_BORN,
534-
self::STATUS_UNLOADED,
535-
self::STATUS_LOADED,
536-
self::STATUS_BEING_UNLOADED,
537-
self::STATUS_DELETED
533+
self::STATUS_NEW_BORN,
534+
self::STATUS_UNLOADED,
535+
self::STATUS_LOADED,
536+
self::STATUS_BEING_UNLOADED,
537+
self::STATUS_DELETED
538538
)
539539
)
540540
) {
@@ -671,7 +671,7 @@ public function getIsVolatile()
671671
{
672672
return $this->_isVolatile;
673673
}
674-
674+
675675
/**
676676
* Set the numberOfShards value
677677
*
@@ -684,7 +684,7 @@ public function setNumberOfShards($value)
684684
assert(is_null($value) || is_numeric($value));
685685
$this->_numberOfShards = $value;
686686
}
687-
687+
688688
/**
689689
* Get the numberOfShards value (if already known)
690690
*
@@ -694,7 +694,7 @@ public function getNumberOfShards()
694694
{
695695
return $this->_numberOfShards;
696696
}
697-
697+
698698
/**
699699
* Set the shardKeys value
700700
*
@@ -707,7 +707,7 @@ public function setShardKeys($value)
707707
assert(is_null($value) || is_array($value));
708708
$this->_shardKeys = $value;
709709
}
710-
710+
711711
/**
712712
* Get the shardKeys value (if already known)
713713
*

0 commit comments

Comments
 (0)