Signature::toXML()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 9
loc 9
ccs 6
cts 6
cp 1
rs 9.6666
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 2
1
<?php
2
namespace Bpost\BpostApiClient\Bpost\Order\Box\Option;
3
4
/**
5
 * bPost Signature class
6
 *
7
 * @author    Tijs Verkoyen <[email protected]>
8
 * @version   3.0.0
9
 * @copyright Copyright (c), Tijs Verkoyen. All rights reserved.
10
 * @license   BSD License
11
 */
12 View Code Duplication
class Signature extends Option
0 ignored issues
show
Duplication introduced by
This class 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...
13
{
14
    /**
15
     * Return the object as an array for usage in the XML
16
     *
17
     * @param  \DomDocument $document
18
     * @param  string       $prefix
0 ignored issues
show
Documentation introduced by
Should the type for parameter $prefix not be string|null?

This check looks for @param annotations where the type inferred by our type inference engine differs from the declared type.

It makes a suggestion as to what type it considers more descriptive.

Most often this is a case of a parameter that can be null in addition to its declared types.

Loading history...
19
     * @return \DomElement
20
     */
21 1
    public function toXML(\DOMDocument $document, $prefix = null)
22
    {
23 1
        $tagName = 'signed';
24 1
        if ($prefix !== null) {
25 1
            $tagName = $prefix . ':' . $tagName;
26 1
        }
27
28 1
        return $document->createElement($tagName);
29
    }
30
}
31