Utils   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 6
Bugs 2 Features 1
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 39
c 6
b 2
f 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A absolutizePath() 0 12 2
A isPlatformWith32bitInteger() 0 3 1
A isPlatformWith64bitInteger() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: jkuchar1
5
 * Date: 31.1.2016
6
 * Time: 16:49
7
 */
8
9
namespace BigFileTools;
10
11
/**
12
 * Class Utils
13
 * @package BigFileTools
14
 * @internal
15
 */
16
class Utils
17
{
18
	/**
19
	 * Converts relative path to absolute
20
	 * @param string $path relative path
21
	 * @return string Absolute path
22
	 * @throws Exception
23
	 * @internal
24
	 */
25
	static function absolutizePath($path)
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
26
	{
27
28
		$path = realpath($path);
29
		if(!$path) {
30
			// TODO: use hack like http://stackoverflow.com/questions/4049856/replace-phps-realpath or http://www.php.net/manual/en/function.realpath.php#84012
31
			//       probably as optional feature that can be turned on when you know, what are you doing
32
33
			throw new Exception("Not possible to resolve absolute path.");
34
		}
35
		return $path;
36
	}
37
38
	/**
39
	 * @return bool
40
	 * @internal
41
	 */
42
	static function isPlatformWith32bitInteger() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
43
		return (string)PHP_INT_MAX === "2147483647"; // (2^31-1)
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
44
	}
45
46
	/**
47
	 * @return bool
48
	 * @internal
49
	 */
50
	static function isPlatformWith64bitInteger() {
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
51
		return (string)PHP_INT_MAX === "9223372036854775807"; // (2^63-1)
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
52
	}
53
54
}