EmailAFriendExtension_Controller::emailafriend()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
1
<?php
2
3
4
5
class EmailAFriendExtension_Controller extends Extension
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...
6
{
7
    private static $allowed_actions = array('EmailAFriendForm', 'emailafriend');
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...
Unused Code introduced by
The property $allowed_actions is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
8
9
    protected $emailAFriendShowForm = false;
10
11
    /**
12
     * @return EmailAFriendForm
13
     */
14
    public function EmailAFriendForm()
15
    {
16
        return new EmailAFriendForm($this->owner, 'EmailAFriendForm');
17
    }
18
19
    public function emailafriend($request)
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
20
    {
21
        $this->showForm = true;
0 ignored issues
show
Bug introduced by
The property showForm does not seem to exist. Did you mean emailAFriendShowForm?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
22
        if ($request->isAjax()) {
23
            return $this->owner->renderWith('EmailAFriendHolder', 'Page_emailafriend');
24
        } else {
25
            return $this->owner->renderWith('EmailAFriendHolder_NOAJAX');
26
        }
27
    }
28
29
    public function EmailAFriendShowForm()
30
    {
31
        return $this->emailAFriendShowForm;
32
    }
33
34
    /**
35
     * @return String
36
     */
37
    public function EmailAFriendLink()
38
    {
39
        if ($this->owner->request->param("Action") != "emailafriend") {
40
            return $this->owner->Link('emailafriend');
41
        }
42
    }
43
    protected $emailAFriendThankYouContent = "";
44
45
    public function setEmailAFriendThankYouContent($v)
46
    {
47
        $this->emailAFriendThankYouContent = $v;
48
    }
49
50
    public function EmailAFriendThankYouContent()
51
    {
52
        return $this->emailAFriendThankYouContent;
53
    }
54
}
55