1 | <?php |
||
10 | abstract class AbstractBot implements ResponderAware, Matcher\MatcherAggregate |
||
11 | { |
||
12 | private $matcher; |
||
13 | |||
14 | /** |
||
15 | * @var \Crummy\Phlack\Common\Responder\ResponderInterface |
||
16 | */ |
||
17 | protected $responder; |
||
18 | |||
19 | /** |
||
20 | * @param Matcher\MatcherInterface|\Closure $matcher |
||
21 | * @param ResponderInterface $responder |
||
22 | */ |
||
23 | 11 | public function __construct($matcher = null, ResponderInterface $responder = null) |
|
33 | |||
34 | /** |
||
35 | * @param Matcher\MatcherInterface $matcher |
||
36 | * |
||
37 | * @throws \Crummy\Phlack\Common\Exception\InvalidArgumentException When given an invalid matcher. |
||
38 | * |
||
39 | * @return $this |
||
40 | */ |
||
41 | 11 | public function setMatcher($matcher) |
|
54 | |||
55 | /** |
||
56 | * @return Matcher\MatcherInterface|callable |
||
57 | */ |
||
58 | 2 | public function getMatcher() |
|
62 | |||
63 | /** |
||
64 | * @param ResponderInterface $responder |
||
65 | * |
||
66 | * @return self |
||
67 | */ |
||
68 | 11 | public function setResponder(ResponderInterface $responder) |
|
74 | |||
75 | /** |
||
76 | * @param string $text |
||
77 | * |
||
78 | * @return \Crummy\Phlack\WebHook\Reply\Reply |
||
79 | */ |
||
80 | 2 | protected function say($text) |
|
84 | |||
85 | /** |
||
86 | * @param string $text |
||
87 | * |
||
88 | * @return \Crummy\Phlack\WebHook\Reply\Reply |
||
89 | */ |
||
90 | protected function emote($text) |
||
94 | |||
95 | /** |
||
96 | * @param string $user The user_id to tell |
||
97 | * @param string $text |
||
98 | * |
||
99 | * @return \Crummy\Phlack\WebHook\Reply\Reply |
||
100 | */ |
||
101 | protected function tell($user, $text) |
||
105 | |||
106 | /** |
||
107 | * @param \Crummy\Phlack\WebHook\CommandInterface $user The user_id, or a CommandInterface to inspect. |
||
108 | * @param string $text |
||
109 | * |
||
110 | * @return \Crummy\Phlack\WebHook\Reply\Reply |
||
111 | */ |
||
112 | 4 | protected function reply($user, $text) |
|
116 | |||
117 | /** |
||
118 | * @param string $text |
||
119 | * |
||
120 | * @return \Crummy\Phlack\WebHook\Reply\Reply |
||
121 | */ |
||
122 | protected function shout($text) |
||
126 | |||
127 | /** |
||
128 | * @param MessageInterface $message |
||
129 | * |
||
130 | * @return \Crummy\Phlack\WebHook\Reply\EmptyReply |
||
131 | */ |
||
132 | protected function send(MessageInterface $message) |
||
136 | } |
||
137 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.