Completed
Push — master ( 644ae6...bba86b )
by Daniel
10:38
created

TestFormHandler   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 30
rs 10
c 0
b 0
f 0
wmc 3
lcom 1
cbo 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A handleField() 0 4 1
A handleSubmission() 0 4 1
A handleGet() 0 4 1
1
<?php
2
3
4
namespace SilverStripe\Control\Tests\RequestHandlingTest;
5
6
use SilverStripe\Forms\FormRequestHandler;
7
8
/**
9
 * Handler for
10
 * @see TestForm
11
 */
12
class TestFormHandler extends FormRequestHandler
13
{
14
    private static $url_handlers = array(
15
        'fields/$FieldName' => 'handleField',
16
        "POST " => "handleSubmission",
17
        "GET " => "handleGet",
18
    );
19
20
    // These are a different case from those in url_handlers to confirm that it's all case-insensitive
21
    private static $allowed_actions = array(
22
        'handlesubmission',
23
        'handlefield',
24
        'handleget',
25
    );
26
27
    public function handleField($request)
28
    {
29
        return $this->form->Fields()->dataFieldByName($request->param('FieldName'));
30
    }
31
32
    public function handleSubmission($request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

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

Loading history...
33
    {
34
        return "Form posted";
35
    }
36
37
    public function handleGet($request)
0 ignored issues
show
Unused Code introduced by
The parameter $request is not used and could be removed.

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

Loading history...
38
    {
39
        return "Get request on form";
40
    }
41
}
42