Completed
Pull Request — master (#16)
by Simon
11:11 queued 09:59
created

PartialFileFieldSubmission::canCreate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
3
namespace Firesphere\PartialUserforms\Models;
4
5
use SilverStripe\Security\Member;
6
use SilverStripe\UserForms\Model\Submission\SubmittedFileField;
7
8
/**
9
 * Class \Firesphere\PartialUserforms\Models\PartialFileFieldSubmission
10
 *
11
 * @property int $SubmittedFormID
12
 * @method PartialFormSubmission SubmittedForm()
13
 */
14 View Code Duplication
class PartialFileFieldSubmission extends SubmittedFileField
1 ignored issue
show
Duplication introduced by
This class 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...
15
{
16
    private static $table_name = 'PartialFileFieldSubmission';
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...
17
18
    private static $has_one = [
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...
19
        'SubmittedForm' => PartialFormSubmission::class,
20
    ];
21
22
23
    /**
24
     * @param Member $member
25
     * @param array $context
26
     * @return boolean|string
27
     */
28
    public function canCreate($member = null, $context = [])
29
    {
30
        return $this->SubmittedForm()->canCreate();
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->SubmittedForm()->canCreate(); of type boolean|string adds the type string to the return on line 30 which is incompatible with the return type of the parent method SilverStripe\UserForms\M...tedFormField::canCreate of type boolean.
Loading history...
31
    }
32
33
    /**
34
     * @param Member $member
35
     *
36
     * @return boolean|string
37
     */
38
    public function canView($member = null)
39
    {
40
        return $this->SubmittedForm()->canView();
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->SubmittedForm()->canView(); of type boolean|string adds the type string to the return on line 40 which is incompatible with the return type of the parent method SilverStripe\UserForms\M...ittedFormField::canView of type boolean.
Loading history...
41
    }
42
43
    /**
44
     * @param Member $member
45
     *
46
     * @return boolean|string
47
     */
48
    public function canEdit($member = null)
49
    {
50
        return $this->SubmittedForm()->canEdit();
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->SubmittedForm()->canEdit(); of type boolean|string adds the type string to the return on line 50 which is incompatible with the return type of the parent method SilverStripe\UserForms\M...ittedFormField::canEdit of type boolean.
Loading history...
51
    }
52
53
    /**
54
     * @param Member $member
55
     *
56
     * @return boolean|string
57
     */
58
    public function canDelete($member = null)
59
    {
60
        return $this->SubmittedForm()->canDelete();
0 ignored issues
show
Bug Compatibility introduced by
The expression $this->SubmittedForm()->canDelete(); of type boolean|string adds the type string to the return on line 60 which is incompatible with the return type of the parent method SilverStripe\UserForms\M...tedFormField::canDelete of type boolean.
Loading history...
61
    }
62
}
63