Passed
Push — master ( feec22...d030f3 )
by Milan
01:50
created

Utils::extension()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace h4kuna\Upload;
4
5
use Nette\Http;
6
7
class Utils
8
{
9
10
	/**
11
	 * @param string|IStoreFile $relativePath
12
	 * @return string
13
	 */
14
	public static function makeRelativePath($relativePath)
15
	{
16
		if ($relativePath instanceof IStoreFile) {
17
			return $relativePath->getRelativePath();
18
		}
19
20
		return $relativePath;
21
	}
22
23
24
	/**
25
	 * @param Http\FileUpload $fileUpload
26
	 * @return string|null
27
	 */
28
	public static function extension(Http\FileUpload $fileUpload)
29
	{
30
		return pathinfo($fileUpload->getName(), PATHINFO_EXTENSION);
31
	}
32
}