Completed
Push — master ( 7c39f2...831177 )
by Jeroen
04:12
created

PrivmsgMessage::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
namespace Jerodev\PhpIrcClient\Messages;
4
5
use Jerodev\PhpIrcClient\IrcClient;
6
7
class PrivmsgMessage extends IrcMessage
8
{
9
    /** @var string */
10
    public $user;
11
    
12
    /** @var string */
13
    public $target;
14
    
15
    /** @var string */
16
    public $message;
17
    
18
    public function __construct(string $message)
19
    {
20
        parent::__construct($message);
21
        
22
        $this->user = preg_replace('/^([^!]+)!.*?$/', '$1', $this->source);
23
        $this->target = $this->commandsuffix;
24
        $this->message = $this->payload;
25
    }
26
}
27