Generator   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
factory() 0 1 ?
A generate() 0 8 2
1
<?php
2
3
namespace Dwr\AvatarBundle\Model;
4
5
use Exception;
6
7
abstract class Generator 
8
{
9
    /**
10
     * @param Avatar $avatar
11
     */
12
    protected abstract function factory(Avatar $avatar);
0 ignored issues
show
Coding Style introduced by
The abstract declaration must precede the visibility declaration
Loading history...
13
14
    /**
15
     * @param Avatar $avatar
16
     * @return Avatar
17
     */
18
    public function generate(Avatar $avatar) 
19
    {
20
        if ( ! extension_loaded('gd')) {
21
            throw new Exception('Your PHP installation doesn\'t have GD extension loaded.');
22
        }
23
        
24
        return $this->factory($avatar);
25
    }
26
27
}
28