Passed
Pull Request — master (#11)
by Simon
01:34
created

StripeSlackShortcodeParser::handle_shortcode()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 5
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Firesphere\StripeSlack\Parsers;
4
5
use Firesphere\StripeSlack\Form\SlackSignupForm;
6
use SilverStripe\Control\Controller;
7
use SilverStripe\View\Parsers\ShortcodeHandler;
8
use SilverStripe\View\Parsers\ShortcodeParser;
9
10
class StripeSlackShortcodeParser implements ShortcodeHandler
11
{
12
13
    /**
14
     * Gets the list of shortcodes provided by this handler
15
     *
16
     * @return mixed
17
     */
18
    public static function get_shortcodes()
19
    {
20
        return ['stripeslack'];
21
    }
22
23
    /**
24
     * Generate content with a shortcode value
25
     *
26
     * @param array $arguments Arguments passed to the parser
27
     * @param string $content Raw shortcode
28
     * @param ShortcodeParser $parser Parser
29
     * @param string $shortcode Name of shortcode used to register this handler
30
     * @param array $extra Extra arguments
31
     * @return string Result of the handled shortcode
32
     */
33
    public static function handle_shortcode($arguments, $content, $parser, $shortcode, $extra = array())
34
    {
35
        return SlackSignupForm::create(Controller::curr(), 'SlackForm')->forTemplate();
0 ignored issues
show
Bug introduced by
SilverStripe\Control\Controller::curr() of type SilverStripe\Control\Controller is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
        return SlackSignupForm::create(/** @scrutinizer ignore-type */ Controller::curr(), 'SlackForm')->forTemplate();
Loading history...
Bug introduced by
'SlackForm' of type string is incompatible with the type array expected by parameter $args of SilverStripe\View\ViewableData::create(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

35
        return SlackSignupForm::create(Controller::curr(), /** @scrutinizer ignore-type */ 'SlackForm')->forTemplate();
Loading history...
36
    }
37
}
38