Passed
Push — master ( 0c5e09...b94ee9 )
by Arthur
08:40 queued 02:13
created

Auth0IdentityProviderTransformer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 20
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A transformBase() 0 7 1
A transformProfile() 0 5 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 13.10.18
6
 * Time: 19:07
7
 */
8
9
namespace Modules\Auth0\Abstracts;
10
11
12
abstract class Auth0IdentityProviderTransformer
13
{
14 9
    protected function transformBase($profile)
15
    {
16
        return [
17 9
            "name" => $profile->name,
18 9
            "avatar" => $profile->picture ?? null,
19 9
            "email" => $profile->email,
20 9
            "email_verified" => $profile->email_verified ?? false,
21
        ];
22
    }
23
24 9
    public function transformProfile(\stdClass $profile)
25
    {
26 9
        $base = $this->transformBase($profile);
27 9
        $child = $this->transform($profile);
28 9
        return array_merge($base, $child);
29
    }
30
31
    protected abstract function transform($profile): array;
32
33
34
}
35