Completed
Push — master ( f669a1...dbf89f )
by Vasily
05:55
created

func.php ➔ setTimeout()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
cc 1
dl 0
loc 3
rs 10
eloc 2
nc 1
nop 4
1
<?php
2
if (ini_get('mbstring.func_overload') & 2) {
3
	function binarySubstr($s, $p, $l = 0xFFFFFFF) {
4
		return substr($s, $p, $l, 'ASCII');
5
	}
6
}
7
else
8
if (!function_exists('binarySubstr')) {
9
	function binarySubstr($s, $p, $l = NULL) {
0 ignored issues
show
Best Practice introduced by
The function binarySubstr() has been defined more than once; this definition is ignored, only the first definition in this file (L3-5) is considered.

This check looks for functions that have already been defined in the same file.

Some Codebases, like WordPress, make a practice of defining functions multiple times. This may lead to problems with the detection of function parameters and types. If you really need to do this, you can mark the duplicate definition with the @ignore annotation.

/**
 * @ignore
 */
function getUser() {

}

function getUser($id, $realm) {

}

See also the PhpDoc documentation for @ignore.

Loading history...
10
		if ($l === NULL) {
11
			$ret = substr($s, $p);
12
		}
13
		else {
14
			$ret = substr($s, $p, $l);
15
		}
16
17
		if ($ret === FALSE) {
18
			$ret = '';
19
		}
20
		return $ret;
21
	}
22
}
23
if (!function_exists('D')) {
24
	function D() {
25
		\PHPDaemon\Core\Daemon::log(\PHPDaemon\Core\Debug::dump(...func_get_args()));
26
		//\PHPDaemon\Core\Daemon::log(\PHPDaemon\Core\Debug::backtrace());
0 ignored issues
show
Unused Code Comprehensibility introduced by
64% 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...
27
	}
28
}
29
if (!function_exists('igbinary_serialize')) {
30
	function igbinary_serialize($m) {
31
		return serialize($m);
32
	}
33
34
	function igbinary_unserialize($m) {
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
35
		return unserialize($m);
36
	}
37
}
38
if (!function_exists('setTimeout')) {
39
	function setTimeout($cb, $timeout = null, $id = null, $priority = null) {
40
		return \PHPDaemon\Core\Timer::add($cb, $timeout, $id, $priority);
41
	}
42
}
43
if (!function_exists('clearTimeout')) {
44
	function clearTimeout($id) {
45
		\PHPDaemon\Core\Timer::remove($id);
46
	}
47
}
48