Skip to content

Commit 9955bbc

Browse files
committed
Exceptions' Declaration in Docblocks
1 parent c259963 commit 9955bbc

15 files changed

+417
-356
lines changed

lib/triagens/ArangoDb/AqlUserFunction.php

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -207,18 +207,20 @@ protected function getConnection()
207207
}
208208

209209

210-
/**
211-
* Set name of the user function. It must have at least one namespace, but also can have sub-namespaces.
212-
* correct:
213-
* 'myNamespace:myFunction'
214-
* 'myRootNamespace:mySubNamespace:myFunction'
215-
*
216-
* wrong:
217-
* 'myFunction'
218-
*
219-
*
220-
* @param string $value
221-
*/
210+
/**
211+
* Set name of the user function. It must have at least one namespace, but also can have sub-namespaces.
212+
* correct:
213+
* 'myNamespace:myFunction'
214+
* 'myRootNamespace:mySubNamespace:myFunction'
215+
*
216+
* wrong:
217+
* 'myFunction'
218+
*
219+
*
220+
* @param string $value
221+
*
222+
* @throws \triagens\ArangoDb\ClientException
223+
*/
222224
public function setName($value)
223225
{
224226
$this->set(self::ENTRY_NAME, (string) $value);
@@ -235,11 +237,13 @@ public function getName()
235237
return $this->get(self::ENTRY_NAME);
236238
}
237239

238-
/**
239-
* Set user function code
240-
*
241-
* @param string $value
242-
*/
240+
/**
241+
* Set user function code
242+
*
243+
* @param string $value
244+
*
245+
* @throws \triagens\ArangoDb\ClientException
246+
*/
243247
public function setCode($value)
244248
{
245249
$this->set(self::ENTRY_CODE, (string) $value);

lib/triagens/ArangoDb/Collection.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,13 @@ class Collection
192192
*/
193193
const STATUS_DELETED = 5;
194194

195-
/**
196-
* Constructs an empty collection
197-
*
198-
* @param string $name - name for the collection
199-
*
200-
*/
195+
/**
196+
* Constructs an empty collection
197+
*
198+
* @param string $name - name for the collection
199+
*
200+
* @throws \triagens\ArangoDb\ClientException
201+
*/
201202
public function __construct($name = null)
202203
{
203204
if ($name !== null) {

lib/triagens/ArangoDb/CollectionHandler.php

Lines changed: 103 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -706,19 +706,21 @@ public function isValidCollectionId($collectionId)
706706
return !$collectionId || !(is_string($collectionId) || is_float($collectionId) || is_int($collectionId));
707707
}
708708

709-
/**
710-
* Get list of all available collections per default with the collection names as index.
711-
* Returns empty array if none are available.
712-
*
713-
* @param array $options - optional - an array of options.
714-
* <p>Options are :<br>
715-
* <li>'excludeSystem' - With a value of true, all system collections will be excluded from the response.</li>
716-
* <li>'keys' - With a value of "collections", the index of the resulting array is numerical,
717-
* With a value of "names", the index of the resulting array are the collection names.</li>
718-
* </p>
719-
*
720-
* @return array
721-
*/
709+
/**
710+
* Get list of all available collections per default with the collection names as index.
711+
* Returns empty array if none are available.
712+
*
713+
* @param array $options - optional - an array of options.
714+
* <p>Options are :<br>
715+
* <li>'excludeSystem' - With a value of true, all system collections will be excluded from the response.</li>
716+
* <li>'keys' - With a value of "collections", the index of the resulting array is numerical,
717+
* With a value of "names", the index of the resulting array are the collection names.</li>
718+
* </p>
719+
*
720+
* @return array
721+
* @throws \triagens\ArangoDb\Exception
722+
* @throws \triagens\ArangoDb\ClientException
723+
*/
722724
public function getAllCollections(array $options = [])
723725
{
724726
$options = array_merge(['excludeSystem' => false, 'keys' => 'result'], $options);
@@ -898,18 +900,19 @@ public function import(
898900
}
899901

900902

901-
/**
902-
* Create a hash index
903-
*
904-
* @param string $collectionId - the collection id
905-
* @param array $fields - an array of fields
906-
* @param boolean $unique - whether the values in the index should be unique or not
907-
* @param boolean $sparse - whether the index should be sparse
908-
*
909-
* @link https://docs.arangodb.com/HttpIndexes/Hash.html
910-
*
911-
* @return array - server response of the created index
912-
*/
903+
/**
904+
* Create a hash index
905+
*
906+
* @param string $collectionId - the collection id
907+
* @param array $fields - an array of fields
908+
* @param boolean $unique - whether the values in the index should be unique or not
909+
* @param boolean $sparse - whether the index should be sparse
910+
*
911+
* @link https://docs.arangodb.com/HttpIndexes/Hash.html
912+
*
913+
* @return array - server response of the created index
914+
* @throws \triagens\ArangoDb\Exception
915+
*/
913916
public function createHashIndex($collectionId, array $fields, $unique = null, $sparse = null)
914917
{
915918
$indexOptions = [];
@@ -924,17 +927,18 @@ public function createHashIndex($collectionId, array $fields, $unique = null, $s
924927
return $this->index($collectionId, self::OPTION_HASH_INDEX, $fields, null, $indexOptions);
925928
}
926929

927-
/**
928-
* Create a fulltext index
929-
*
930-
* @param string $collectionId - the collection id
931-
* @param array $fields - an array of fields
932-
* @param int $minLength - the minimum length of words to index
933-
*
934-
* @link https://docs.arangodb.com/HttpIndexes/Fulltext.html
935-
*
936-
* @return array - server response of the created index
937-
*/
930+
/**
931+
* Create a fulltext index
932+
*
933+
* @param string $collectionId - the collection id
934+
* @param array $fields - an array of fields
935+
* @param int $minLength - the minimum length of words to index
936+
*
937+
* @link https://docs.arangodb.com/HttpIndexes/Fulltext.html
938+
*
939+
* @return array - server response of the created index
940+
* @throws \triagens\ArangoDb\Exception
941+
*/
938942
public function createFulltextIndex($collectionId, array $fields, $minLength = null)
939943
{
940944
$indexOptions = [];
@@ -946,18 +950,19 @@ public function createFulltextIndex($collectionId, array $fields, $minLength = n
946950
return $this->index($collectionId, self::OPTION_FULLTEXT_INDEX, $fields, null, $indexOptions);
947951
}
948952

949-
/**
950-
* Create a skip-list index
951-
*
952-
* @param string $collectionId - the collection id
953-
* @param array $fields - an array of fields
954-
* @param bool $unique - whether the index is unique or not
955-
* @param bool $sparse - whether the index should be sparse
956-
*
957-
* @link https://docs.arangodb.com/HttpIndexes/Skiplist.html
958-
*
959-
* @return array - server response of the created index
960-
*/
953+
/**
954+
* Create a skip-list index
955+
*
956+
* @param string $collectionId - the collection id
957+
* @param array $fields - an array of fields
958+
* @param bool $unique - whether the index is unique or not
959+
* @param bool $sparse - whether the index should be sparse
960+
*
961+
* @link https://docs.arangodb.com/HttpIndexes/Skiplist.html
962+
*
963+
* @return array - server response of the created index
964+
* @throws \triagens\ArangoDb\Exception
965+
*/
961966
public function createSkipListIndex($collectionId, array $fields, $unique = null, $sparse = null)
962967
{
963968
$indexOptions = [];
@@ -972,19 +977,20 @@ public function createSkipListIndex($collectionId, array $fields, $unique = null
972977
return $this->index($collectionId, self::OPTION_SKIPLIST_INDEX, $fields, null, $indexOptions);
973978
}
974979

975-
/**
976-
* Create a geo index
977-
*
978-
* @param string $collectionId - the collection id
979-
* @param array $fields - an array of fields
980-
* @param boolean $geoJson - whether to use geoJson or not
981-
* @param boolean $constraint - whether this is a constraint or not
982-
* @param boolean $ignoreNull - whether to ignore null
983-
*
984-
* @link https://docs.arangodb.com/HttpIndexes/Geo.html
985-
*
986-
* @return array - server response of the created index
987-
*/
980+
/**
981+
* Create a geo index
982+
*
983+
* @param string $collectionId - the collection id
984+
* @param array $fields - an array of fields
985+
* @param boolean $geoJson - whether to use geoJson or not
986+
* @param boolean $constraint - whether this is a constraint or not
987+
* @param boolean $ignoreNull - whether to ignore null
988+
*
989+
* @link https://docs.arangodb.com/HttpIndexes/Geo.html
990+
*
991+
* @return array - server response of the created index
992+
* @throws \triagens\ArangoDb\Exception
993+
*/
988994
public function createGeoIndex(
989995
$collectionId,
990996
array $fields,
@@ -1060,14 +1066,16 @@ public function index($collectionId, $type = '', array $attributes = [], $unique
10601066
}
10611067

10621068

1063-
/**
1064-
* Get the information about an index in a collection
1065-
*
1066-
* @param string $collection - the id of the collection
1067-
* @param string $indexId - the id of the index
1068-
*
1069-
* @return array
1070-
*/
1069+
/**
1070+
* Get the information about an index in a collection
1071+
*
1072+
* @param string $collection - the id of the collection
1073+
* @param string $indexId - the id of the index
1074+
*
1075+
* @return array
1076+
* @throws \triagens\ArangoDb\Exception
1077+
* @throws \triagens\ArangoDb\ClientException
1078+
*/
10711079
public function getIndex($collection, $indexId)
10721080
{
10731081
$url = UrlHelper::buildUrl(Urls::URL_INDEX, [$collection, $indexId]);
@@ -1146,30 +1154,32 @@ public function any($collectionId)
11461154
}
11471155

11481156

1149-
/**
1150-
* Returns all documents of a collection
1151-
*
1152-
* @param mixed $collectionId - collection id as string or number
1153-
* @param array $options - optional array of options.
1154-
* <p>Options are :<br>
1155-
* <li>'_sanitize' - True to remove _id and _rev attributes from result documents. Defaults to false.</li>
1156-
* <li>'sanitize' - Deprecated, please use '_sanitize'.</li>
1157-
* <li>'_hiddenAttributes' - Set an array of hidden attributes for created documents.
1158-
* <li>'hiddenAttributes' - Deprecated, please use '_hiddenAttributes'.</li>
1159-
* <p>
1160-
* This is actually the same as setting hidden attributes using setHiddenAttributes() on a document.<br>
1161-
* The difference is, that if you're returning a resultset of documents, the getAll() is already called<br>
1162-
* and the hidden attributes would not be applied to the attributes.<br>
1163-
* </p>
1164-
*
1165-
* <li>'batchSize' - can optionally be used to tell the server to limit the number of results to be transferred in one batch</li>
1166-
* <li>'skip' - Optional, The number of documents to skip in the query.</li>
1167-
* <li>'limit' - Optional, The maximal amount of documents to return. 'skip' is applied before the limit restriction.</li>
1168-
* </li>
1169-
* </p>
1170-
*
1171-
* @return Cursor - documents
1172-
*/
1157+
/**
1158+
* Returns all documents of a collection
1159+
*
1160+
* @param mixed $collectionId - collection id as string or number
1161+
* @param array $options - optional array of options.
1162+
* <p>Options are :<br>
1163+
* <li>'_sanitize' - True to remove _id and _rev attributes from result documents. Defaults to false.</li>
1164+
* <li>'sanitize' - Deprecated, please use '_sanitize'.</li>
1165+
* <li>'_hiddenAttributes' - Set an array of hidden attributes for created documents.
1166+
* <li>'hiddenAttributes' - Deprecated, please use '_hiddenAttributes'.</li>
1167+
* <p>
1168+
* This is actually the same as setting hidden attributes using setHiddenAttributes() on a document.<br>
1169+
* The difference is, that if you're returning a resultset of documents, the getAll() is already called<br>
1170+
* and the hidden attributes would not be applied to the attributes.<br>
1171+
* </p>
1172+
*
1173+
* <li>'batchSize' - can optionally be used to tell the server to limit the number of results to be transferred in one batch</li>
1174+
* <li>'skip' - Optional, The number of documents to skip in the query.</li>
1175+
* <li>'limit' - Optional, The maximal amount of documents to return. 'skip' is applied before the limit restriction.</li>
1176+
* </li>
1177+
* </p>
1178+
*
1179+
* @return Cursor - documents
1180+
* @throws \triagens\ArangoDb\Exception
1181+
* @throws \triagens\ArangoDb\ClientException
1182+
*/
11731183
public function all($collectionId, array $options = [])
11741184
{
11751185
$options = array_merge($options, $this->getCursorOptions($options));

lib/triagens/ArangoDb/Connection.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ private function updateHttpHeader()
357357
*
358358
* @throws ClientException
359359
* @return resource - connection handle
360+
* @throws \triagens\ArangoDb\ConnectException
360361
*/
361362
private function getHandle()
362363
{
@@ -662,6 +663,7 @@ public function getBatches()
662663
* if we're not in batch mode it doesn't return anything, and
663664
*
664665
* @return mixed Batchpart or null if not in batch capturing mode
666+
* @throws \triagens\ArangoDb\ClientException
665667
*/
666668
private function doBatch($method, $request)
667669
{
@@ -764,6 +766,7 @@ public static function check_encoding($data)
764766
* @param mixed $options the options for the json_encode() call
765767
*
766768
* @return string the result of the json_encode
769+
* @throws \triagens\ArangoDb\ClientException
767770
*/
768771
public function json_encode_wrapper($data, $options = null)
769772
{

lib/triagens/ArangoDb/ConnectionOptions.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ class ConnectionOptions implements
199199
*
200200
* @param array $options - initial options
201201
*
202+
* @throws \triagens\ArangoDb\ClientException
202203
*/
203204
public function __construct(array $options)
204205
{

0 commit comments

Comments
 (0)