Passed
Push — master ( 42aa49...a46232 )
by Anton
04:55
created

UrlRule   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 17
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A init() 0 12 1
1
<?php
2
/**
3
 * @author Anton Tuyakhov <[email protected]>
4
 */
5
6
namespace tuyakhov\jsonapi;
7
8
9
/**
10
 * UrlRule is provided to simplify the creation of URL rules for JSON API support.
11
 * @package tuyakhov\jsonapi
12
 */
13
class UrlRule extends \yii\rest\UrlRule
14
{
15
    /**
16
     * @inheritdoc
17
     */
18
    public function init()
19
    {
20
        $this->tokens = array_merge($this->tokens, array_merge([
0 ignored issues
show
Coding Style introduced by
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space

This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line.

To visualize

$a = "a";
$ab = "ab";
$abc = "abc";

will produce issues in the first and second line, while this second example

$a   = "a";
$ab  = "ab";
$abc = "abc";

will produce no issues.

Loading history...
21
            '{relationship}' => '<name:\w+>'
22
        ]));
23
        $this->patterns = array_merge($this->patterns, [
24
            'DELETE {id}/relationships/{relationship}' => 'delete-relationship',
25
            'POST,PATCH {id}/relationships/{relationship}' => 'update-relationship',
26
            'GET {id}/{relationship}' => 'view-related',
27
            '{id}/{relationship}' => 'options'
28
        ]);
29
        parent::init();
30
    }
31
32
}