Completed
Push — master ( 6e2d04...9d9a55 )
by
unknown
53:43 queued 36:07
created

FileUtils   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A isPartialFile() 0 10 3
1
<?php
2
/**
3
 * @author Piotr Mrowczynski <[email protected]>
4
 *
5
 * @copyright Copyright (c) 2018, ownCloud GmbH
6
 * @license AGPL-3.0
7
 *
8
 * This code is free software: you can redistribute it and/or modify
9
 * it under the terms of the GNU Affero General Public License, version 3,
10
 * as published by the Free Software Foundation.
11
 *
12
 * This program is distributed in the hope that it will be useful,
13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
 * GNU Affero General Public License for more details.
16
 *
17
 * You should have received a copy of the GNU Affero General Public License, version 3,
18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
19
 *
20
 */
21
22
namespace OC\Files\Utils;
23
24
/**
25
 * Class FileUtils
26
 *
27
 * @package OC\Files\Utils
28
 */
29
class FileUtils {
30
31
	/**
32
	 * Check if the file is a part file
33
	 * (file with part file extension or file within a part files folder)
34
	 *
35
	 * @param string $path path to a file
36
	 * @return boolean
37
	 */
38
	public static function isPartialFile($path) {
39
		if (\pathinfo($path, PATHINFO_EXTENSION) === 'part') {
40
			return true;
41
		}
42
		if (\strpos($path, '.part/') !== false) {
43
			return true;
44
		}
45
46
		return false;
47
	}
48
}
49