Completed
Push — master ( 2757c2...70622d )
by Seth
06:41
created

SearchSource::getUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace smtech\StMarksSearch;
4
5
/**
6
 * An object representing a simplified description of a search result's source
7
 * search domain
8
 *
9
 * @author Seth Battis <[email protected]>
10
 */
11
class SearchSource extends ParameterArrayConstructor
12
{
13
    /**
14
     * Human-readable name
15
     * @var string
16
     */
17
    protected $name;
18
19
    /**
20
     * URL to source home page
21
     * @var string
22
     */
23
    protected $url;
24
25
    protected $icon;
26
27
    /**
28
     * Construct a SearchSource from a search domain
29
     *
30
     * @param AbstractSearchDomain $domain
31
     */
32
    public function __construct(AbstractSearchDomain $domain)
33
    {
34
        parent::__construct([
35
            'name' => $domain->getName(),
1 ignored issue
show
Documentation Bug introduced by
The method getName does not exist on object<smtech\StMarksSearch\AbstractSearchDomain>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
36
            'url' => $domain->getUrl(),
1 ignored issue
show
Documentation Bug introduced by
The method getUrl does not exist on object<smtech\StMarksSearch\AbstractSearchDomain>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
37
            'icon' => $domain->getIcon()
1 ignored issue
show
Documentation Bug introduced by
The method getIcon does not exist on object<smtech\StMarksSearch\AbstractSearchDomain>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
38
        ]);
39
    }
40
}
41