@@ -79,7 +79,7 @@ class Util implements Countable
79
79
* literal.
80
80
*
81
81
* This method is intended to be the very opposite of
82
- * {@link static::escapeValue()}. hat is, results from that method, if
82
+ * {@link static::escapeValue()}. That is, results from that method, if
83
83
* given to this method, should produce equivalent results.
84
84
*
85
85
* @param string $value The value to be parsed. Must be a literal of a
@@ -459,21 +459,27 @@ public function setMenu($newMenu)
459
459
460
460
/**
461
461
* Creates a Request object.
462
- *
463
- * Creates a {@link Request} object, with a command that's relative to the
462
+ *
463
+ * Creates a {@link Request} object, with a command that's at the
464
464
* current menu. The request can then be sent using {@link Client}.
465
- *
465
+ *
466
466
* @param string $command The command of the request, not including
467
467
* the menu. The request will have that command at the current menu.
468
468
* @param array $args Arguments of the request.
469
- * Follows the same rules as with {@link Util::getAll()}.
469
+ * Each array key is the name of the argument, and each array value is
470
+ * the value of the argument to be passed.
471
+ * Arguments without a value (i.e. empty arguments) can also be
472
+ * specified using a numeric key, and the name of the argument as the
473
+ * array value.
470
474
* @param Query|null $query The {@link Query} of the request.
471
475
* @param string|null $tag The tag of the request.
472
- *
476
+ *
473
477
* @return Request The {@link Request} object.
474
- *
478
+ *
475
479
* @throws NotSupportedException On an attempt to call a command in a
476
- * different menu.
480
+ * different menu using API syntax.
481
+ * @throws InvalidArgumentException On an attempt to call a command in a
482
+ * different menu using CLI syntax.
477
483
*/
478
484
public function newRequest (
479
485
$ command ,
@@ -1015,13 +1021,21 @@ public function count($mode = COUNT_NORMAL, Query $query = null)
1015
1021
* Arguments without a value (i.e. empty arguments) can also be
1016
1022
* specified using a numeric key, and the name of the argument as the
1017
1023
* array value.
1024
+ * The "follow" and "follow-only" arguments are prohibited,
1025
+ * as they would cause a synchronous request to run forever, without
1026
+ * allowing the results to be observed.
1027
+ * If you need to use those arguments, use {@link static::newRequest()},
1028
+ * and pass the resulting {@link Request} to {@link Client::sendAsync()}.
1018
1029
* @param Query|null $query A query to
1019
1030
* filter items by.
1020
1031
* NULL to get all items.
1021
1032
*
1022
1033
* @return ResponseCollection|false A response collection with all
1023
1034
* {@link Response::TYPE_DATA} responses. The collection will be empty
1024
1035
* when there are no matching items. FALSE on failure.
1036
+ *
1037
+ * @throws NotSupportedException If $args contains prohibited arguments
1038
+ * ("follow" or "follow-only").
1025
1039
*/
1026
1040
public function getAll (array $ args = array (), Query $ query = null )
1027
1041
{
@@ -1033,6 +1047,14 @@ public function getAll(array $args = array(), Query $query = null)
1033
1047
$ printRequest ->setArgument ($ name , $ value );
1034
1048
}
1035
1049
}
1050
+ if ($ printRequest ->getArgument ('follow ' ) !== null
1051
+ || $ printRequest ->getArgument ('follow-only ' ) !== null
1052
+ ) {
1053
+ throw new NotSupportedException (
1054
+ 'The "follow" and "follow-only" arguments are prohibited ' ,
1055
+ NotSupportedException::CODE_ARG_PROHIBITED
1056
+ );
1057
+ }
1036
1058
$ responses = $ this ->client ->sendSync ($ printRequest );
1037
1059
1038
1060
if (count ($ responses ->getAllOfType (Response::TYPE_ERROR )) > 0 ) {
0 commit comments