Completed
Push — develop ( 41c7f2...c75883 )
by
unknown
16:43 queued 08:14
created

AdminJobEdit   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 45
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
B init() 0 26 1
A addHydratorStrategies() 0 13 1
1
<?php
2
/**
3
 * YAWIK
4
 *
5
 * @filesource
6
 * @license MIT
7
 * @copyright  2013 - 2016 Cross Solution <http://cross-solution.de>
8
 */
9
  
10
/** */
11
namespace Jobs\Form;
12
13
use Core\Form\Form;
14
use Zend\Hydrator\Strategy\ClosureStrategy;
15
16
/**
17
 * ${CARET}
18
 * 
19
 * @author Mathias Gelhausen <[email protected]>
20
 * @todo write test 
21
 */
22
class AdminJobEdit extends Form
23
{
24
    public function init()
25
    {
26
        $this->setName('admin-job-edit');
27
        $this->setDescription(sprintf(
28
            /*@translate*/ 'Change status or publish date.%1$s%2$sBeware!%3$s Status changes will eventually cause notification emails to be send.',
29
            '<br><br>', '<strong>', '</strong>'
30
        ));
31
32
        $this->add([
33
                       'type' => 'Jobs/StatusSelect',
34
35
                   ]);
36
37
        $this->add([
38
                       'type' => 'Core/Datepicker',
39
                       'name' => 'datePublishStart',
40
                       'options' => [
41
                           'label' => /*@translate*/ 'Start date',
42
                           'description' => /*@translate*/ 'Set the start date of this job.',
43
                       ],
44
                       'attributes' => [
45
                           'data-date-autoclose' => 'true',
46
                       ],
47
                   ]);
48
        $this->setIsDescriptionsEnabled(true);
49
    }
50
51
    protected function addHydratorStrategies($hydrator)
52
    {
53
        parent::addHydratorStrategies($hydrator);
54
55
        $statusStrategy = new ClosureStrategy(
56
            /* extract */
57
            function($object) {
58
                return $object->getName();
59
            }
60
        );
61
62
        $hydrator->addStrategy('status', $statusStrategy);
63
    }
64
65
66
}