scratch – Blame information for rev

Subversion Repositories:
Rev:
Rev Author Line No. Line
115 office 1 <?php
2  
3 /*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11  
12 namespace Monolog\Handler;
13  
14 use Monolog\Formatter\FormatterInterface;
15  
16 /**
17 * This simple wrapper class can be used to extend handlers functionality.
18 *
19 * Example: A custom filtering that can be applied to any handler.
20 *
21 * Inherit from this class and override handle() like this:
22 *
23 * public function handle(array $record)
24 * {
25 * if ($record meets certain conditions) {
26 * return false;
27 * }
28 * return $this->handler->handle($record);
29 * }
30 *
31 * @author Alexey Karapetov <alexey@karapetov.com>
32 */
33 class HandlerWrapper implements HandlerInterface
34 {
35 /**
36 * @var HandlerInterface
37 */
38 protected $handler;
39  
40 /**
41 * HandlerWrapper constructor.
42 * @param HandlerInterface $handler
43 */
44 public function __construct(HandlerInterface $handler)
45 {
46 $this->handler = $handler;
47 }
48  
49 /**
50 * {@inheritdoc}
51 */
52 public function isHandling(array $record)
53 {
54 return $this->handler->isHandling($record);
55 }
56  
57 /**
58 * {@inheritdoc}
59 */
60 public function handle(array $record)
61 {
62 return $this->handler->handle($record);
63 }
64  
65 /**
66 * {@inheritdoc}
67 */
68 public function handleBatch(array $records)
69 {
70 return $this->handler->handleBatch($records);
71 }
72  
73 /**
74 * {@inheritdoc}
75 */
76 public function pushProcessor($callback)
77 {
78 $this->handler->pushProcessor($callback);
79  
80 return $this;
81 }
82  
83 /**
84 * {@inheritdoc}
85 */
86 public function popProcessor()
87 {
88 return $this->handler->popProcessor();
89 }
90  
91 /**
92 * {@inheritdoc}
93 */
94 public function setFormatter(FormatterInterface $formatter)
95 {
96 $this->handler->setFormatter($formatter);
97  
98 return $this;
99 }
100  
101 /**
102 * {@inheritdoc}
103 */
104 public function getFormatter()
105 {
106 return $this->handler->getFormatter();
107 }
108 }