Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

So funktioniert es


Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück

Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

(Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

CompletedFutureValue.php

Zuletzt modifiziert: 09.10.2024, 12:57 - Dateigröße: 1.34 KiB


01  <?php
02  namespace GuzzleHttp\Ring\Future;
03   
04  use React\Promise\FulfilledPromise;
05  use React\Promise\RejectedPromise;
06   
07  /**
08   * Represents a future value that has been resolved or rejected.
09   */
10  class CompletedFutureValue implements FutureInterface
11  {
12      protected $result;
13      protected $error;
14   
15      private $cachedPromise;
16   
17      /**
18       * @param mixed      $result Resolved result
19       * @param \Exception $e      Error. Pass a GuzzleHttp\Ring\Exception\CancelledFutureAccessException
20       *                           to mark the future as cancelled.
21       */
22      public function __construct($result, \Exception $e = null)
23      {
24          $this->result = $result;
25          $this->error = $e;
26      }
27   
28      public function wait()
29      {
30          if ($this->error) {
31              throw $this->error;
32          }
33   
34          return $this->result;
35      }
36   
37      public function cancel() {}
38   
39      public function promise()
40      {
41          if (!$this->cachedPromise) {
42              $this->cachedPromise = $this->error
43                  ? new RejectedPromise($this->error)
44                  : new FulfilledPromise($this->result);
45          }
46   
47          return $this->cachedPromise;
48      }
49   
50      public function then(
51          callable $onFulfilled = null,
52          callable $onRejected = null,
53          callable $onProgress = null
54      ) {
55          return $this->promise()->then($onFulfilled, $onRejected, $onProgress);
56      }
57  }
58