Passed
Push — master ( e5b31a...cf340d )
by Arthur
04:48
created

Auth0IdentityProviderTransformer::transformBase()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
ccs 0
cts 7
cp 0
crap 2
rs 10
c 0
b 0
f 0
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
    protected function transformBase($profile)
15
    {
16
        return [
17
            "name" => $profile->name,
18
            "avatar" => $profile->picture ?? null,
19
            "email" => $profile->email,
20
            "email_verified" => $profile->email_verified ?? false,
21
        ];
22
    }
23
24
    public function transformProfile(\stdClass $profile)
25
    {
26
        $base = $this->transformBase($profile);
27
        $child = $this->transform($profile);
28
        return array_merge($base, $child);
29
    }
30
31
    protected abstract function transform($profile): array;
32
33
34
}
35