Completed
Push — master ( 44391c...66817c )
by Peter
09:30
created

ParserMeta::getMeta()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 9.4285
cc 3
eloc 5
nc 2
nop 1
crap 12
1
<?php
2
/**
3
 * @author Peter Gribanov <[email protected]>
4
 */
5
6
namespace GpsLab\Component\ImageMeta;
7
8
class ParserMeta
9
{
10
    /**
11
     * @param string $path
12
     *
13
     * @return DataMeta|null
14
     */
15
    public function getMeta($path)
16
    {
17
        if (file_exists($path) && ($info = @getimagesize($path))) {
18
            return new DataMeta($info[0], $info[1], $info['mime']);
19
        } else {
20
            return null;
21
        }
22
    }
23
}
24