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. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
LazyPromise.php
01 <?php
02
03 namespace React\Promise;
04
05 class LazyPromise implements ExtendedPromiseInterface, CancellablePromiseInterface
06 {
07 private $factory;
08 private $promise;
09
10 public function __construct(callable $factory)
11 {
12 $this->factory = $factory;
13 }
14
15 public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
16 {
17 return $this->promise()->then($onFulfilled, $onRejected, $onProgress);
18 }
19
20 public function done(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
21 {
22 return $this->promise()->done($onFulfilled, $onRejected, $onProgress);
23 }
24
25 public function otherwise(callable $onRejected)
26 {
27 return $this->promise()->otherwise($onRejected);
28 }
29
30 public function always(callable $onFulfilledOrRejected)
31 {
32 return $this->promise()->always($onFulfilledOrRejected);
33 }
34
35 public function progress(callable $onProgress)
36 {
37 return $this->promise()->progress($onProgress);
38 }
39
40 public function cancel()
41 {
42 return $this->promise()->cancel();
43 }
44
45 private function promise()
46 {
47 if (null === $this->promise) {
48 try {
49 $this->promise = resolve(call_user_func($this->factory));
50 } catch (\Throwable $exception) {
51 $this->promise = new RejectedPromise($exception);
52 } catch (\Exception $exception) {
53 $this->promise = new RejectedPromise($exception);
54 }
55 }
56
57 return $this->promise;
58 }
59 }
60