Vendor::getDescription()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
cc 2
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 0
cts 3
cp 0
crap 6
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Automation tool mixed with code generator for easier continuous development
4
 *
5
 * @link      https://github.com/hiqdev/hidev
6
 * @package   hidev
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hidev\components;
12
13
use hidev\helpers\Helper;
14
15
/**
16
 * Vendor part of the config.
17
 */
18
class Vendor extends \hidev\base\Component
19
{
20
    use \hiqdev\yii2\collection\ObjectTrait;
21
22
    public function getLabel()
23
    {
24
        return $this->getItem('label') ?: ucfirst($this->name);
25
    }
26
27
    public function getTitle()
28
    {
29
        return $this->getItem('title') ?: $this->getItem('description') ?: Helper::titleize($this->name);
30
    }
31
32
    public function getTitleAndHomepage()
33
    {
34
        return $this->title . ($this->homepage ? ' (' . $this->homepage . ')' : '');
0 ignored issues
show
Bug Best Practice introduced by
The property homepage does not exist on hidev\components\Vendor. Since you implemented __get, consider adding a @property annotation.
Loading history...
Bug Best Practice introduced by
The property title does not exist on hidev\components\Vendor. Since you implemented __get, consider adding a @property annotation.
Loading history...
35
    }
36
37
    public function getDescription()
38
    {
39
        return $this->getItem('description') ?: $this->getTitle();
40
    }
41
}
42