Initials   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

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