| 1 | <?php |
||
| 11 | class AbstractAdapter implements AdapterInterface |
||
| 12 | { |
||
| 13 | /** @var Mainframe */ |
||
| 14 | protected $mainframe; |
||
| 15 | |||
| 16 | /** @var StringConverter|ConverterInterface */ |
||
| 17 | protected $converter; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @param Mainframe $mainframe |
||
| 21 | * @param ConverterInterface $converter |
||
| 22 | */ |
||
| 23 | 6 | public function __construct(Mainframe $mainframe, ConverterInterface $converter = null) |
|
| 24 | { |
||
| 25 | 6 | $this->setMainframe($mainframe); |
|
| 26 | 6 | $this->converter = $converter ?: new StringConverter(); |
|
| 27 | 6 | } |
|
| 28 | |||
| 29 | /** |
||
| 30 | * @param Mainframe $mainframe |
||
| 31 | * |
||
| 32 | * @return self |
||
| 33 | */ |
||
| 34 | 6 | public function setMainframe(Mainframe $mainframe) |
|
| 35 | { |
||
| 36 | 6 | $this->mainframe = $mainframe; |
|
| 37 | |||
| 38 | 6 | return $this; |
|
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @return \Crummy\Phlack\WebHook\Converter\ConverterInterface |
||
| 43 | */ |
||
| 44 | public function getConverter() |
||
| 48 | |||
| 49 | /** |
||
| 50 | * @param BotInterface $bot |
||
| 51 | * @param MatcherInterface|callable $matcher |
||
| 52 | * @param int $priority |
||
| 53 | * |
||
| 54 | * @return self |
||
| 55 | */ |
||
| 56 | public function attach(BotInterface $bot, $matcher = null, $priority = 0) |
||
| 62 | } |
||
| 63 |