1 | <?php |
||
9 | abstract class Base |
||
10 | { |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | protected $levels = ["debug","info","notice","warning","error","critical","alert","emergency"]; |
||
15 | |||
16 | /** |
||
17 | * @var array |
||
18 | */ |
||
19 | protected $config; |
||
20 | |||
21 | /** |
||
22 | * @var Logger |
||
23 | */ |
||
24 | protected $logger; |
||
25 | |||
26 | /** |
||
27 | * @param array $config An array of config values to overwrite |
||
28 | * @param Logger $logger A Monolog instance to use |
||
29 | */ |
||
30 | 15 | public function __construct(array $config = [], Logger $logger = null){ |
|
41 | |||
42 | /** |
||
43 | * Returns a list of names that correspond to a config key and the Tylercd100\Notify\Factory::create method |
||
44 | * @return array An array of drivers to use |
||
45 | */ |
||
46 | abstract protected function getDrivers(); |
||
47 | |||
48 | /** |
||
49 | * Gets a hanlder instance for the provided name |
||
50 | * @param string $name The name of the driver you want to use |
||
51 | * @return HandlerInterface |
||
52 | */ |
||
53 | 15 | protected function getHandlerInstanceByName($name){ |
|
57 | |||
58 | /** |
||
59 | * Pushes a Monolog Handler in to the Monolog Logger instance |
||
60 | * @param HandlerInterface $handler The Handler to attach |
||
61 | * @return void |
||
62 | */ |
||
63 | 15 | protected function attachHandler(HandlerInterface $handler){ |
|
66 | |||
67 | /** |
||
68 | * This will attach all the monolog handlers specified in the drivers config array |
||
69 | * @return void |
||
70 | */ |
||
71 | 15 | protected function attachDrivers() |
|
79 | |||
80 | /** |
||
81 | * This will call the log functions of Monolog\Logger |
||
82 | * @param string $method The method to call |
||
83 | * @param array $arguments The arguments provided |
||
84 | * @return void |
||
85 | */ |
||
86 | 3 | public function __call($method, $arguments) |
|
92 | } |