Completed
Branch master (3b8125)
by
unknown
08:11
created

TestMethodManager   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getMethod() 0 4 1
A setMethod() 0 4 1
A getPreparedName() 0 4 1
A getTemplateTags() 0 8 1
1
<?php
2
3
namespace HelloWordPl\SimpleEntityGeneratorBundle\Lib\Items;
4
5
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\MethodInterface;
6
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Interfaces\RenderableInterface;
7
use HelloWordPl\SimpleEntityGeneratorBundle\Lib\Traits\TemplateTrait;
8
use Symfony\Component\Validator\Constraints as Assert;
9
10
/**
11
 * TestMethodManager
12
 *
13
 * @author Sławomir Kania <[email protected]>
14
 */
15
class TestMethodManager implements RenderableInterface, MethodInterface
16
{
17
18
    use TemplateTrait;
19
20
    /**
21
     * @Assert\NotNull(message="Method for test can not be empty!")
22
     * @Assert\Valid()
23
     * @var MethodManager
24
     */
25
    private $method = null;
26
27
    /**
28
     * Retrun Method Manager
29
     *
30
     * @return MethodManager
31
     */
32
    public function getMethod()
33
    {
34
        return $this->method;
35
    }
36
37
    /**
38
     * Set Method Manager
39
     *
40
     * @param MethodManager $method
41
     */
42
    public function setMethod(MethodManager $method)
43
    {
44
        $this->method = $method;
45
    }
46
47
    /**
48
     * Return prepared test method name
49
     */
50
    public function getPreparedName()
51
    {
52
        return sprintf("test%s", ucfirst($this->getMethod()->getPreparedName()));
53
    }
54
55
    /**
56
     * Return set of tags used in template
57
     *
58
     * @return array
59
     */
60
    public function getTemplateTags()
61
    {
62
        return [
63
            self::TAG_CLASS,
64
            self::TAG_METHOD_NAME,
65
            self::TAG_TEST_METHOD_NAME,
66
        ];
67
    }
68
}
69