Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 14 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
45 | 2 | public function call( callable $func, $args = null ) { |
|
46 | |||
47 | 2 | declare( ticks=1 ); |
|
48 | |||
49 | 2 | self::$memory = memory_get_usage(); |
|
50 | 2 | self::$max = 0; |
|
51 | |||
52 | 2 | register_tick_function( |
|
53 | 2 | 'call_user_func_array', |
|
54 | 2 | array( '\Onoi\CallbackContainer\CallFuncMemorySniffer', 'memoryTick' ), |
|
55 | 2 | array() |
|
56 | 2 | ); |
|
57 | |||
58 | 2 | $this->time = microtime( true ); |
|
|
|||
59 | 2 | $result = is_array( $args ) ? call_user_func_array( $func, $args ): call_user_func( $func ); |
|
60 | 2 | $this->time = microtime( true ) - $this->time; |
|
61 | |||
62 | 2 | unregister_tick_function( 'call_user_func_array' ); |
|
63 | |||
64 | 2 | return $result; |
|
65 | } |
||
66 | |||
86 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.