Completed
Pull Request — master (#20)
by
unknown
01:46
created

ListNewsGroupsCommand::onListNewsGroups()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 2
1
<?php
2
3
namespace Rvdv\Nntp\Command;
4
5
use Rvdv\Nntp\Exception\RuntimeException;
6
use Rvdv\Nntp\Response\MultiLineResponse;
7
use Rvdv\Nntp\Response\Response;
8
9
/**
10
 * ListNewsGroupsCommand
11
 *
12
 * @author warlord
13
 */
14
class ListNewsGroupsCommand extends Command implements CommandInterface
15
{
16
17
    /**
18
     * Constructor
19
     *
20
     */
21
    public function __construct()
22
    {
23
        parent::__construct(array(), true);
24
    }
25
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function execute()
30
    {
31
        return 'LIST NEWSGROUPS';
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function getExpectedResponseCodes()
38
    {
39
        return array(
40
            Response::INFORMATION_FOLLOWS => 'onListNewsGroups'
41
        );
42
    }
43
    
44
    /**
45
    * Return the list of Newsgroups as an array 
46
    *
47
    * @param MultiLineReponse
48
    *
49
    * @return array
50
    */
51
    public function onListNewsGroups(MultiLineResponse $response)
52
    {
53
        $this->result = (array) $response->getLines();
54
    }
55
}
56