Collection   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getQuotes() 0 11 2
A add() 0 9 2
1
<?php
2
3
namespace Monolol\Lolifiers\QuoteProviders;
4
5
use Monolol\Lolifiers\QuoteProvider;
6
7
class Collection implements QuoteProvider
8
{
9
    private
10
        $providers;
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $providers.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
11
12 10
    public function __construct()
13
    {
14 10
        $this->providers = array();
15 10
    }
16
17 10
    public function getQuotes()
18
    {
19 10
        $quotes = array();
20
21 10
        foreach($this->providers as $provider)
22
        {
23 10
            $quotes = array_merge($quotes, $provider->getQuotes());
24 10
        }
25
26 10
        return $quotes;
27
    }
28
29 10
    public function add(QuoteProvider $provider)
30
    {
31 10
        if(! in_array($provider, $this->providers))
32 10
        {
33 10
            $this->providers[] = $provider;
34 10
        }
35
36 10
        return $this;
37
    }
38
}
39