-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathAbstractHandler.php
More file actions
47 lines (40 loc) · 924 Bytes
/
AbstractHandler.php
File metadata and controls
47 lines (40 loc) · 924 Bytes
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
47
<?php
namespace BitSensor\Handler;
use Proto\Datapoint;
abstract class AbstractHandler implements Handler
{
/**
* @param Datapoint $datapoint
* @return void
*/
public function handle(Datapoint $datapoint)
{
$this->doHandle($datapoint);
}
/**
* Extend a Datapoint with more fields
*
* @param Datapoint $datapoint
* @return mixed
*/
public abstract function doHandle(Datapoint $datapoint);
/**
* Configure the Handler. Automatically called in the constructor.
*
* @param string[] $config
* @return mixed
*/
public function configure($config)
{
return; //TODO: To be extended with enable bool
}
/**
* Handler constructor.
* @param string[] $config
*/
public function __construct($config = null)
{
if (!empty($config))
$this->configure($config);
}
}