Completed
Branch master (5acf81)
by Steevan
04:21
created

CompoundTrait   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 32
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 32
loc 32
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setCompound() 4 4 1
A getCompound() 4 4 1
A removeCompound() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
3
namespace steevanb\SymfonyFormOptionsBuilder\Behavior;
4
5 View Code Duplication
trait CompoundTrait
6
{
7
    use OptionAccessorsTrait;
8
9
    /**
10
     * @param bool $compound
11
     * @return bool
12
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#compound
13
     */
14
    public function setCompound($compound = true)
15
    {
16
        return $this->setOption('compound', $compound);
17
    }
18
19
    /**
20
     * @return bool|string
21
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#compound
22
     */
23
    public function getCompound()
24
    {
25
        return $this->getOption('compound');
26
    }
27
28
    /**
29
     * @return bool
30
     * @link http://symfony.com/doc/current/reference/forms/types/form.html#compound
31
     */
32
    public function removeCompound()
33
    {
34
        return $this->removeOption('compound');
35
    }
36
}
37