Passed
Pull Request — master (#11)
by Matthew
05:18 queued 25s
created

AssetFormFactoryExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 10
rs 10
c 0
b 0
f 0
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateFormFields() 0 5 4
1
<?php
2
3
namespace Dyanmic\Salsify\ORM;
4
5
use SilverStripe\Core\Extension;
6
use SilverStripe\Forms\FieldList;
7
use SilverStripe\Forms\ReadonlyField;
8
9
/**
10
 * Class AssetFormFactoryExtension
11
 * @package Dyanmic\Salsify\ORM
12
 *
13
 * @property-read \SilverStripe\AssetAdmin\Forms\FileFormFactory $owner
14
 */
15
class AssetFormFactoryExtension extends Extension
16
{
17
    /**
18
     * @param \SilverStripe\Forms\FieldList $fields
19
     */
20
    public function updateFormFields(FieldList $fields, $controller, $formName, $context)
0 ignored issues
show
Unused Code introduced by
The parameter $controller is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

20
    public function updateFormFields(FieldList $fields, /** @scrutinizer ignore-unused */ $controller, $formName, $context)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $formName is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

20
    public function updateFormFields(FieldList $fields, $controller, /** @scrutinizer ignore-unused */ $formName, $context)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
21
    {
22
        $record = isset($context['Record']) ? $context['Record'] : null;
23
        if ($record && $record->SalisfyID) {
24
            $fields->insertAfter('LastEdited', ReadonlyField::create('SalisfyID', 'Salsify ID'));
25
        }
26
    }
27
}