VKontakte::defaultTitle()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-usuario project.
5
 *
6
 * (c) 2amigOS! <http://2amigos.us/>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11
12
namespace Da\User\AuthClient;
13
14
use Da\User\Contracts\AuthClientInterface;
15
use Yii;
16
use yii\authclient\clients\VKontakte as BaseVKontakte;
17
18
class VKontakte extends BaseVKontakte implements AuthClientInterface
19
{
20
    /**
21
     * {@inheritdoc}
22
     */
23
    public $scope = 'email';
24
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function getEmail()
29
    {
30
        return $this->getAccessToken()->getParam('email');
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function getUsername()
37
    {
38
        return isset($this->getUserAttributes()['screen_name'])
39
            ? $this->getUserAttributes()['screen_name']
40
            : null;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    protected function defaultTitle()
47
    {
48
        return Yii::t('usuario', 'VKontakte');
49
    }
50
}
51