1 | <?php |
||
7 | class Sequencer implements FormatterInterface |
||
8 | { |
||
9 | const SEQUENCE = '<%s>'; |
||
10 | |||
11 | /** |
||
12 | * @param string $text The text to be sequenced |
||
13 | * @param string $label An optional label |
||
14 | * |
||
15 | * @return string |
||
16 | */ |
||
17 | 3 | public function format($text, $label = null) |
|
21 | |||
22 | /** |
||
23 | * @param string $text |
||
24 | * @param null $label |
||
25 | * |
||
26 | * @return string |
||
27 | */ |
||
28 | 12 | public static function sequence($text, $label = null) |
|
29 | { |
||
30 | 12 | $text = $label ? $text.'|'.$label : $text; |
|
31 | |||
32 | 12 | return sprintf(static::SEQUENCE, $text); |
|
33 | } |
||
34 | |||
35 | /** |
||
36 | * @param CommandInterface $command |
||
37 | * |
||
38 | * @return array |
||
39 | */ |
||
40 | 6 | public static function command(CommandInterface $command) |
|
41 | { |
||
42 | return [ |
||
43 | 6 | 'channel' => self::sequence('#'.$command['channel_id'], $command['channel_name']), |
|
44 | 6 | 'user' => self::sequence('@'.$command['user_id'], $command['user_name']), |
|
45 | 6 | ]; |
|
46 | } |
||
47 | |||
48 | /** |
||
49 | * @param string $channel |
||
50 | * |
||
51 | * @return string |
||
52 | */ |
||
53 | 3 | public static function alert($channel) |
|
57 | } |
||
58 |
This check looks at variables that have been passed in as parameters and are passed out again to other methods.
If the outgoing method call has stricter type requirements than the method itself, an issue is raised.
An additional type check may prevent trouble.