Test Failed
Push — master ( 322858...27bed3 )
by Rudi
03:26
created

Vector::shouldIncreaseCapacity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
namespace Ds;
3
4
/**
5
 * A Vector is a sequence of values in a contiguous buffer that grows and
6
 * shrinks automatically. It’s the most efficient sequential structure because
7
 * a value’s index is a direct mapping to its index in the buffer, and the
8
 * growth factor isn't bound to a specific multiple or exponent.
9
 *
10
 * @package Ds
11
 */
12
final class Vector implements \IteratorAggregate, \ArrayAccess, Sequence
13
{
14
    use Traits\GenericCollection;
15
    use Traits\GenericSequence;
16
    use Traits\Capacity;
17
18
    const MIN_CAPACITY = 8;
19
20
    protected function getGrowthFactor(): float
21
    {
22
        return 1.5;
23 86
    }
24
25 86
    /**
26
     * @return whether capacity should be increased.
0 ignored issues
show
Documentation introduced by
Should the return type not be boolean?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
27 86
     */
28 56
    protected function shouldIncreaseCapacity(): bool
29
    {
30 86
        return count($this) > $this->capacity;
31
    }
32
}
33