[ Index ]

PHP Cross Reference of phpBB-3.3.3-deutsch

title

Body

[close]

/vendor/guzzlehttp/promises/src/ -> functions.php (source)

   1  <?php
   2  
   3  namespace GuzzleHttp\Promise;
   4  
   5  /**
   6   * Get the global task queue used for promise resolution.
   7   *
   8   * This task queue MUST be run in an event loop in order for promises to be
   9   * settled asynchronously. It will be automatically run when synchronously
  10   * waiting on a promise.
  11   *
  12   * <code>
  13   * while ($eventLoop->isRunning()) {
  14   *     GuzzleHttp\Promise\queue()->run();
  15   * }
  16   * </code>
  17   *
  18   * @param TaskQueueInterface $assign Optionally specify a new queue instance.
  19   *
  20   * @return TaskQueueInterface
  21   *
  22   * @deprecated queue will be removed in guzzlehttp/promises:2.0. Use Utils::queue instead.
  23   */
  24  function queue(TaskQueueInterface $assign = null)
  25  {
  26      return Utils::queue($assign);
  27  }
  28  
  29  /**
  30   * Adds a function to run in the task queue when it is next `run()` and returns
  31   * a promise that is fulfilled or rejected with the result.
  32   *
  33   * @param callable $task Task function to run.
  34   *
  35   * @return PromiseInterface
  36   *
  37   * @deprecated task will be removed in guzzlehttp/promises:2.0. Use Utils::task instead.
  38   */
  39  function task(callable $task)
  40  {
  41      return Utils::task($task);
  42  }
  43  
  44  /**
  45   * Creates a promise for a value if the value is not a promise.
  46   *
  47   * @param mixed $value Promise or value.
  48   *
  49   * @return PromiseInterface
  50   *
  51   * @deprecated promise_for will be removed in guzzlehttp/promises:2.0. Use Create::promiseFor instead.
  52   */
  53  function promise_for($value)
  54  {
  55      return Create::promiseFor($value);
  56  }
  57  
  58  /**
  59   * Creates a rejected promise for a reason if the reason is not a promise. If
  60   * the provided reason is a promise, then it is returned as-is.
  61   *
  62   * @param mixed $reason Promise or reason.
  63   *
  64   * @return PromiseInterface
  65   *
  66   * @deprecated rejection_for will be removed in guzzlehttp/promises:2.0. Use Create::rejectionFor instead.
  67   */
  68  function rejection_for($reason)
  69  {
  70      return Create::rejectionFor($reason);
  71  }
  72  
  73  /**
  74   * Create an exception for a rejected promise value.
  75   *
  76   * @param mixed $reason
  77   *
  78   * @return \Exception|\Throwable
  79   *
  80   * @deprecated exception_for will be removed in guzzlehttp/promises:2.0. Use Create::exceptionFor instead.
  81   */
  82  function exception_for($reason)
  83  {
  84      return Create::exceptionFor($reason);
  85  }
  86  
  87  /**
  88   * Returns an iterator for the given value.
  89   *
  90   * @param mixed $value
  91   *
  92   * @return \Iterator
  93   *
  94   * @deprecated iter_for will be removed in guzzlehttp/promises:2.0. Use Create::iterFor instead.
  95   */
  96  function iter_for($value)
  97  {
  98      return Create::iterFor($value);
  99  }
 100  
 101  /**
 102   * Synchronously waits on a promise to resolve and returns an inspection state
 103   * array.
 104   *
 105   * Returns a state associative array containing a "state" key mapping to a
 106   * valid promise state. If the state of the promise is "fulfilled", the array
 107   * will contain a "value" key mapping to the fulfilled value of the promise. If
 108   * the promise is rejected, the array will contain a "reason" key mapping to
 109   * the rejection reason of the promise.
 110   *
 111   * @param PromiseInterface $promise Promise or value.
 112   *
 113   * @return array
 114   *
 115   * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspect instead.
 116   */
 117  function inspect(PromiseInterface $promise)
 118  {
 119      return Utils::inspect($promise);
 120  }
 121  
 122  /**
 123   * Waits on all of the provided promises, but does not unwrap rejected promises
 124   * as thrown exception.
 125   *
 126   * Returns an array of inspection state arrays.
 127   *
 128   * @see inspect for the inspection state array format.
 129   *
 130   * @param PromiseInterface[] $promises Traversable of promises to wait upon.
 131   *
 132   * @return array
 133   *
 134   * @deprecated inspect will be removed in guzzlehttp/promises:2.0. Use Utils::inspectAll instead.
 135   */
 136  function inspect_all($promises)
 137  {
 138      return Utils::inspectAll($promises);
 139  }
 140  
 141  /**
 142   * Waits on all of the provided promises and returns the fulfilled values.
 143   *
 144   * Returns an array that contains the value of each promise (in the same order
 145   * the promises were provided). An exception is thrown if any of the promises
 146   * are rejected.
 147   *
 148   * @param iterable<PromiseInterface> $promises Iterable of PromiseInterface objects to wait on.
 149   *
 150   * @return array
 151   *
 152   * @throws \Exception on error
 153   * @throws \Throwable on error in PHP >=7
 154   *
 155   * @deprecated unwrap will be removed in guzzlehttp/promises:2.0. Use Utils::unwrap instead.
 156   */
 157  function unwrap($promises)
 158  {
 159      return Utils::unwrap($promises);
 160  }
 161  
 162  /**
 163   * Given an array of promises, return a promise that is fulfilled when all the
 164   * items in the array are fulfilled.
 165   *
 166   * The promise's fulfillment value is an array with fulfillment values at
 167   * respective positions to the original array. If any promise in the array
 168   * rejects, the returned promise is rejected with the rejection reason.
 169   *
 170   * @param mixed $promises  Promises or values.
 171   * @param bool  $recursive If true, resolves new promises that might have been added to the stack during its own resolution.
 172   *
 173   * @return PromiseInterface
 174   *
 175   * @deprecated all will be removed in guzzlehttp/promises:2.0. Use Utils::all instead.
 176   */
 177  function all($promises, $recursive = false)
 178  {
 179      return Utils::all($promises, $recursive);
 180  }
 181  
 182  /**
 183   * Initiate a competitive race between multiple promises or values (values will
 184   * become immediately fulfilled promises).
 185   *
 186   * When count amount of promises have been fulfilled, the returned promise is
 187   * fulfilled with an array that contains the fulfillment values of the winners
 188   * in order of resolution.
 189   *
 190   * This promise is rejected with a {@see AggregateException} if the number of
 191   * fulfilled promises is less than the desired $count.
 192   *
 193   * @param int   $count    Total number of promises.
 194   * @param mixed $promises Promises or values.
 195   *
 196   * @return PromiseInterface
 197   *
 198   * @deprecated some will be removed in guzzlehttp/promises:2.0. Use Utils::some instead.
 199   */
 200  function some($count, $promises)
 201  {
 202      return Utils::some($count, $promises);
 203  }
 204  
 205  /**
 206   * Like some(), with 1 as count. However, if the promise fulfills, the
 207   * fulfillment value is not an array of 1 but the value directly.
 208   *
 209   * @param mixed $promises Promises or values.
 210   *
 211   * @return PromiseInterface
 212   *
 213   * @deprecated any will be removed in guzzlehttp/promises:2.0. Use Utils::any instead.
 214   */
 215  function any($promises)
 216  {
 217      return Utils::any($promises);
 218  }
 219  
 220  /**
 221   * Returns a promise that is fulfilled when all of the provided promises have
 222   * been fulfilled or rejected.
 223   *
 224   * The returned promise is fulfilled with an array of inspection state arrays.
 225   *
 226   * @see inspect for the inspection state array format.
 227   *
 228   * @param mixed $promises Promises or values.
 229   *
 230   * @return PromiseInterface
 231   *
 232   * @deprecated settle will be removed in guzzlehttp/promises:2.0. Use Utils::settle instead.
 233   */
 234  function settle($promises)
 235  {
 236      return Utils::settle($promises);
 237  }
 238  
 239  /**
 240   * Given an iterator that yields promises or values, returns a promise that is
 241   * fulfilled with a null value when the iterator has been consumed or the
 242   * aggregate promise has been fulfilled or rejected.
 243   *
 244   * $onFulfilled is a function that accepts the fulfilled value, iterator index,
 245   * and the aggregate promise. The callback can invoke any necessary side
 246   * effects and choose to resolve or reject the aggregate if needed.
 247   *
 248   * $onRejected is a function that accepts the rejection reason, iterator index,
 249   * and the aggregate promise. The callback can invoke any necessary side
 250   * effects and choose to resolve or reject the aggregate if needed.
 251   *
 252   * @param mixed    $iterable    Iterator or array to iterate over.
 253   * @param callable $onFulfilled
 254   * @param callable $onRejected
 255   *
 256   * @return PromiseInterface
 257   *
 258   * @deprecated each will be removed in guzzlehttp/promises:2.0. Use Each::of instead.
 259   */
 260  function each(
 261      $iterable,
 262      callable $onFulfilled = null,
 263      callable $onRejected = null
 264  ) {
 265      return Each::of($iterable, $onFulfilled, $onRejected);
 266  }
 267  
 268  /**
 269   * Like each, but only allows a certain number of outstanding promises at any
 270   * given time.
 271   *
 272   * $concurrency may be an integer or a function that accepts the number of
 273   * pending promises and returns a numeric concurrency limit value to allow for
 274   * dynamic a concurrency size.
 275   *
 276   * @param mixed        $iterable
 277   * @param int|callable $concurrency
 278   * @param callable     $onFulfilled
 279   * @param callable     $onRejected
 280   *
 281   * @return PromiseInterface
 282   *
 283   * @deprecated each_limit will be removed in guzzlehttp/promises:2.0. Use Each::ofLimit instead.
 284   */
 285  function each_limit(
 286      $iterable,
 287      $concurrency,
 288      callable $onFulfilled = null,
 289      callable $onRejected = null
 290  ) {
 291      return Each::ofLimit($iterable, $concurrency, $onFulfilled, $onRejected);
 292  }
 293  
 294  /**
 295   * Like each_limit, but ensures that no promise in the given $iterable argument
 296   * is rejected. If any promise is rejected, then the aggregate promise is
 297   * rejected with the encountered rejection.
 298   *
 299   * @param mixed        $iterable
 300   * @param int|callable $concurrency
 301   * @param callable     $onFulfilled
 302   *
 303   * @return PromiseInterface
 304   *
 305   * @deprecated each_limit_all will be removed in guzzlehttp/promises:2.0. Use Each::ofLimitAll instead.
 306   */
 307  function each_limit_all(
 308      $iterable,
 309      $concurrency,
 310      callable $onFulfilled = null
 311  ) {
 312      return Each::ofLimitAll($iterable, $concurrency, $onFulfilled);
 313  }
 314  
 315  /**
 316   * Returns true if a promise is fulfilled.
 317   *
 318   * @return bool
 319   *
 320   * @deprecated is_fulfilled will be removed in guzzlehttp/promises:2.0. Use Is::fulfilled instead.
 321   */
 322  function is_fulfilled(PromiseInterface $promise)
 323  {
 324      return Is::fulfilled($promise);
 325  }
 326  
 327  /**
 328   * Returns true if a promise is rejected.
 329   *
 330   * @return bool
 331   *
 332   * @deprecated is_rejected will be removed in guzzlehttp/promises:2.0. Use Is::rejected instead.
 333   */
 334  function is_rejected(PromiseInterface $promise)
 335  {
 336      return Is::rejected($promise);
 337  }
 338  
 339  /**
 340   * Returns true if a promise is fulfilled or rejected.
 341   *
 342   * @return bool
 343   *
 344   * @deprecated is_settled will be removed in guzzlehttp/promises:2.0. Use Is::settled instead.
 345   */
 346  function is_settled(PromiseInterface $promise)
 347  {
 348      return Is::settled($promise);
 349  }
 350  
 351  /**
 352   * Create a new coroutine.
 353   *
 354   * @see Coroutine
 355   *
 356   * @return PromiseInterface
 357   *
 358   * @deprecated coroutine will be removed in guzzlehttp/promises:2.0. Use Coroutine::of instead.
 359   */
 360  function coroutine(callable $generatorFn)
 361  {
 362      return Coroutine::of($generatorFn);
 363  }


Generated: Sun Feb 14 20:08:31 2021 Cross-referenced by PHPXref 0.7.1