Completed
Push — master ( 934cdf...8f45fc )
by Johnny
01:43
created

FileInfo::getFileHash()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4286
cc 2
eloc 4
nc 2
nop 1
crap 2
1
<?php
2
namespace Redbox\Scan\Filesystem;
3
4
/**
5
 * Provide a hashing facility so we can compare files.
6
 *
7
 * @package Redbox\Scan\Filesystem
8
 */
9
class FileInfo
10
{
11
    /**
12
     * Return a hash of a given file.
13
     *
14
     * @param string $file
15
     * @return string
16
     */
17 24
    public static function getFileHash($file = "")
18
    {
19 24
        if (file_exists($file) === true) {
20 20
            return md5_file($file);
21
        }
22 4
        return '';
23
    }
24
}