Team::run()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 19
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 0
Metric Value
eloc 14
dl 0
loc 19
c 0
b 0
f 0
ccs 0
cts 18
cp 0
rs 9.7998
cc 3
nc 2
nop 0
crap 12
1
<?php
2
/**
3
 * Agency Theme for hiqdev/yii2-thememanager
4
 *
5
 * @link      https://github.com/hiqdev/yii2-theme-agency
6
 * @package   yii2-theme-agency
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2016-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\themes\agency\widgets;
12
13
use yii\base\Widget;
14
use yii\helpers\Html;
15
16
class Team extends Widget
17
{
18
    public $person;
19
20
    public $position;
21
22
    public $gravatar;
23
24
    public $social = [];
25
26
    public function run()
27
    {
28
        $out = '';
29
        $out .= Html::beginTag('div', ['class' => 'team-member']);
30
        $out .= Html::img($this->getImageSrc(), ['class' => 'img-responsive img-circle', 'style' => 'height: 200px; width: 200px']);
31
        $out .= Html::tag('h4', Html::encode($this->person));
32
        $out .= Html::tag('p', Html::encode($this->position));
33
        if (!empty($this->social)) {
34
            $out .= Html::beginTag('ul', ['class' => 'list-inline social-buttons']);
35
            foreach ($this->social as $icon => $url) {
36
                $out .= Html::beginTag('li');
37
                $out .= Html::a(Html::tag('i', null, ['class' => 'fa fa-fw ' . $icon]), $url, ['target' => '_blank']);
38
                $out .= Html::endTag('li');
39
            }
40
            $out .= Html::endTag('ul');
41
        }
42
        $out .= Html::endTag('div');
43
44
        return $out;
45
    }
46
47
    protected function getImageSrc()
48
    {
49
        $out = $this->gravatar;
50
        if (filter_var($out, FILTER_VALIDATE_EMAIL)) {
51
            // todo: implement Gravatar widget
52
        }
53
54
        return $out;
55
    }
56
}
57