GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( d09edd...49d6e8 )
by Cyril
11:59 queued 09:17
created

DateTimeColumn   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 35.7%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 0
cbo 2
dl 0
loc 27
ccs 5
cts 14
cp 0.357
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A configureOptions() 0 6 1
A formatCell() 0 14 3
1
<?php
2
3
4
namespace CrossKnowledge\DataTableBundle\DataTable\Table\Element\Column;
5
6
use Symfony\Component\OptionsResolver\OptionsResolver;
7
8
class DateTimeColumn extends Column
9
{
10
    /**
11
     * @param OptionsResolver $resolver
12
     */
13 4
    public function configureOptions(OptionsResolver $resolver)
14
    {
15 4
        parent::configureOptions($resolver);
16 4
        $resolver->setDefault('input_format', 'Y-m-d H:i:s');
17 4
        $resolver->setRequired('output_format');
18 4
    }
19
20
    public function formatCell($value, array $row, $context)
21
    {
22
        if (empty($value)) {
23
            return '';
24
        }
25
        $inputFormat = $this->getOptions()['input_format'];
26
        if ($inputFormat == 'object') {
27
            $dateTime = $value;
28
        } else {
29
            $dateTime = \DateTime::createFromFormat($inputFormat, $value);
30
        }
31
32
        return $dateTime->format($this->getOptions()['output_format']);
33
    }
34
}
35