Completed
Pull Request — develop (#28)
by Michael
02:15
created

EncodableCollection   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 18
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __toString() 0 4 1
A jsonSerialize() 0 4 1
1
<?php
2
3
namespace Crummy\Phlack\Message\Collection;
4
5
use Crummy\Phlack\Common\Collection\TypeCollection;
6
use Crummy\Phlack\Common\Encodable;
7
8
abstract class EncodableCollection extends TypeCollection implements Encodable
9
{
10
    /**
11
     * @return string
12
     */
13 1
    public function __toString()
14
    {
15 1
        return json_encode($this);
16
    }
17
18
    /**
19
     * @return array|mixed
20
     */
21 2
    public function jsonSerialize()
22
    {
23 2
        return array_filter($this->toArray());
24
    }
25
}
26