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

ListNewsGroupsCommand   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 1
cbo 1
dl 0
loc 42
ccs 0
cts 18
cp 0
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A execute() 0 4 1
A getExpectedResponseCodes() 0 6 1
A onListNewsGroups() 0 4 1
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