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 ( 584b84...040deb )
by Nicolaas
02:20
created

  A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/**
4
 * Provides the entry point to editing a single record presented by the
5
 * {@link GridField}.
6
 *
7
 * Doesn't show an edit view on its own or modifies the record, but rather
8
 * relies on routing conventions established in {@link getColumnContent()}.
9
 *
10
 * The default routing applies to the {@link GridFieldDetailForm} component,
11
 * which has to be added separately to the {@link GridField} configuration.
12
 */
13
class GridFieldAddNewButtonOriginalPageSecondHandProduct extends GridFieldAddNewButtonOriginalPage
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
14
{
15
    public function getHTMLFragments($gridField)
16
    {
17
        $singleton = singleton($gridField->getModelClass());
18
19
        if (! $singleton->canCreate()) {
20
            return array();
21
        }
22
23
        if (!$this->buttonName) {
24
            // provide a default button name, can be changed by calling {@link setButtonName()} on this component
25
            $objectName = $singleton->i18n_singular_name();
26
            $this->buttonName = _t('GridField.Add_USING_PAGES_SECTION', 'Add {name}', array('name' => $objectName));
0 ignored issues
show
Documentation introduced by
array('name' => $objectName) is of type array<string,?,{"name":"?"}>, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
27
        }
28
29
        $getSegment = '';
30
        if ($page = $this->BestRootParentPage()) {
31
            $getSegment = '?ParentID='.$page->ID;
32
        }
33
34
        $data = new ArrayData(array(
35
            'NewLink' => '/admin/'.Config::inst()->get('CMSPageAddController_SecondHandProducts', 'url_segment').'/'.$getSegment,
36
            'ButtonName' => $this->buttonName,
37
        ));
38
39
        return array(
40
            $this->targetFragment => $data->renderWith('GridFieldAddNewbutton'),
41
        );
42
    }
43
44
    /**
45
     * finds the most likely root parent for the shop.
46
     *
47
     * @return SiteTree | NULL
48
     */
49
    public function BestRootParentPage()
50
    {
51
        $singleton = Injector::inst()->get('SecondHandProductGroup');
52
53
        return $singleton->BestRootParentPage();
54
    }
55
}
56