Completed
Push — master ( 3702d4...d8c731 )
by
unknown
03:05
created

Deferred   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 3
Bugs 1 Features 2
Metric Value
wmc 2
c 3
b 1
f 2
lcom 0
cbo 0
dl 0
loc 13
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __destruct() 0 3 1
1
<?php
2
3
/**
4
 * Deferred
5
 *
6
 * Run callback when script execution is stopped.
7
 *
8
 * @package core
9
 * @author [email protected]
10
 * @copyright Caffeina srl - 2016 - http://caffeina.com
11
 */
12
13
class Deferred {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
14
15
	protected $callback;
16
17
	public function __construct( callable $callback ) {
18
		$this->callback = $callback;
19
	}
20
21
	public function __destruct() {
22
		call_user_func( $this->callback );
23
	}
24
25
}