Dot   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 27
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 15 2
A resolve() 0 8 2
1
<?php
2
3
namespace Enzyme\Freckle;
4
5
use InvalidArgumentException;
6
7
class Dot
8
{
9
    public function get($collection, $path)
10
    {
11
        $dotter = $this->resolve($collection);
12
13
        if (null === $dotter) {
14
            $type = gettype($collection);
15
16
            throw new InvalidArgumentException(
17
                "Freckle doesn't know how to process the " .
18
                "collection of type [{$type}]"
19
            );
20
        }
21
22
        return $dotter->get($collection, $path);
23
    }
24
25
    protected function resolve($collection)
26
    {
27
        if (true === is_array($collection)) {
28
            return new ArrayDotCollection;
29
        }
30
31
        return null;
32
    }
33
}
34