GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

SplFileInfo   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
eloc 11
c 1
b 0
f 0
dl 0
loc 64
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getDirectoryInfo() 0 3 1
A getBasename() 0 7 2
A getMime() 0 3 1
A getFilename() 0 3 1
A __construct() 0 6 2
1
<?php
2
/**
3
 * This file is part of the O2System Framework package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 *
8
 * @author         Steeve Andrian Salim
9
 * @copyright      Copyright (c) Steeve Andrian Salim
10
 */
11
12
// ------------------------------------------------------------------------
13
14
namespace O2System\Spl\Info;
15
16
// ------------------------------------------------------------------------
17
18
/**
19
 * Class SplFileInfo
20
 *
21
 * @package O2System\Spl\Info
22
 */
23
class SplFileInfo extends \SplFileInfo
24
{
25
    /**
26
     * SplFileInfo::$mime
27
     *
28
     * File mime type.
29
     *
30
     * @var
31
     */
32
    private $mime;
33
34
    /**
35
     * SplFileInfo::__construct
36
     *
37
     * @param string $filePath File Path.
38
     */
39
    public function __construct($filePath)
40
    {
41
        parent::__construct($filePath);
42
43
        if (file_exists($filePath)) {
44
            $this->mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $filePath);
45
        }
46
    }
47
48
    public function getMime()
49
    {
50
        return $this->mime;
51
    }
52
53
    /**
54
     * SplFileInfo::getFilename
55
     *
56
     * @return string
57
     */
58
    public function getFilename()
59
    {
60
        return str_replace('.' . $this->getExtension(), '', parent::getFilename());
61
    }
62
63
    /**
64
     * SplFileInfo::getBasename
65
     *
66
     * @param string $suffix
67
     *
68
     * @return string
69
     */
70
    public function getBasename($suffix = null)
71
    {
72
        if (is_null($suffix)) {
73
            return parent::getBasename();
74
        }
75
76
        return str_replace('.' . $this->getExtension(), '.' . trim($suffix, '.'), parent::getFilename());
77
    }
78
79
    /**
80
     * SplFileInfo::getDirectoryInfo
81
     *
82
     * @return \O2System\Spl\Info\SplDirectoryInfo
83
     */
84
    public function getDirectoryInfo()
85
    {
86
        return new SplDirectoryInfo(dirname($this->getRealPath()));
87
    }
88
}