CommandGetxml::parseResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 11
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 11
loc 11
ccs 6
cts 6
cp 1
crap 1
rs 9.9
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * This file is part of graze/dynamark3-client.
5
 *
6
 * Copyright (c) 2016 Nature Delivered Ltd. <https://www.graze.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 *
11
 * @license https://github.com/graze/dynamark3-client/blob/master/LICENSE.md
12
 * @link    https://github.com/graze/dynamark3-client
13
 */
14
15
namespace Graze\Dynamark3Client\Command;
16
17
use \Graze\TelnetClient\TelnetResponseInterface;
18
19
class CommandGetxml extends AbstractCommand
20
{
21
    /**
22
     * @return string
23
     */
24 1
    public function getCommandText()
25
    {
26 1
        return 'GETXML';
27
    }
28
29
    /**
30
     * @return string
31
     */
32 1
    public function getPrompt()
33
    {
34 1
        return 'RESULT GETXML .+';
35
    }
36
37
    /**
38
     * @param TelnetResponseInterface $telnetResponse
39
     *
40
     * @return \Graze\Dynamark3Client\Dynamark3ResponseInterface
41
     */
42 2 View Code Duplication
    public function parseResponse(TelnetResponseInterface $telnetResponse)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
43
    {
44 2
        $promptMatches = $telnetResponse->getPromptMatches();
45 2
        $prompt = reset($promptMatches);
46
47 2
        $response = parent::parseResponse($telnetResponse);
48
        // prompt = RESULT GETXML <xml><something...
49 2
        $response->setResponseText(substr($prompt, 14));
50
51 2
        return $response;
52
    }
53
}
54