CropValidator   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A extractWidthHeight() 0 11 4
1
<?php
2
3
/**
4
 * Copyright 2014 Jonathan Bouzekri. All rights reserved.
5
 *
6
 * @copyright Copyright 2014 Jonathan Bouzekri <[email protected]>
7
 * @license https://github.com/jbouzekri/FileUploaderBundle/blob/master/LICENSE
8
 * @link https://github.com/jbouzekri/FileUploaderBundle
9
 */
10
11
namespace Jb\Bundle\FileUploaderBundle\Service\Validator;
12
13
use Jb\Bundle\FileUploaderBundle\Exception\ValidationException;
14
15
/**
16
 * CropValidator
17
 *
18
 * @author jobou
19
 */
20
class CropValidator extends AbstractImageValidator
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    protected function extractWidthHeight($value)
26
    {
27
        if (empty($value) || !isset($value['width']) || !isset($value['height'])) {
28
            throw new ValidationException('Unable to determine size.');
29
        }
30
31
        return array(
32
            'width' => (int) $value['width'],
33
            'height' => (int) $value['height']
34
        );
35
    }
36
}
37