Completed
Pull Request — master (#2)
by Matthew
13:57
created

ProductControllerExtension::WishListForm()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Dynamic\Wishlist\Extensions;
4
5
use Dynamic\Wishlist\Form\AddToWishListForm;
6
use SilverStripe\Core\Extension;
7
use SilverStripe\Security\Security;
8
9
/**
10
 * Class ProductExtension
11
 * @package Dynamic\Wishlist\Extensions
12
 *
13
 * @property-read \SilverStripe\Control\Controller $owner
14
 */
15
class ProductControllerExtension extends Extension
16
{
17
    /**
18
     * @var array
19
     */
20
    private static $allowed_actions = [
0 ignored issues
show
introduced by
The private property $allowed_actions is not used, and could be removed.
Loading history...
21
        'WishListForm',
22
    ];
23
24
    /**
25
     * @return \Dynamic\Wishlist\Form\AddToWishListForm|bool
26
     */
27
    public function WishListForm()
28
    {
29
        if (!Security::getCurrentUser()) {
30
            return false;
31
        }
32
33
        return AddToWishListForm::create($this->owner, 'WishListForm');
34
    }
35
}
36