EventRowInitializeNew   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
eloc 7
c 2
b 0
f 0
dl 0
loc 14
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A addData() 0 12 3
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;
0 ignored issues
show
Bug introduced by
The type TYPO3\CMS\Backend\Form\FormDataProviderInterface was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
16
class EventRowInitializeNew implements FormDataProviderInterface
17
{
18
    public function addData(array $result): array
19
    {
20
        if ($result['tableName'] !== 'tx_sfeventmgt_domain_model_event') {
21
            return $result;
22
        }
23
24
        if ($result['command'] === 'new') {
25
            $result['databaseRow']['startdate'] = $GLOBALS['EXEC_TIME'];
26
            $result['databaseRow']['enddate'] = $GLOBALS['EXEC_TIME'] + 3600;
27
        }
28
29
        return $result;
30
    }
31
}
32