HasFilesReader::getFileContent()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 9
rs 9.6666
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * Copyright (c) 2017 Salah Alkhwlani <[email protected]>
5
 *
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Yemenifree\WpSecurity\Traits;
11
12
trait HasFilesReader
13
{
14
    /**
15
     * get content file from Files template.
16
     *
17
     * @param $filename
18
     *
19
     * @return string
20
     */
21
    protected function getFileContent($filename)
22
    {
23
        $filePath = \rtrim(WC_SECURITY_PATH, '/') . '/src/Files/' . $filename;
24
25
        if (!\file_exists($filePath)) {
26
            return '';
27
        }
28
29
        return \file_get_contents($filePath);
30
    }
31
}
32