Completed
Push — master ( 5856c5...90f7ba )
by Rudi
05:12
created

Vector   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 3
dl 0
loc 20
ccs 5
cts 5
cp 1
rs 10
c 5
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A increaseCapacity() 0 8 2
1
<?php
2
namespace Ds;
3
4
/**
5
 * Vector
6
 *
7
 * @package Ds
8
 */
9
final class Vector implements \IteratorAggregate, \ArrayAccess, Sequence
10
{
11
    use Traits\Collection;
12
    use Traits\Sequence;
13
    use Traits\Capacity;
14
15
    const MIN_CAPACITY = 10;
16
17
    /**
18
     * Increase capacity
19
     */
20 86
    protected function increaseCapacity()
21
    {
22 86
        $size = count($this);
23
24 86
        if ($size > $this->capacity) {
25 56
            $this->capacity = max(intval($this->capacity * 1.5), $size);
26
        }
27 86
    }
28
}
29