FileExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
dl 0
loc 22
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A isIstension() 0 11 3
1
<?php
2
/**
3
 * KNUT7 K7F (https://marciozebedeu.com/)
4
 * KNUT7 K7F (tm) : Rapid Development Framework (https://marciozebedeu.com/)
5
 *
6
 * Licensed under The MIT License
7
 * For full copyright and license information, please see the LICENSE.txt
8
 * Redistributions of files must retain the above copyright notice.
9
 *
10
 * @link      https://github.com/knut7/framework/ for the canonical source repository
11
 * @copyright (c) 2015.  KNUT7  Software Technologies AO Inc. (https://marciozebedeu.com/)
12
 * @license   https://marciozebedeu.com/license/new-bsd New BSD License
13
 * @author    Marcio Zebedeu - [email protected]
14
 * @version   1.0.2
15
 */
16
17
/**
18
 * Created by PhpStorm.
19
 * User: artphotografie
20
 * Date: 11/08/17
21
 * Time: 14:11
22
 */
23
24
namespace Ballybran\Helpers\Http;
25
26
27
class FileExtension
28
{
29
    private $extension = array('php', 'phtml', 'html', 'inc', 'js', 'css');
30
    private $ex;
0 ignored issues
show
introduced by
The private property $ex is not used, and could be removed.
Loading history...
31
32
    public function __construct($obj)
33
    {
34
35
        $this->obj = $obj;
0 ignored issues
show
Bug Best Practice introduced by
The property obj does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
36
    }
37
38
    public function isIstension()
39
    {
40
41
        $extension = $this->obj->getExtension();
42
43
        foreach ($this->extension as $key => $value) {
44
45
            if ($value == $extension) {
46
                return true;
47
            }
48
            return false;
49
        }
50
51
52
    }
53
54
55
}
56
57