Passed
Push — master ( d0ebb7...0d8755 )
by Rudi
03:39
created

Deque::shouldIncreaseCapacity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
namespace Ds;
3
4
/**
5
 * A Deque (pronounced "deck") is a sequence of values in a contiguous buffer
6
 * that grows and shrinks automatically. The name is a common abbreviation of
7
 * "double-ended queue".
8
 *
9
 * While a Deque is very similar to a Vector, it offers constant time operations
10
 * at both ends of the buffer, ie. shift, unshift, push and pop are all O(1).
11
 *
12
 * @package Ds
13
 */
14
final class Deque implements Sequence
15
{
16
    use Traits\GenericCollection;
17
    use Traits\GenericSequence;
18
    use Traits\SquaredCapacity;
19
20
    const MIN_CAPACITY = 8;
21
22
    protected function shouldIncreaseCapacity(): bool
23
    {
24
        return count($this) >= $this->capacity;
25
    }
26
}
27