Test Failed
Push — master ( 5fcf14...625fb6 )
by Adrian Florin
02:41
created

Content   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 0
dl 0
loc 45
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 4 1
A getArray() 0 4 1
A getObject() 0 4 1
1
<?php
2
/**
3
 * This file is part of the NeedleProject\FileIo package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
namespace NeedleProject\FileIo\Content;
9
10
/**
11
 * Class Content
12
 *
13
 * @package NeedleProject\FileIo\Content
14
 * @author Adrian Tilita <[email protected]>
15
 * @copyright 2017 Adrian Tilita
16
 * @license https://opensource.org/licenses/MIT MIT Licence
17
 */
18
class Content implements ContentInterface
19
{
20
    /**
21
     * @var null|string
22
     */
23
    private $content = null;
24
25
    /**
26
     * Content constructor.
27
     *
28
     * @param string $content
29
     */
30 8
    public function __construct(string $content)
31
    {
32 8
        $this->content = $content;
33 8
    }
34
35
    /**
36
     * @return string
37
     */
38 9
    public function get(): string
39
    {
40 9
        return $this->content;
41
    }
42
43
    /**
44
     * Return the content as an array
45
     *
46
     * @return array
47
     * @throws \NeedleProject\FileIo\Exception\ContentException
48
     */
49
    public function getArray(): array
50
    {
51
        return [$this->content];
52
    }
53
54
    /**
55
     * @return mixed|\stdClass
56
     * @throws \NeedleProject\FileIo\Exception\ContentException
57
     */
58
    public function getObject()
59
    {
60
        return (object)['content' => $this->content];
61
    }
62
}
63