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

transformProfile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 6
ccs 0
cts 5
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
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