UrlHelper::siteActionUrl()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
3
/**
4
 * @copyright  Copyright (c) Flipbox Digital Limited
5
 * @license    https://github.com/flipboxfactory/craft-ember/blob/master/LICENSE
6
 * @link       https://github.com/flipboxfactory/craft-ember/
7
 */
8
9
namespace flipbox\craft\ember\helpers;
10
11
use Craft;
12
13
/**
14
 * @author Flipbox Factory <[email protected]>
15
 * @since 2.0.0
16
 */
17
class UrlHelper extends \craft\helpers\UrlHelper
18
{
19
    /**
20
     * @param string $path
21
     * @param null $params
22
     * @param string|null $protocol
23
     * @return string
24
     * @throws \yii\base\Exception
25
     */
26
    public static function siteActionUrl(string $path = '', $params = null, string $protocol = null): string
27
    {
28
        $path = Craft::$app->getConfig()->getGeneral()->actionTrigger . '/' . trim($path, '/');
29
30
        return static::siteUrl($path, $params, $protocol);
31
    }
32
33
    /**
34
     * @param string $path
35
     * @param null $params
36
     * @param string|null $protocol
37
     * @return string
38
     */
39
    public static function cpActionUrl(string $path = '', $params = null, string $protocol = null): string
40
    {
41
        $path = Craft::$app->getConfig()->getGeneral()->actionTrigger . '/' . trim($path, '/');
42
43
        return static::cpUrl($path, $params, $protocol);
44
    }
45
}
46