-
Notifications
You must be signed in to change notification settings - Fork 0
/
Closure.php
46 lines (31 loc) · 788 Bytes
/
Closure.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Debuggy\Gauger\Indicator;
use Debuggy\Gauger\Formatter;
use Debuggy\Gauger\Indicator;
use Closure as _Closure;
/**
* Incapsulates user-defined closure for producing data
*/
class Closure extends Indicator {
/**
* Initializes the object with the user-defined indicator
*
* @param \Closure $indicator User-defined indicator
* @param \Closure $formatter Formatter for the data
*/
public function __construct (_Closure $indicator, Formatter $formatter = null) {
parent::__construct ($formatter);
$this->_indicator = $indicator;
}
/** {@inheritdoc} */
public function gauge ($extra = null) {
$closure = $this->_indicator;
return $closure ($extra);
}
/**
* Closure for data producing
*
* @var \Closure
*/
private $_indicator;
}