Completed
Pull Request — master (#18)
by Tobias
03:16
created

functions_utils.php ➔ _print()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
nc 4
nop 1
dl 0
loc 16
rs 9.7333
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * Print a message
5
 */
6
function _print( $string = NULL ) {
7
	if ( 'cli' == php_sapi_name() ) { // PHP is running in terminal
8
		$line_end = PHP_EOL;
9
	} else {
10
		$line_end = '<br/>';
11
	}
12
13
	if ( ! empty( $string ) ) {
14
		$file   = basename( $_SERVER["PHP_SELF"] );
15
		$output = date( 'd-m-Y_H:i:s ' ) . "[$file] $string $line_end";
16
	} else {
17
		$output = $line_end;
18
	}
19
20
	print ( $output );
21
}
22