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

FulfilledPromise.php

Zuletzt modifiziert: 09.10.2024, 12:56 - Dateigröße: 1.74 KiB


 01  <?php
 02   
 03  namespace React\Promise;
 04   
 05  class FulfilledPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
 06  {
 07      private $value;
 08   
 09      public function __construct($value = null)
 10      {
 11          if ($value instanceof PromiseInterface) {
 12              throw new \InvalidArgumentException('You cannot create React\Promise\FulfilledPromise with a promise. Use React\Promise\resolve($promiseOrValue) instead.');
 13          }
 14   
 15          $this->value = $value;
 16      }
 17   
 18      public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
 19      {
 20          if (null === $onFulfilled) {
 21              return $this;
 22          }
 23   
 24          try {
 25              return resolve($onFulfilled($this->value));
 26          } catch (\Throwable $exception) {
 27              return new RejectedPromise($exception);
 28          } catch (\Exception $exception) {
 29              return new RejectedPromise($exception);
 30          }
 31      }
 32   
 33      public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
 34      {
 35          if (null === $onFulfilled) {
 36              return;
 37          }
 38   
 39          $result = $onFulfilled($this->value);
 40   
 41          if ($result instanceof ExtendedPromiseInterface) {
 42              $result->done();
 43          }
 44      }
 45   
 46      public function otherwise(callable $onRejected)
 47      {
 48          return $this;
 49      }
 50   
 51      public function always(callable $onFulfilledOrRejected)
 52      {
 53          return $this->then(function ($value) use ($onFulfilledOrRejected) {
 54              return resolve($onFulfilledOrRejected())->then(function () use ($value) {
 55                  return $value;
 56              });
 57          });
 58      }
 59   
 60      public function progress(callable $onProgress)
 61      {
 62          return $this;
 63      }
 64   
 65      public function cancel()
 66      {
 67      }
 68  }
 69