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

ProductControllerExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 19
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A WishListForm() 0 7 2
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