Generator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
c 0
b 0
f 0
lcom 1
cbo 2
dl 0
loc 30
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A generate() 0 6 1
1
<?php
2
3
namespace Sugarcrm\UpgradeSpec\Element;
4
5
use Sugarcrm\UpgradeSpec\Formatter\FormatterInterface;
6
use Sugarcrm\UpgradeSpec\Context\Upgrade;
7
8
class Generator
9
{
10
    /**
11
     * @var FormatterInterface
12
     */
13
    private $formatter;
14
15
    /**
16
     * Generator constructor.
17
     *
18
     * @param FormatterInterface $formatter
19
     */
20
    public function __construct(FormatterInterface $formatter)
21
    {
22
        $this->formatter = $formatter;
23
    }
24
25
    /**
26
     * @param ElementInterface $element
27
     * @param Upgrade          $context
28
     *
29
     * @return string
30
     */
31
    public function generate(ElementInterface $element, Upgrade $context)
32
    {
33
        return $this->formatter->asTitle($element->getTitle(), 2)
34
            . $this->formatter->getDelimiter()
35
            . $this->formatter->asBody($element->getBody($context));
36
    }
37
}
38