Total Complexity | 7 |
Total Lines | 44 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
20 | class WriteHistory |
||
21 | { |
||
22 | private $_limit; |
||
23 | private $_data = []; |
||
24 | |||
25 | /** |
||
26 | * @param int $limit |
||
27 | */ |
||
28 | 26 | public function __construct($limit) |
|
31 | } |
||
32 | |||
33 | /** |
||
34 | * Whether the history has reached its limit of entries. |
||
35 | */ |
||
36 | 25 | public function isFull() |
|
37 | { |
||
38 | 25 | return count($this->_data) >= $this->_limit; |
|
39 | } |
||
40 | |||
41 | 1 | public function hasWrites() |
|
42 | { |
||
43 | 1 | return (bool) array_sum($this->_data); |
|
44 | } |
||
45 | |||
46 | 23 | public function isFullWithNoWrites() |
|
49 | } |
||
50 | |||
51 | /** |
||
52 | * Logs the return value from a write call. |
||
53 | * Returns the input value. |
||
54 | */ |
||
55 | 23 | public function log($write) |
|
64 | } |
||
65 | } |
||
66 |