Completed
Push — master ( a02c71...2e63f9 )
by Peter
10:01
created

ImageMetaAnalyzer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A analyze() 0 8 3
1
<?php
2
/**
3
 * GpsLab component.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/MIT
8
 */
9
10
namespace GpsLab\Component\ImageMeta;
11
12
class ImageMetaAnalyzer
13
{
14
    /**
15
     * @param string $filename
16
     *
17
     * @return ImageMetadata|null
18
     */
19
    public function analyze($filename)
20
    {
21
        if (file_exists($filename) && ($info = @getimagesize($filename))) {
22
            return new ImageMetadata($info[0], $info[1], $info['mime']);
23
        } else {
24
            return null;
25
        }
26
    }
27
}
28