FormulaTrait   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 51
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setFormula() 0 4 1
A setIsFormula() 0 4 1
A getFormula() 0 3 1
A isFormula() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace MisterIcy\ExcelWriter\Properties\Traits;
5
6
/**
7
 * Trait FormulaTrait
8
 * @package MisterIcy\ExcelWriter\Properties
9
 *
10
 * @author Alexandros Koutroulis <[email protected]>
11
 * @license MIT
12
 */
13
trait FormulaTrait
14
{
15
    /**
16
     * @var bool
17
     */
18
    protected $isFormula = false;
19
20
    /**
21
     * Formula string.
22
     *
23
     * In order to be rendered, the formula must comply to PHPSpreadsheet's rules for formulas
24
     *
25
     * @example =CONCATENATE(A1,A2)
26
     * @var string
27
     */
28
    protected $formula = '';
29
30
    /**
31
     * @return bool
32
     */
33
    public function isFormula(): bool
34
    {
35
        return $this->isFormula;
36
    }
37
38
    /**
39
     * @param bool $isFormula
40
     * @return self
41
     */
42
    public function setIsFormula(bool $isFormula) : self
43
    {
44
        $this->isFormula = $isFormula;
45
        return $this;
46
    }
47
48
    /**
49
     * @return string
50
     */
51
    public function getFormula(): string
52
    {
53
        return $this->formula;
54
    }
55
56
    /**
57
     * @param string $formula
58
     * @return self
59
     */
60
    public function setFormula(string $formula) : self
61
    {
62
        $this->formula = $formula;
63
        return $this;
64
    }
65
}
66