HasFilesReader   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A getFileContent() 0 9 2
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