Completed
Push — master ( 81699d...a5d7cd )
by Julito
31:09
created

CasSettingsSchema   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildSettings() 21 21 1
A buildForm() 13 13 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
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Settings;
5
6
use Chamilo\CoreBundle\Entity\Course;
7
use Chamilo\CoreBundle\Entity\Manager\CourseManager;
8
use Chamilo\CoreBundle\Entity\Repository\CourseRepository;
9
use Chamilo\CourseBundle\Tool\BaseTool;
10
use Chamilo\CourseBundle\ToolChain;
11
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
12
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
13
use Sylius\Bundle\SettingsBundle\Transformer\ObjectToIdentifierTransformer;
14
use Symfony\Component\Form\FormBuilderInterface;
15
use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
16
17
/**
18
 * Class CasSettingsSchema
19
 * @package Chamilo\CoreBundle\Settings
20
 */
21 View Code Duplication
class CasSettingsSchema implements SchemaInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function buildSettings(SettingsBuilderInterface $builder)
27
    {
28
        $builder
29
            ->setDefaults(
30
                array(
31
                    'cas_activate' => '',
32
                    'cas_server' => '',
33
                    'cas_server_uri' => '',
34
                    'cas_port' => '',
35
                    'cas_protocol' => '',
36
                    'cas_add_user_activate' => '',
37
                    'update_user_info_cas_with_ldap' => '',
38
                )
39
            )
40
            ->setAllowedTypes(
41
                array(
42
                )
43
            )
44
        ;
45
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function buildForm(FormBuilderInterface $builder)
52
    {
53
        $builder
54
            ->add('cas_activate', 'yes_no')
55
            ->add('cas_server')
56
            ->add('cas_server_uri')
57
            ->add('cas_port')
58
            ->add('cas_protocol')
59
            ->add('cas_server')
60
            ->add('cas_add_user_activate')
61
            ->add('update_user_info_cas_with_ldap', 'yes_no')
62
        ;
63
    }
64
}
65