3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace GuzzleHttp\Promise; /** * Get the global task queue used for promise resolution. * * This task queue MUST be run in an event loop in order for promises to be * settled asynchronously. It will be automatically run when synchronously * waiting on a promise. * * <code> * while ($eventLoop->isRunning()) { * GuzzleHttp\Promise\queue()->run(); * } * </code> * * @param TaskQueueInterface $assign Optionally specify a new queue instance. * * @return TaskQueueInterface */ function queue(TaskQueueInterface $assign = null) { static $queue; if ($assign) { $queue = $assign; } elseif (!$queue) { $queue = new TaskQueue(); } return $queue; } /** * Adds a function to run in the task queue when it is next `run()` and returns * a promise that is fulfilled or rejected with the result. * * @param callable $task Task function to run. * * @return PromiseInterface */ function task(callable $task) { $queue = queue(); $promise = new Promise([$queue, 'run']); $queue->add(function () use ($task, $promise) { try { $promise->resolve($task()); } catch (\Throwable $e) { $promise->reject($e); } catch (\Exception $e) { $promise->reject($e); } }); return $promise; } /** * Creates a promise for a value if the value is not a promise. * * @param mixed $value Promise or value. * * @return PromiseInterface */ function promise_for($value) { if ($value instanceof PromiseInterface) { return $value; } // Return a Guzzle promise that shadows the given promise. if (method_exists($value, 'then')) { $wfn = method_exists($value, 'wait') ? [$value, 'wait'] : null; $cfn = method_exists($value, 'cancel') ? [$value, 'cancel'] : null; $promise = new Promise($wfn, $cfn); $value->then([$promise, 'resolve'], [$promise, 'reject']); return $promise; } return new FulfilledPromise($value); } /** * Creates a rejected promise for a reason if the reason is not a promise. If * the provided reason is a promise, then it is returned as-is. * * @param mixed $reason Promise or reason. * * @return PromiseInterface */ function rejection_for($reason) { if ($reason instanceof PromiseInterface) { return $reason; } return new RejectedPromise($reason); } /** * Create an exception for a rejected promise value. * * @param mixed $reason * * @return \Exception|\Throwable */ function exception_for($reason) { return $reason instanceof \Exception || $reason instanceof \Throwable ? $reason : new RejectionException($reason); } /** * Returns an iterator for the given value. * * @param mixed $value * * @return \Iterator */ function iter_for($value) { if ($value instanceof \Iterator) { return $value; } elseif (is_array($value)) { return new \ArrayIterator($value); } else { return new \ArrayIterator([$value]); } } /** * Synchronously waits on a promise to resolve and returns an inspection state * array. * * Returns a state associative array containing a "state" key mapping to a * valid promise state. If the state of the promise is "fulfilled", the array * will contain a "value" key mapping to the fulfilled value of the promise. If * the promise is rejected, the array will contain a "reason" key mapping to * the rejection reason of the promise. * * @param PromiseInterface $promise Promise or value. * * @return array */ function inspect(PromiseInterface $promise) { try { return [ 'state' => PromiseInterface::FULFILLED, 'value' => $promise->wait() ]; } catch (RejectionException $e) { return ['state' => PromiseInterface::REJECTED, 'reason' => $e->getReason()]; } catch (\Throwable $e) { return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; } catch (\Exception $e) { return ['state' => PromiseInterface::REJECTED, 'reason' => $e]; } } /** * Waits on all of the provided promises, but does not unwrap rejected promises * as thrown exception. * * Returns an array of inspection state arrays. * * @param PromiseInterface[] $promises Traversable of promises to wait upon. * * @return array * @see GuzzleHttp\Promise\inspect for the inspection state array format. */ function inspect_all($promises) { $results = []; foreach ($promises as $key => $promise) { $results[$key] = inspect($promise); } return $results; } /** * Waits on all of the provided promises and returns the fulfilled values. * * Returns an array that contains the value of each promise (in the same order * the promises were provided). An exception is thrown if any of the promises * are rejected. * * @param mixed $promises Iterable of PromiseInterface objects to wait on. * * @return array * @throws \Exception on error * @throws \Throwable on error in PHP >=7 */ function unwrap($promises) { $results = []; foreach ($promises as $key => $promise) { $results[$key] = $promise->wait(); } return $results; } /** * Given an array of promises, return a promise that is fulfilled when all the * items in the array are fulfilled. * * The promise's fulfillment value is an array with fulfillment values at * respective positions to the original array. If any promise in the array * rejects, the returned promise is rejected with the rejection reason. * * @param mixed $promises Promises or values. * @param bool $recursive - If true, resolves new promises that might have been added to the stack during its own resolution. * * @return PromiseInterface */ function all($promises, $recursive = false) { $results = []; $promise = each( $promises, function ($value, $idx) use (&$results) { $results[$idx] = $value; }, function ($reason, $idx, Promise $aggregate) { $aggregate->reject($reason); } )->then(function () use (&$results) { ksort($results); return $results; }); if (true === $recursive) { $promise = $promise->then(function ($results) use ($recursive, &$promises) { foreach ($promises AS $promise) { if (\GuzzleHttp\Promise\PromiseInterface::PENDING === $promise->getState()) { return all($promises, $recursive); } } return $results; }); } return $promise; } /** * Initiate a competitive race between multiple promises or values (values will * become immediately fulfilled promises). * * When count amount of promises have been fulfilled, the returned promise is * fulfilled with an array that contains the fulfillment values of the winners * in order of resolution. * * This promise is rejected with a {@see GuzzleHttp\Promise\AggregateException} * if the number of fulfilled promises is less than the desired $count. * * @param int $count Total number of promises. * @param mixed $promises Promises or values. * * @return PromiseInterface */ function some($count, $promises) { $results = []; $rejections = []; return each( $promises, function ($value, $idx, PromiseInterface $p) use (&$results, $count) { if ($p->getState() !== PromiseInterface::PENDING) { return; } $results[$idx] = $value; if (count($results) >= $count) { $p->resolve(null); } }, function ($reason) use (&$rejections) { $rejections[] = $reason; } )->then( function () use (&$results, &$rejections, $count) { if (count($results) !== $count) { throw new AggregateException( 'Not enough promises to fulfill count', $rejections ); } ksort($results); return array_values($results); } ); } /** * Like some(), with 1 as count. However, if the promise fulfills, the * fulfillment value is not an array of 1 but the value directly. * * @param mixed $promises Promises or values. * * @return PromiseInterface */ function any($promises) { return some(1, $promises)->then(function ($values) { return $values[0]; }); } /** * Returns a promise that is fulfilled when all of the provided promises have * been fulfilled or rejected. * * The returned promise is fulfilled with an array of inspection state arrays. * * @param mixed $promises Promises or values. * * @return PromiseInterface * @see GuzzleHttp\Promise\inspect for the inspection state array format. */ function settle($promises) { $results = []; return each( $promises, function ($value, $idx) use (&$results) { $results[$idx] = ['state' => PromiseInterface::FULFILLED, 'value' => $value]; }, function ($reason, $idx) use (&$results) { $results[$idx] = ['state' => PromiseInterface::REJECTED, 'reason' => $reason]; } )->then(function () use (&$results) { ksort($results); return $results; }); } /** * Given an iterator that yields promises or values, returns a promise that is * fulfilled with a null value when the iterator has been consumed or the * aggregate promise has been fulfilled or rejected. * * $onFulfilled is a function that accepts the fulfilled value, iterator * index, and the aggregate promise. The callback can invoke any necessary side * effects and choose to resolve or reject the aggregate promise if needed. * * $onRejected is a function that accepts the rejection reason, iterator * index, and the aggregate promise. The callback can invoke any necessary side * effects and choose to resolve or reject the aggregate promise if needed. * * @param mixed $iterable Iterator or array to iterate over. * @param callable $onFulfilled * @param callable $onRejected * * @return PromiseInterface */ function each( $iterable, callable $onFulfilled = null, callable $onRejected = null ) { return (new EachPromise($iterable, [ 'fulfilled' => $onFulfilled, 'rejected' => $onRejected ]))->promise(); } /** * Like each, but only allows a certain number of outstanding promises at any * given time. * * $concurrency may be an integer or a function that accepts the number of * pending promises and returns a numeric concurrency limit value to allow for * dynamic a concurrency size. * * @param mixed $iterable * @param int|callable $concurrency * @param callable $onFulfilled * @param callable $onRejected * * @return PromiseInterface */ function each_limit( $iterable, $concurrency, callable $onFulfilled = null, callable $onRejected = null ) { return (new EachPromise($iterable, [ 'fulfilled' => $onFulfilled, 'rejected' => $onRejected, 'concurrency' => $concurrency ]))->promise(); } /** * Like each_limit, but ensures that no promise in the given $iterable argument * is rejected. If any promise is rejected, then the aggregate promise is * rejected with the encountered rejection. * * @param mixed $iterable * @param int|callable $concurrency * @param callable $onFulfilled * * @return PromiseInterface */ function each_limit_all( $iterable, $concurrency, callable $onFulfilled = null ) { return each_limit( $iterable, $concurrency, $onFulfilled, function ($reason, $idx, PromiseInterface $aggregate) { $aggregate->reject($reason); } ); } /** * Returns true if a promise is fulfilled. * * @param PromiseInterface $promise * * @return bool */ function is_fulfilled(PromiseInterface $promise) { return $promise->getState() === PromiseInterface::FULFILLED; } /** * Returns true if a promise is rejected. * * @param PromiseInterface $promise * * @return bool */ function is_rejected(PromiseInterface $promise) { return $promise->getState() === PromiseInterface::REJECTED; } /** * Returns true if a promise is fulfilled or rejected. * * @param PromiseInterface $promise * * @return bool */ function is_settled(PromiseInterface $promise) { return $promise->getState() !== PromiseInterface::PENDING; } /** * @see Coroutine * * @param callable $generatorFn * * @return PromiseInterface */ function coroutine(callable $generatorFn) { return new Coroutine($generatorFn); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRbfC
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  471     0  E > > RETURN                                                   1

Function guzzlehttp%5Cpromise%5Cqueue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\queue
number of ops:  12
compiled vars:  !0 = $assign, !1 = $queue
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV_INIT                                        !0      null
   23     1        BIND_STATIC                                              !1
   25     2      > JMPZ                                                     !0, ->5
   26     3    >   ASSIGN                                                   !1, !0
   25     4      > JMP                                                      ->10
   27     5    >   BOOL_NOT                                         ~3      !1
          6      > JMPZ                                                     ~3, ->10
   28     7    >   NEW                                              $4      'GuzzleHttp%5CPromise%5CTaskQueue'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $4
   31    10    > > RETURN                                                   !1
   32    11*     > RETURN                                                   null

End of function guzzlehttp%5Cpromise%5Cqueue

Function guzzlehttp%5Cpromise%5Ctask:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\task
number of ops:  18
compiled vars:  !0 = $task, !1 = $queue, !2 = $promise
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
   44     1        INIT_NS_FCALL_BY_NAME                                    'GuzzleHttp%5CPromise%5Cqueue'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !1, $3
   45     4        NEW                                              $5      'GuzzleHttp%5CPromise%5CPromise'
          5        INIT_ARRAY                                       ~6      !1
          6        ADD_ARRAY_ELEMENT                                ~6      'run'
          7        SEND_VAL_EX                                              ~6
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $5
   46    10        INIT_METHOD_CALL                                         !1, 'add'
         11        DECLARE_LAMBDA_FUNCTION                          ~9      [0]
         12        BIND_LEXICAL                                             ~9, !0
         13        BIND_LEXICAL                                             ~9, !2
   54    14        SEND_VAL_EX                                              ~9
   46    15        DO_FCALL                                      0          
   56    16      > RETURN                                                   !2
   57    17*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 13
2 jumps found. (Code = 107) Position 1 = 14, Position 2 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 13
Branch analysis from position: 13
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\{closure}
number of ops:  18
compiled vars:  !0 = $task, !1 = $promise, !2 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   BIND_STATIC                                              !0
          1        BIND_STATIC                                              !1
   48     2        INIT_METHOD_CALL                                         !1, 'resolve'
          3        INIT_DYNAMIC_CALL                                        !0
          4        DO_FCALL                                      0  $3      
          5        SEND_VAR_NO_REF_EX                                       $3
          6        DO_FCALL                                      0          
          7      > JMP                                                      ->17
   49     8  E > > CATCH                                                    'Throwable', ->13
   50     9    >   INIT_METHOD_CALL                                         !1, 'reject'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0          
         12      > JMP                                                      ->17
   51    13  E > > CATCH                                       last         'Exception'
   52    14    >   INIT_METHOD_CALL                                         !1, 'reject'
         15        SEND_VAR_EX                                              !2
         16        DO_FCALL                                      0          
   54    17    > > RETURN                                                   null

End of Dynamic Function 0

End of function guzzlehttp%5Cpromise%5Ctask

Function guzzlehttp%5Cpromise%5Cpromise_for:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 45
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 18
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
Branch analysis from position: 29
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\promise_for
number of ops:  50
compiled vars:  !0 = $value, !1 = $wfn, !2 = $cfn, !3 = $promise
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   66     0  E >   RECV                                             !0      
   68     1        INSTANCEOF                                               !0, 'GuzzleHttp%5CPromise%5CPromiseInterface'
          2      > JMPZ                                                     ~4, ->4
   69     3    > > RETURN                                                   !0
   73     4    >   INIT_NS_FCALL_BY_NAME                                    'GuzzleHttp%5CPromise%5Cmethod_exists'
          5        SEND_VAR_EX                                              !0
          6        SEND_VAL_EX                                              'then'
          7        DO_FCALL                                      0  $5      
          8      > JMPZ                                                     $5, ->45
   74     9    >   INIT_NS_FCALL_BY_NAME                                    'GuzzleHttp%5CPromise%5Cmethod_exists'
         10        SEND_VAR_EX                                              !0
         11        SEND_VAL_EX                                              'wait'
         12        DO_FCALL                                      0  $6      
         13      > JMPZ                                                     $6, ->18
         14    >   INIT_ARRAY                                       ~7      !0
         15        ADD_ARRAY_ELEMENT                                ~7      'wait'
         16        QM_ASSIGN                                        ~8      ~7
         17      > JMP                                                      ->19
         18    >   QM_ASSIGN                                        ~8      null
         19    >   ASSIGN                                                   !1, ~8
   75    20        INIT_NS_FCALL_BY_NAME                                    'GuzzleHttp%5CPromise%5Cmethod_exists'
         21        SEND_VAR_EX                                              !0
         22        SEND_VAL_EX                                              'cancel'
         23        DO_FCALL                                      0  $10     
         24      > JMPZ                                                     $10, ->29
         25    >   INIT_ARRAY                                       ~11     !0
         26        ADD_ARRAY_ELEMENT                                ~11     'cancel'
         27        QM_ASSIGN                                        ~12     ~11
         28      > JMP                                                      ->30
         29    >   QM_ASSIGN                                        ~12     null
         30    >   ASSIGN                                                   !2, ~12
   76    31        NEW                                              $14     'GuzzleHttp%5CPromise%5CPromise'
         32        SEND_VAR_EX                                              !1
         33        SEND_VAR_EX                                              !2
         34        DO_FCALL                                      0          
         35        ASSIGN                                                   !3, $14
   77    36        INIT_METHOD_CALL                                         !0, 'then'
         37        INIT_ARRAY                                       ~17     !3
         38        ADD_ARRAY_ELEMENT                                ~17     'resolve'
         39        SEND_VAL_EX                                              ~17
         40        INIT_ARRAY                                       ~18     !3
         41        ADD_ARRAY_ELEMENT                                ~18     'reject'
         42        SEND_VAL_EX                                              ~18
         43        DO_FCALL                                      0          
   78    44      > RETURN                                                   !3
   81    45    >   NEW                                              $20     'GuzzleHttp%5CPromise%5CFulfilledPromise'
         46        SEND_VAR_EX                                              !0
         47        DO_FCALL                                      0          
         48      > RETURN                                                   $20
   82    49*     > RETURN                                                   null

End of function guzzlehttp%5Cpromise%5Cpromise_for

Function guzzlehttp%5Cpromise%5Crejection_for:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\rejection_for
number of ops:  9
compiled vars:  !0 = $reason
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   92     0  E >   RECV                                             !0      
   94     1        INSTANCEOF                                               !0, 'GuzzleHttp%5CPromise%5CPromiseInterface'
          2      > JMPZ                                                     ~1, ->4
   95     3    > > RETURN                                                   !0
   98     4    >   NEW                                              $2      'GuzzleHttp%5CPromise%5CRejectedPromise'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7      > RETURN                                                   $2
   99     8*     > RETURN                                                   null

End of function guzzlehttp%5Cpromise%5Crejection_for

Function guzzlehttp%5Cpromise%5Cexception_for:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\exception_for
number of ops:  14
compiled vars:  !0 = $reason
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  108     0  E >   RECV                                             !0      
  110     1        INSTANCEOF                                       ~1      !0, 'Exception'
          2      > JMPNZ_EX                                         ~1      ~1, ->5
          3    >   INSTANCEOF                                       ~2      !0, 'Throwable'
          4        BOOL                                             ~1      ~2
          5    > > JMPZ                                                     ~1, ->8
  111     6    >   QM_ASSIGN                                        ~3      !0
          7      > JMP                                                      ->12
  112     8    >   NEW                                              $4      'GuzzleHttp%5CPromise%5CRejectionException'
          9        SEND_VAR_EX                                              !0
         10        DO_FCALL                                      0          
         11        QM_ASSIGN                                        ~3      $4
         12    > > RETURN                                                   ~3
  113    13*     > RETURN                                                   null

End of function guzzlehttp%5Cpromise%5Cexception_for

Function guzzlehttp%5Cpromise%5Citer_for:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\iter_for
number of ops:  20
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  122     0  E >   RECV                                             !0      
  124     1        INSTANCEOF                                               !0, 'Iterator'
          2      > JMPZ                                                     ~1, ->5
  125     3    > > RETURN                                                   !0
  124     4*       JMP                                                      ->19
  126     5    >   INIT_NS_FCALL_BY_NAME                                    'GuzzleHttp%5CPromise%5Cis_array'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0  $2      
          8      > JMPZ                                                     $2, ->14
  127     9    >   NEW                                              $3      'ArrayIterator'
         10        SEND_VAR_EX                                              !0
         11        DO_FCALL                                      0          
         12      > RETURN                                                   $3
  126    13*       JMP                                                      ->19
  129    14    >   NEW                                              $5      'ArrayIterator'
         15        INIT_ARRAY                                       ~6      !0
         16        SEND_VAL_EX                                              ~6
         17        DO_FCALL                                      0          
         18      > RETURN                                                   $5
  131    19*     > RETURN                                                   null

End of function guzzlehttp%5Cpromise%5Citer_for

Function guzzlehttp%5Cpromise%5Cinspect:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = 16
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 107) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 107) Position 1 = 23, Position 2 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 16
Branch analysis from position: 16
Found catch point at position: 22
Branch analysis from position: 22
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\inspect
number of ops:  28
compiled vars:  !0 = $promise, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  147     0  E >   RECV                                             !0      
  151     1        FETCH_CLASS_CONSTANT                             ~2      'GuzzleHttp%5CPromise%5CPromiseInterface', 'FULFILLED'
          2        INIT_ARRAY                                       ~3      ~2, 'state'
  152     3        INIT_METHOD_CALL                                         !0, 'wait'
          4        DO_FCALL                                      0  $4      
          5        ADD_ARRAY_ELEMENT                                ~3      $4, 'value'
          6      > RETURN                                                   ~3
          7*       JMP                                                      ->27
  154     8  E > > CATCH                                                    'GuzzleHttp%5CPromise%5CRejectionException', ->16
  155     9    >   FETCH_CLASS_CONSTANT                             ~5      'GuzzleHttp%5CPromise%5CPromiseInterface', 'REJECTED'
         10        INIT_ARRAY                                       ~6      ~5, 'state'
         11        INIT_METHOD_CALL                                         !1, 'getReason'
         12        DO_FCALL                                      0  $7      
         13        ADD_ARRAY_ELEMENT                                ~6      $7, 'reason'
         14      > RETURN                                                   ~6
         15*       JMP                                                      ->27
  156    16  E > > CATCH                                                    'Throwable', ->22
  157    17    >   FETCH_CLASS_CONSTANT                             ~8      'GuzzleHttp%5CPromise%5CPromiseInterface', 'REJECTED'
         18        INIT_ARRAY                                       ~9      ~8, 'state'
         19        ADD_ARRAY_ELEMENT                                ~9      !1, 'reason'
         20      > RETURN                                                   ~9
         21*       JMP                                                      ->27
  158    22  E > > CATCH                                       last         'Exception'
  159    23    >   FETCH_CLASS_CONSTANT                             ~10     'GuzzleHttp%5CPromise%5CPromiseInterface', 'REJECTED'
         24        INIT_ARRAY                                       ~11     ~10, 'state'
         25        ADD_ARRAY_ELEMENT                                ~11     !1, 'reason'
         26      > RETURN                                                   ~11
  161    27*     > RETURN                                                   null

End of function guzzlehttp%5Cpromise%5Cinspect

Function guzzlehttp%5Cpromise%5Cinspect_all:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 11
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\inspect_all
number of ops:  14
compiled vars:  !0 = $promises, !1 = $results, !2 = $promise, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  174     0  E >   RECV                                             !0      
  176     1        ASSIGN                                                   !1, <array>
  177     2      > FE_RESET_R                                       $5      !0, ->11
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->11
          4    >   ASSIGN                                                   !3, ~6
  178     5        INIT_NS_FCALL_BY_NAME                                    'GuzzleHttp%5CPromise%5Cinspect'
          6        SEND_VAR_EX                                              !2
          7        DO_FCALL                                      0  $9      
          8        ASSIGN_DIM                                               !1, !3
          9        OP_DATA                                                  $9
  177    10      > JMP                                                      ->3
         11    >   FE_FREE                                                  $5
  181    12      > RETURN                                                   !1
  182    13*     > RETURN                                                   null

End of function guzzlehttp%5Cpromise%5Cinspect_all

Function guzzlehttp%5Cpromise%5Cunwrap:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 10
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\unwrap
number of ops:  13
compiled vars:  !0 = $promises, !1 = $results, !2 = $promise, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  197     0  E >   RECV                                             !0      
  199     1        ASSIGN                                                   !1, <array>
  200     2      > FE_RESET_R                                       $5      !0, ->10
          3    > > FE_FETCH_R                                       ~6      $5, !2, ->10
          4    >   ASSIGN                                                   !3, ~6
  201     5        INIT_METHOD_CALL                                         !2, 'wait'
          6        DO_FCALL                                      0  $9      
          7        ASSIGN_DIM                                               !1, !3
          8        OP_DATA                                                  $9
  200     9      > JMP                                                      ->3
         10    >   FE_FREE                                                  $5
  204    11      > RETURN                                                   !1
  205    12*     > RETURN                                                   null

End of function guzzlehttp%5Cpromise%5Cunwrap

Function guzzlehttp%5Cpromise%5Call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\all
number of ops:  28
compiled vars:  !0 = $promises, !1 = $recursive, !2 = $results, !3 = $promise
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  220     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <false>
  222     2        ASSIGN                                                   !2, <array>
  223     3        INIT_NS_FCALL_BY_NAME                                    'GuzzleHttp%5CPromise%5Ceach'
  224     4        SEND_VAR_EX                                              !0
  225     5        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          6        BIND_LEXICAL                                             ~5, !2
  227     7        SEND_VAL_EX                                              ~5
  228     8        DECLARE_LAMBDA_FUNCTION                          ~6      [1]
  230     9        SEND_VAL_EX                                              ~6
  223    10        DO_FCALL                                      0  $7      
  231    11        INIT_METHOD_CALL                                         $7, 'then'
         12        DECLARE_LAMBDA_FUNCTION                          ~8      [2]
         13        BIND_LEXICAL                                             ~8, !2
  234    14        SEND_VAL_EX                                              ~8
  231    15        DO_FCALL                                      0  $9      
  223    16        ASSIGN                                                   !3, $9
  236    17        TYPE_CHECK                                    8          !1
         18      > JMPZ                                                     ~11, ->26
  237    19    >   INIT_METHOD_CALL                                         !3, 'then'
         20        DECLARE_LAMBDA_FUNCTION                          ~12     [3]
         21        BIND_LEXICAL                                             ~12, !1
         22        BIND_LEXICAL                                             ~12, !0
  244    23        SEND_VAL_EX                                              ~12
  237    24        DO_FCALL                                      0  $13     
         25        ASSIGN                                                   !3, $13
  247    26    > > RETURN                                                   !3
  248    27*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\{closure}
number of ops:  6
compiled vars:  !0 = $value, !1 = $idx, !2 = $results
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  225     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
  226     3        ASSIGN_DIM                                               !2, !1
          4        OP_DATA                                                  !0
  227     5      > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\{closure}
number of ops:  7
compiled vars:  !0 = $reason, !1 = $idx, !2 = $aggregate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  228     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
  229     3        INIT_METHOD_CALL                                         !2, 'reject'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
  230     6      > RETURN                                                   null

End of Dynamic Function 1

Dynamic Function 2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\{closure}
number of ops:  6
compiled vars:  !0 = $results
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  231     0  E >   BIND_STATIC                                              !0
  232     1        INIT_NS_FCALL_BY_NAME                                    'GuzzleHttp%5CPromise%5Cksort'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
  233     4      > RETURN                                                   !0
  234     5*     > RETURN                                                   null

End of Dynamic Function 2

Dynamic Function 3
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 17
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/KRbfC
function name:  GuzzleHttp\Promise\{closure}
number of ops:  20
compiled vars:  !0 = $results, !1 = $recursive, !2 = $promises, !3 = $promise
line      #* E I O op                           fetch          ext  return  operands
---------------------

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.52 ms | 1471 KiB | 19 Q