Passed
Push — master ( 8a1e27...a72f33 )
by Artem
02:43
created

Manager::getContents()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 3
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace PrettyBx\Support\Filesystem;
6
7
class Manager
8
{
9
    /**
10
     * file_get_contents wrapper
11
     *
12
     * @access	public
13
     * @param	string	$filename	
14
     * @param	mixed 	$data    	
15
     * @return	mixed
16
     */
17
    public function getContents(string $filename, $data)
18
    {
19
        return file_get_contents($filename, $data);
20
    }
21
22
    /**
23
     * file_put_contents wrapper
24
     *
25
     * @access	public
26
     * @param	string	$filename	
27
     * @param	mixed 	$data    	
28
     * @return	mixed
29
     */
30
    public function putContents(string $filename, $data)
31
    {
32
        return file_put_contents($filename, $data);
33
    }
34
35
    /**
36
     * rename wrapper
37
     *
38
     * @access	public
39
     * @param	string	$oldnam
40
     * @param	string	$newname
41
     * @return	bool
42
     */
43
    public function rename(string $oldname , string $newname): bool
44
    {
45
        return rename($oldname, $newname);
46
    }
47
48
    /**
49
     * Returns true if file exists
50
     *
51
     * @access	public
52
     * @param	string	$filename	
53
     * @return	bool
54
     */
55
    public function exists(string $filename): bool
56
    {
57
        return file_exists($filename);
58
    }
59
60
    /**
61
     * mkdir wrapper
62
     *
63
     * @access	public
64
     * @param	string 	$pathname 	
65
     * @param	integer	$mode     	Default: 0777
66
     * @param	boolean	$recursive	Default: false
67
     * @return	bool
68
     */
69
    public function mkdir(string $pathname, int $mode = 0777, bool $recursive = false): bool
70
    {
71
        return mkdir($pathname, $mode, $recursive);
72
    }
73
74
    /**
75
     * rename wrapper
76
     *
77
     * @access	public
78
     * @param	string  	$oldname	
79
     * @param	string  	$newname	
80
     * @param	resource	$context	
81
     * @return	bool
82
     */
83
    public function rename(string $oldname, string $newname, resource $context = null): bool
0 ignored issues
show
Bug introduced by
The type PrettyBx\Support\Filesystem\resource was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
84
    {
85
        return rename($oldname, $newname, $context);
0 ignored issues
show
Bug introduced by
It seems like $context can also be of type PrettyBx\Support\Filesystem\resource; however, parameter $context of rename() does only seem to accept resource, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

85
        return rename($oldname, $newname, /** @scrutinizer ignore-type */ $context);
Loading history...
86
    }
87
}