Passed
Pull Request — master (#223)
by
unknown
02:52
created

QueryRequest   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 8
lcom 1
cbo 1
dl 0
loc 77
ccs 0
cts 25
cp 0
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A toNode() 0 20 4
A getShipment() 0 4 1
A setShipment() 0 6 1
A isSuppressQuestionIndicator() 0 4 1
A setSuppressQuestionIndicator() 0 6 1
1
<?php
2
3
namespace Ups\Entity\Tradeability;
4
5
use DomDocument;
6
use DomElement;
7
use Ups\NodeInterface;
8
9
class QueryRequest implements NodeInterface
10
{
11
12
    /**
13
     * @var Shipment
14
     */
15
    private $shipment;
16
17
    /**
18
     * @var bool
19
     */
20
    private $suppressQuestionIndicator = false;
21
22
    /**
23
     * @param null|DOMDocument $document
24
     *
25
     * @return DOMElement
26
     */
27
    public function toNode(DOMDocument $document = null)
28
    {
29
        if (null === $document) {
30
            $document = new DOMDocument();
31
        }
32
33
        $node = $document->createElement('QueryRequest');
34
35
        if ($this->getShipment() !== null) {
36
            $node->appendChild($this->getShipment()->toNode($document));
37
        }
38
        $node->appendChild(
39
            $document->createElement(
40
                'SuppressQuestionIndicator',
41
                ($this->isSuppressQuestionIndicator() ? 'Y' : 'N')
42
            )
43
        );
44
45
        return $node;
46
    }
47
48
    /**
49
     * @return Shipment
50
     */
51
    public function getShipment()
52
    {
53
        return $this->shipment;
54
    }
55
56
    /**
57
     * @param Shipment $shipment
58
     * @return QueryRequest
59
     */
60
    public function setShipment($shipment)
61
    {
62
        $this->shipment = $shipment;
63
64
        return $this;
65
    }
66
67
    /**
68
     * @return boolean
69
     */
70
    public function isSuppressQuestionIndicator()
71
    {
72
        return $this->suppressQuestionIndicator;
73
    }
74
75
    /**
76
     * @param boolean $suppressQuestionIndicator
77
     * @return QueryRequest
78
     */
79
    public function setSuppressQuestionIndicator($suppressQuestionIndicator)
80
    {
81
        $this->suppressQuestionIndicator = $suppressQuestionIndicator;
82
83
        return $this;
84
    }
85
}
86