Conditions | 5 |
Paths | 5 |
Total Lines | 20 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 0 |
1 | <?php declare(strict_types = 1); |
||
62 | public function read(): Promise |
||
63 | { |
||
64 | if ($this->error !== null) { |
||
65 | return new Failure($this->error); |
||
66 | } |
||
67 | |||
68 | if ($this->ended) { |
||
69 | return new Success(null); |
||
70 | } |
||
71 | |||
72 | if (count($this->buffer) > 0) { |
||
73 | return new Success(\array_shift($this->buffer)); |
||
74 | } |
||
75 | |||
76 | if ($this->readPromisor === null) { |
||
77 | $this->readPromisor = new Deferred; |
||
78 | } |
||
79 | |||
80 | return $this->readPromisor->promise(); |
||
81 | } |
||
82 | |||
88 |
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.
To visualize
will produce issues in the first and second line, while this second example
will produce no issues.