File   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 6
c 3
b 0
f 0
lcom 1
cbo 1
dl 0
loc 78
ccs 17
cts 17
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A getContents() 0 4 1
A append() 0 6 1
A update() 0 6 1
A copyTo() 0 4 1
A getSize() 0 4 1
A getMimeType() 0 8 1
1
<?php
2
/**
3
 * @package    Fuel\FileSystem
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2015 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
namespace Fuel\FileSystem;
12
13
class File extends Handler
14
{
15
	/**
16
	 * Returns the files contents
17
	 *
18
	 * @return string
19
	 */
20 1
	public function getContents()
21
	{
22 1
		return file_get_contents($this->path);
23
	}
24
25
	/**
26
	 * Appends data to a file
27
	 *
28
	 * @param string $data
29
	 *
30
	 * @return boolean
31
	 */
32 1
	public function append($data)
33
	{
34 1
		$bites = file_put_contents($this->path, $data, FILE_APPEND | LOCK_EX);
35
36 1
		return $bites !== false;
37
	}
38
39
	/**
40
	 * Updates a file
41
	 *
42
	 * @param string $data
43
	 *
44
	 * @return boolean
45
	 */
46 1
	public function update($data)
47
	{
48 1
		$bites = file_put_contents($this->path, $data, LOCK_EX);
49
50 1
		return $bites !== false;
51
	}
52
53
	/**
54
	 * Copies a file
55
	 *
56
	 * @param string $destination
57
	 *
58
	 * @return boolean
59
	 */
60 1
	public function copyTo($destination)
61
	{
62 1
		return copy($this->path, $destination);
63
	}
64
65
	/**
66
	 * Returns the file size
67
	 *
68
	 * @param string $destination
0 ignored issues
show
Bug introduced by
There is no parameter named $destination. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
69
	 *
70
	 * @return boolean
71
	 */
72 1
	public function getSize()
73
	{
74 1
		return filesize($this->path);
75
	}
76
77
	/**
78
	 * Returns the mime-type
79
	 *
80
	 * @return string
81
	 */
82 1
	public function getMimeType()
83
	{
84 1
		$finfo = finfo_open(FILEINFO_MIME_TYPE);
85 1
		$mime = finfo_file($finfo, $this->path);
86 1
		finfo_close($finfo);
87
88 1
		return $mime;
89
	}
90
}
91