| Conditions | 4 |
| Paths | 5 |
| Total Lines | 26 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 67 | public function created() : Promised |
||
| 68 | { |
||
| 69 | $created = ($this->dialer)(); |
||
| 70 | |||
| 71 | if ($created instanceof Generator) { |
||
| 72 | $created = async($created); |
||
| 73 | goto PROMISED; |
||
| 74 | } |
||
| 75 | |||
| 76 | if ($created instanceof Poolable) { |
||
| 77 | // currently usable instance |
||
| 78 | $created->pool($this->pool); |
||
| 79 | return Promise::resolved($created); |
||
| 80 | } |
||
| 81 | |||
| 82 | PROMISED: |
||
| 83 | |||
| 84 | if ($created instanceof Promised) { |
||
| 85 | // deferred create instance |
||
| 86 | $created->then(function (Poolable $created) { |
||
| 87 | $created->pool($this->pool); |
||
| 88 | }); |
||
| 89 | return $created; |
||
| 90 | } |
||
| 91 | |||
| 92 | throw new InvalidConnectorException($this->identify()); |
||
| 93 | } |
||
| 95 |