Completed
Push — master ( 478235...2430ac )
by Seth
02:01
created

AbstractCanvasSearchDomain::setId()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
cc 3
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace smtech\StMarksSearch\Canvas;
4
5
use Exception;
6
use smtech\CanvasPest\CanvasPest;
7
use smtech\StMarksSearch\AbstractSearchDomain;
8
9
/**
10
 * Parent class for all Canvas search domains
11
 *
12
 * @author Seth Battis <[email protected]>
13
 */
14
abstract class AbstractCanvasSearchDomain extends AbstractSearchDomain
15
{
16
    use RequireCanvasPestParameter;
17
18
    /**
19
     * Construct a CanvasSearchDomain from `$params`, requires `id` and `api`
20
     * params, will extract `url` param from `api`, if necessary.
21
     *
22
     * @inheritdoc
23
     *
24
     * @param mixed[string] $params
1 ignored issue
show
Documentation introduced by
The doc-type mixed[string] could not be parsed: Expected "]" at position 2, but found "string". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
25
     */
26
    public function __construct($params)
27
    {
28
        $this->requireParameter($params, 'id');
29
        $this->requireCanvasPestParameter($params);
30
31
        if (empty($params['url'])) {
32
            $params['url'] = preg_replace('%^(.*)/api/v\d+$%', '$1', $this->getApi()->base_url);
33
        }
34
35
        parent::__construct($params);
36
37
        $this->setId($params['id']);
0 ignored issues
show
Bug introduced by
The method setId() does not seem to exist on object<smtech\StMarksSea...ractCanvasSearchDomain>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
38
    }
39
}
40