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 ( 49d6e8...d5b92a )
by Cyril
12s
created

Link::configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 10
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 15
ccs 14
cts 14
cp 1
crap 1
rs 9.4285
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 2
            return $row[$this->options['UrlField']];
22 3
        });
23 3
        $resolver->setAllowedTypes('UrlCallback', ['\Closure']);
24 3
    }
25
    /**
26
     * Build a link
27
     */
28 3
    public function formatCell($value, array $rowData, $context)
29
    {
30 3
        $value = parent::formatCell($value, $rowData, $context);
31 3
        $url = call_user_func_array($this->options['UrlCallback'], [$value, $rowData]);
32 3
        return '<a href="'.$url.'" alt="'.$rowData[$this->options['LinkTextField']].'">'.$rowData[$this->options['LinkTextField']].'</a>';
33
    }
34
}
35