BangMessage::bangCommand()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 2
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace Spires\Plugins\BangMessage\Inbound;
5
6
use Spires\Plugins\Message\Inbound\Message;
7
8
class BangMessage extends Message
9
{
10
    /**
11
     * The bang command
12
     * e.g. the message "!somersault mouse acrobat"
13
     * would return "somersault" as the bang command
14
     *
15
     * @return string
16
     */
17
    public function bangCommand()
18
    {
19
        return head(explode(' ', $this->text()));
20
    }
21
22
    public function text()
23
    {
24
        return ltrim(parent::text(), '!');
25
    }
26
}
27