Completed
Push — master ( c238bb...d3c2be )
by Julito
53:04 queued 30:32
created

TicketSettingsSchema   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A buildSettings() 0 17 1
A buildForm() 0 8 1
1
<?php
2
/* For licensing terms, see /license.txt */
3
4
namespace Chamilo\CoreBundle\Settings;
5
6
use Chamilo\CoreBundle\Form\Type\YesNoType;
7
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;
8
use Sylius\Bundle\SettingsBundle\Schema\SettingsBuilderInterface;
9
use Symfony\Component\Form\FormBuilderInterface;
10
11
/**
12
 * Class GradebookSettingsSchema
13
 * @package Chamilo\CoreBundle\Settings
14
 */
15
class TicketSettingsSchema extends AbstractSettingsSchema
16
{
17
    /**
18
     * {@inheritdoc}
19
     */
20
    public function buildSettings(SettingsBuilderInterface $builder)
21
    {
22
        $builder
23
            ->setDefaults(
24
                [
25
                    'show_terms_if_profile_completed' => 'false',
26
                    'ticket_allow_category_edition' => 'false',
27
                    'ticket_allow_student_add' => 'false',
28
                    'ticket_send_warning_to_all_admins' => 'false',
29
                    'ticket_warn_admin_no_user_in_category' => 'false',
30
                ]
31
            );
32
33
        $allowedTypes = [
34
            'show_terms_if_profile_completed' => ['string']
35
        ];
36
        $this->setMultipleAllowedTypes($allowedTypes, $builder);
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function buildForm(FormBuilderInterface $builder)
43
    {
44
        $builder
45
            ->add('show_terms_if_profile_completed', YesNoType::class)
46
            ->add('ticket_allow_category_edition', YesNoType::class)
47
            ->add('ticket_allow_student_add')
48
            ->add('ticket_send_warning_to_all_admins', YesNoType::class)
49
            ->add('ticket_warn_admin_no_user_in_category', YesNoType::class)
50
        ;
51
    }
52
}
53