Completed
Push — authenticator-refactor ( 16f104...61b037 )
by Simon
06:52
created

EditFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A EditFormFactory::getFormFields() 9 9 1
A EditFormFactory::getFormActions() 8 8 1
1
<?php
2
3
namespace SilverStripe\Forms\Tests\FormFactoryTest;
4
5
use SilverStripe\Control\RequestHandler;
6
use SilverStripe\Forms\DefaultFormFactory;
7
use SilverStripe\Forms\FieldList;
8
use SilverStripe\Forms\FormAction;
9
use SilverStripe\Forms\HiddenField;
10
use SilverStripe\Forms\TextField;
11
12
/**
13
 * Test factory
14
 */
15
class EditFormFactory extends DefaultFormFactory
16
{
17
    private static $extensions = [
0 ignored issues
show
Comprehensibility introduced by
Consider using a different property name as you override a private property of the parent class.
Loading history...
18
        ControllerExtension::class
19
    ];
20
21 View Code Duplication
    protected function getFormFields(RequestHandler $controller = null, $name, $context = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
22
    {
23
        $fields = new FieldList(
24
            new HiddenField('ID'),
25
            new TextField('Title')
26
        );
27
        $this->invokeWithExtensions('updateFormFields', $fields, $controller, $name, $context);
28
        return $fields;
29
    }
30
31 View Code Duplication
    protected function getFormActions(RequestHandler $controller = null, $name, $context = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
32
    {
33
        $actions = new FieldList(
34
            new FormAction('save', 'Save')
35
        );
36
        $this->invokeWithExtensions('updateFormActions', $actions, $controller, $name, $context);
37
        return $actions;
38
    }
39
}
40