Code Duplication    Length = 16-21 lines in 2 locations

src/Plugins/ChannelOperations/Inbound/PartSystemMessage.php 1 location

@@ 8-23 (lines=16) @@
5
6
use Spires\Plugins\SystemMessage\Inbound\SystemMessage;
7
8
class PartSystemMessage extends SystemMessage
9
{
10
    public function targets() : array
11
    {
12
        list($targets,) = explode(' ', $this->params(), 2);
13
14
        return explode(',', $targets);
15
    }
16
17
    public function text()
18
    {
19
        list(,$text) = explode(' ', $this->params(), 2);
20
21
        return ltrim($text, ':');
22
    }
23
}
24

src/Plugins/Message/Inbound/Message.php 1 location

@@ 8-28 (lines=21) @@
5
6
use Spires\Irc\Message\Inbound\RawMessage;
7
8
class Message extends RawMessage
9
{
10
    public function targets() : array
11
    {
12
        list($targets,) = explode(' ', $this->params(), 2);
13
14
        return explode(',', $targets);
15
    }
16
17
    public function text()
18
    {
19
        list(,$text) = explode(' ', $this->params(), 2);
20
21
        return ltrim($text, ':');
22
    }
23
24
    public function hasTarget($target)
25
    {
26
        return in_array($target, $this->targets());
27
    }
28
}
29