Completed
Push — master ( 13910f...5ac23a )
by Denis
03:36
created

Driver::_isDebug()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * JBZoo Less
4
 *
5
 * This file is part of the JBZoo CCK package.
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @package   Less
10
 * @license   MIT
11
 * @copyright Copyright (C) JBZoo.com,  All rights reserved.
12
 * @link      https://github.com/JBZoo/Less
13
 * @author    Denis Smetannikov <[email protected]>
14
 */
15
16
namespace JBZoo\Less\Driver;
17
18
use JBZoo\Data\Data;
19
use JBZoo\Less\Exception;
20
use JBZoo\Utils\FS;
21
22
/**
23
 * Class Driver
24
 * @package JBZoo\Less
25
 */
26
abstract class Driver
27
{
28
    /**
29
     * @var Data
30
     */
31
    protected $_options;
32
33
    /**
34
     * @var mixed
35
     */
36
    protected $_compiler;
37
38
    /**
39
     * @param Data $options
40
     */
41
    public function __construct(Data $options)
42
    {
43
        $this->_options = $options;
44
    }
45
46
    /**
47
     * @param string $fullPath
48
     * @param string $relPath
49
     * @return string
50
     */
51
    public function compile($fullPath, $relPath)
52
    {
53
        $this->_initCompiler();
54
        $fullPath = FS::real($fullPath);
55
        $result = $this->_compile($fullPath, $relPath);
56
57
        return $result;
58
    }
59
60
    /**
61
     * @return bool
62
     */
63
    protected function _isDebug()
64
    {
65
        return $this->_options->get('debug', false, 'bool');
66
    }
67
68
69
    /**
70
     * @param string      $fullPath
71
     * @param string|null $relPath
72
     * @return string
73
     * @throws Exception
74
     */
75
    abstract public function setImportPath($fullPath, $relPath = null);
76
77
    /**
78
     * @param string  $fullPath
79
     * @param  string $relPath
80
     * @return string
81
     */
82
    abstract protected function _compile($fullPath, $relPath);
83
84
    /**
85
     * @return mixed
86
     */
87
    abstract protected function _initCompiler();
88
}
89