Total Complexity | 7 |
Total Lines | 73 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | class Text |
||
16 | { |
||
17 | /** |
||
18 | * @var bool If true - print more information. |
||
19 | */ |
||
20 | private static $debugMode = false; |
||
|
|||
21 | |||
22 | /** |
||
23 | * Prints how much time took some action in milliseconds. |
||
24 | * |
||
25 | * @param float|string $startTime Time when action started |
||
26 | */ |
||
27 | public static function printTimeDuration($startTime) |
||
28 | { |
||
29 | $currentTime = microtime(true); |
||
30 | |||
31 | if (gettype($startTime) === 'string') { |
||
32 | $currentTime = microtime(); |
||
33 | } |
||
34 | |||
35 | $completedIn = (float) $currentTime - (float) $startTime; |
||
36 | $completedIn = number_format((float) $completedIn, 4, '.', ''); |
||
37 | |||
38 | self::message('It was done in '.$completedIn.' ms.'); |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Set $debugMode property value |
||
43 | * |
||
44 | * @param bool $value |
||
45 | * |
||
46 | * @see Text::$debugMode |
||
47 | */ |
||
48 | public static function setDebug($value) |
||
49 | { |
||
50 | Text::$debugMode = $value; |
||
51 | } |
||
52 | |||
53 | /** |
||
54 | * Get $debugMode property value |
||
55 | * |
||
56 | * @return bool |
||
57 | * |
||
58 | * @see Text::$debugMode |
||
59 | */ |
||
60 | public static function getDebug() |
||
63 | } |
||
64 | |||
65 | /** |
||
66 | * Execute message() function if $debugMode is set to true. |
||
67 | * |
||
68 | * @param mixed $message Message to print if in DEBUG mode |
||
69 | * |
||
70 | * @see Text::$debugMode |
||
71 | * @see Text::message() |
||
72 | */ |
||
73 | public static function debug($message) |
||
77 | } |
||
78 | } |
||
79 | |||
80 | /** |
||
81 | * Prints message with new lines. |
||
82 | * |
||
83 | * @param mixed $message Message to print |
||
84 | */ |
||
85 | public static function message($message) |
||
90 |
This check marks private properties in classes that are never used. Those properties can be removed.