|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Phergie\Irc\Plugin\React\Url\Filter; |
| 4 | + |
| 5 | +use Phergie\Irc\ConnectionInterface; |
| 6 | +use Phergie\Irc\Event\EventInterface; |
| 7 | + |
| 8 | +class UrlEvent implements EventInterface |
| 9 | +{ |
| 10 | + /** |
| 11 | + * @var string |
| 12 | + */ |
| 13 | + protected $url; |
| 14 | + |
| 15 | + /** |
| 16 | + * @var array|mixed|false |
| 17 | + */ |
| 18 | + protected $parsedUrl; |
| 19 | + |
| 20 | + /** |
| 21 | + * @var EventInterface |
| 22 | + */ |
| 23 | + protected $event; |
| 24 | + |
| 25 | + /** |
| 26 | + * UrlEvent constructor. |
| 27 | + * @param string $url |
| 28 | + * @param EventInterface $event |
| 29 | + */ |
| 30 | + public function __construct($url, EventInterface $event) |
| 31 | + { |
| 32 | + $this->url = $url; |
| 33 | + $this->parsedUrl = parse_url($url); |
| 34 | + $this->event = $event; |
| 35 | + } |
| 36 | + |
| 37 | + public function setMessage($message) |
| 38 | + { |
| 39 | + return $this->event->setMessage($message); |
| 40 | + } |
| 41 | + |
| 42 | + public function getMessage() |
| 43 | + { |
| 44 | + return $this->event->getMessage(); |
| 45 | + } |
| 46 | + |
| 47 | + public function setConnection(ConnectionInterface $connection) |
| 48 | + { |
| 49 | + return $this->event->setConnection($connection); |
| 50 | + } |
| 51 | + |
| 52 | + public function getConnection() |
| 53 | + { |
| 54 | + return $this->event->getConnection(); |
| 55 | + } |
| 56 | + |
| 57 | + public function setParams(array $params) |
| 58 | + { |
| 59 | + return $this->event->setParams($params); |
| 60 | + } |
| 61 | + |
| 62 | + public function getParams() |
| 63 | + { |
| 64 | + return $this->event->getParams(); |
| 65 | + } |
| 66 | + |
| 67 | + public function setCommand($command) |
| 68 | + { |
| 69 | + return $this->event->setCommand($command); |
| 70 | + } |
| 71 | + |
| 72 | + public function getCommand() |
| 73 | + { |
| 74 | + return $this->event->getCommand(); |
| 75 | + } |
| 76 | + |
| 77 | + public function getUrlSection($section) |
| 78 | + { |
| 79 | + if (isset($this->parsedUrl[$section])) { |
| 80 | + return $this->parsedUrl[$section]; |
| 81 | + } |
| 82 | + |
| 83 | + return null; |
| 84 | + } |
| 85 | +} |
0 commit comments