Passed
Push — master ( 9234be...3143c1 )
by Arthur
20:30
created

Auth0IdentityProviderTransformer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 21
ccs 0
cts 15
cp 0
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 6 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
abstract class Auth0IdentityProviderTransformer
12
{
13
    protected function transformBase($profile)
14
    {
15
        return [
16
            'name'           => $profile->name,
17
            'avatar'         => $profile->picture ?? null,
18
            'email'          => $profile->email,
19
            'email_verified' => $profile->email_verified ?? false,
20
        ];
21
    }
22
23
    public function transformProfile(\stdClass $profile)
24
    {
25
        $base = $this->transformBase($profile);
26
        $child = $this->transform($profile);
27
28
        return array_merge($base, $child);
29
    }
30
31
    abstract protected function transform($profile): array;
32
}
33