Passed
Push — 5.x ( 21ac2b...561f4e )
by Torben
44:32 queued 39s
created

EventRowInitializeNew::addData()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
c 1
b 0
f 0
nc 3
nop 1
dl 0
loc 12
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Extension "sf_event_mgt" for TYPO3 CMS.
7
 *
8
 * For the full copyright and license information, please read the
9
 * LICENSE.txt file that was distributed with this source code.
10
 */
11
12
namespace DERHANSEN\SfEventMgt\Form\FormDataProvider;
13
14
use TYPO3\CMS\Backend\Form\FormDataProviderInterface;
15
16
class EventRowInitializeNew implements FormDataProviderInterface
17
{
18
    /**
19
     * @param array $result
20
     * @return array
21
     */
22
    public function addData(array $result): array
23
    {
24
        if ($result['tableName'] !== 'tx_sfeventmgt_domain_model_event') {
25
            return $result;
26
        }
27
28
        if ($result['command'] === 'new') {
29
            $result['databaseRow']['startdate'] = $GLOBALS['EXEC_TIME'];
30
            $result['databaseRow']['enddate'] = $GLOBALS['EXEC_TIME'] + 3600;
31
        }
32
33
        return $result;
34
    }
35
}
36