Conditions | 2 |
Paths | 2 |
Total Lines | 21 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public function call( callable $func, $args = null ) { |
||
46 | |||
47 | declare( ticks=1 ); |
||
48 | |||
49 | self::$memory = memory_get_usage(); |
||
50 | self::$max = 0; |
||
51 | |||
52 | register_tick_function( |
||
53 | 'call_user_func_array', |
||
54 | array( '\Onoi\CallbackContainer\CallFuncMemorySniffer', 'memoryTick' ), |
||
55 | array() |
||
56 | ); |
||
57 | |||
58 | $this->time = microtime( true ); |
||
|
|||
59 | $result = is_array( $args ) ? call_user_func_array( $func, $args ): call_user_func( $func ); |
||
60 | $this->time = microtime( true ) - $this->time; |
||
61 | |||
62 | unregister_tick_function( 'call_user_func_array' ); |
||
63 | |||
64 | 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.