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

Link::configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 1.0003

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 15
ccs 13
cts 14
cp 0.9286
rs 9.4285
cc 1
eloc 10
nc 1
nop 1
crap 1.0003
1
<?php
2
3
namespace CrossKnowledge\DataTableBundle\DataTable\Table\Element\Column;
4
5
use Symfony\Component\OptionsResolver\Options;
6
use Symfony\Component\OptionsResolver\OptionsResolver;
7
8
class Link extends Column
9
{
10 3
    public function configureOptions(OptionsResolver $resolver)
11
    {
12 3
        parent::configureOptions($resolver);
13 3
        $resolver->setRequired('LinkTextField');
14 3
        $resolver->setDefault('AltTextField', function (Options $options) {
15 3
            return $options['LinkTextField'];
16 3
        });
17 3
        $resolver->setDefault('UrlField', function (Options $options) {
18 1
            return $options['LinkTextField'];
19 3
        });
20 3
        $resolver->setDefault('UrlCallback', function($value, $row) {
0 ignored issues
show
Coding Style introduced by
Expected 1 space after FUNCTION keyword; 0 found
Loading history...
21
            return $row[$this->options['UrlField']];
22 3
        });
23 3
        $resolver->setAllowedTypes('UrlCallback', ['\Closure']);
24 3
    }
25
    /**
26
     * Build a link
27
     */
28
    public function formatCell($value, array $rowData, $context)
29
    {
30
        $value = parent::formatCell($value, $rowData);
0 ignored issues
show
Bug introduced by
The call to formatCell() misses a required argument $context.

This check looks for function calls that miss required arguments.

Loading history...
31
        $url = call_user_func_array($this->options['UrlCallback'], [$value, $rowData]);
32
        return '<a href="'.$url.'" alt="'.$rowData[$this->options['LinkTextField']].'">'.$rowData[$this->options['LinkTextField']].'</a>';
33
    }
34
}
35