SchedulesCloneForm   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A buildForm() 0 18 1
A getDay() 0 12 1
A getName() 0 4 1
1
<?php
2
/*************************************************************************************/
3
/*      This file is part of the Thelia package.                                     */
4
/*                                                                                   */
5
/*      Copyright (c) OpenStudio                                                     */
6
/*      email : [email protected]                                                       */
7
/*      web : http://www.thelia.net                                                  */
8
/*                                                                                   */
9
/*      For the full copyright and license information, please view the LICENSE.txt  */
10
/*      file that was distributed with this source code.                             */
11
/*************************************************************************************/
12
/*************************************************************************************/
13
14
namespace Dealer\Form;
15
16
use Dealer\Dealer;
17
use Symfony\Component\Validator\Constraints\NotBlank;
18
use Thelia\Form\BaseForm;
19
20
/**
21
 * Class SchedulesCloneForm
22
 * @package Dealer\Form
23
 */
24
class SchedulesCloneForm extends BaseForm
25
{
26
27
    /**
28
     * @inheritDoc
29
     */
30
    protected function buildForm()
31
    {
32
        $this->formBuilder
33
            ->add('id', 'integer', array(
34
                "label" => $this->translator->trans("Id", [], Dealer::MESSAGE_DOMAIN),
35
                "label_attr" => ["for" => "attr-dealer-schedules-clone-id"],
36
                "required" => true,
37
                "constraints" => array(new NotBlank(), ),
38
                "attr" => array()
39
            ))
40
            ->add("day", "choice", [
41
                "choices" => $this->getDay(),
42
                "label" => $this->translator->trans("Day", [], Dealer::MESSAGE_DOMAIN),
43
                "label_attr" => ["for" => "attr-dealer-schedules-clone-day"],
44
                "required" => true,
45
                "attr" => array()
46
            ]);
47
    }
48
49
    protected function getDay()
50
    {
51
        return [
52
            $this->translator->trans("Monday", [], Dealer::MESSAGE_DOMAIN),
53
            $this->translator->trans("Tuesday", [], Dealer::MESSAGE_DOMAIN),
54
            $this->translator->trans("Wednesday", [], Dealer::MESSAGE_DOMAIN),
55
            $this->translator->trans("Thursday", [], Dealer::MESSAGE_DOMAIN),
56
            $this->translator->trans("Friday", [], Dealer::MESSAGE_DOMAIN),
57
            $this->translator->trans("Saturday", [], Dealer::MESSAGE_DOMAIN),
58
            $this->translator->trans("Sunday", [], Dealer::MESSAGE_DOMAIN)
59
        ];
60
    }
61
62
    public function getName()
63
    {
64
        return "schedules_clone";
65
    }
66
}
67