Identicon   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A resolveAttribute() 0 8 1
1
<?php
2
3
namespace Swatty007\NovaEasyAvatars\Fields;
4
5
use Identicon\Identicon as IdenticonBase;
6
7
class Identicon extends AvatarBase
8
{
9
    /**
10
     * Resolve the given attribute from the given resource.
11
     *
12
     * @param  mixed  $resource
13
     * @param  string  $attribute
14
     * @return mixed
15
     */
16
    protected function resolveAttribute($resource, $attribute)
17
    {
18
        $callback = function () use ($resource, $attribute) {
19
            return (new IdenticonBase())->getImageDataUri($resource->{$attribute}, $this->size);
20
        };
21
22
        $this->preview($callback)->thumbnail($callback);
23
    }
24
}
25