Passed
Push — master ( 95ec9a...864242 )
by Divine Niiquaye
02:52
created

Source::getContent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of Biurad opensource projects.
7
 *
8
 * PHP version 7.2 and above required
9
 *
10
 * @author    Divine Niiquaye Ibok <[email protected]>
11
 * @copyright 2019 Biurad Group (https://biurad.com/)
12
 * @license   https://opensource.org/licenses/BSD-3-Clause License
13
 *
14
 * For the full copyright and license information, please view the LICENSE
15
 * file that was distributed with this source code.
16
 */
17
18
namespace Biurad\UI;
19
20
/**
21
 * Carries information about a rendered view.
22
 *
23
 * @author Divine Niiquaye Ibok <[email protected]>
24
 */
25
final class Source implements \Stringable
26
{
27
    /** @var string */
28
    private $template;
29
30
    /**
31
     * @param string $template The template name
32
     */
33
    public function __construct(string $template)
34
    {
35
        $this->template = $template;
36
    }
37
38
    /**
39
     * Returns the content of the template or it's file.
40
     *
41
     * @return string The template file or content
42
     */
43
    public function __toString()
44
    {
45
        return $this->template;
46
    }
47
48
    /**
49
     * Returns if the current content is a file
50
     */
51
    public function isFile(): bool
52
    {
53
        return \file_exists($this->template);
54
    }
55
}
56