Completed
Push — master ( 24e779...ef9a53 )
by Peter
12:37 queued 07:06
created

ParserMeta   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 2
dl 0
loc 29
ccs 0
cts 12
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A getMeta() 0 8 3
1
<?php
2
/**
3
 * @author Peter Gribanov <[email protected]>
4
 */
5
6
namespace GpsLab\Component\ImageMeta;
7
8
use Symfony\Component\Filesystem\Filesystem;
9
10
class ParserMeta
11
{
12
    /**
13
     * @var Filesystem
14
     */
15
    protected $fs;
16
17
    /**
18
     * @param Filesystem $fs
19
     */
20
    public function __construct(Filesystem $fs)
21
    {
22
        $this->fs = $fs;
23
    }
24
25
    /**
26
     * @param string $path
27
     *
28
     * @return DataMeta|null
29
     */
30
    public function getMeta($path)
31
    {
32
        if ($this->fs->exists($path) && ($info = @getimagesize($path))) {
33
            return new DataMeta($info[0], $info[1], $info['mime']);
34
        } else {
35
            return null;
36
        }
37
    }
38
}
39