Completed
Push — 4.9 ( eb33e7...2df7ad )
by Mikhail
01:41
created

AbstractGenerator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 40
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getVariants() 0 7 2
1
<?php
2
3
namespace generators;
4
5
use mediators\AbstractMediator;
6
7
abstract class AbstractGenerator {
8
    protected $variants;
9
10
    /**
11
     * Set generator content from string
12
     * @param string $content
13
     */
14
    abstract public function setContent(string $content);
15
16
    /**
17
     * Get generator result as string
18
     *
19
     * @return string
20
     */
21
    abstract public function toString(): string;
22
23
    abstract public function setMediator(AbstractMediator $mediator): void;
24
25
    /**
26
     * Get full filename
27
     */
28
    abstract public function getPath(): string;
29
30
    /**
31
     * Get template path
32
     */
33
    abstract public function getTemplateFilename(): string;
34
35
    /**
36
     * Get variants for setting/option
37
     * 
38
     * @return array
39
     */
40
    public function getVariants(string $option)
41
    {
42
        if (!empty($this->variants[$option])) {
43
            return $this->variants[$option];
44
        }
45
46
        return [];
47
    }
48
}
49