Completed
Push — master ( 56a459...0ee720 )
by Randy
03:34
created

index.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 21 and the first side effect is on line 16.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
3
use Dgame\Soap\Component\Bipro\AcknowledgeShipment;
4
use Dgame\Soap\Component\Bipro\GetShipment;
5
use Dgame\Soap\Component\Bipro\ListShipments;
6
use Dgame\Soap\Component\Bipro\Request;
7
use Dgame\Soap\Component\Bipro\RequestSecurityToken;
8
use Dgame\Soap\Component\Bipro\SecurityContextToken;
9
use Dgame\Soap\Component\Bipro\UsernameToken;
10
use Dgame\Soap\Component\Bipro\Version;
11
use Dgame\Soap\Component\Body;
12
use Dgame\Soap\Component\Envelope;
13
use Dgame\Soap\Component\Header;
14
use Dgame\Soap\Component\Security;
15
16
require_once 'vendor/autoload.php';
17
18
/**
19
 * @return DOMDocument
20
 */
21
function createDocument() : DOMDocument
22
{
23
    $doc                     = new DOMDocument('1.0', 'utf-8');
24
    $doc->formatOutput       = true;
25
    $doc->preserveWhiteSpace = true;
26
27
    return $doc;
28
}
29
30
print '<pre>';
31
32
$envelope = new Envelope();
33
34
$security = new Security();
35
$token    = new UsernameToken('Foo', 'Bar');
36
$security->attachElement($token);
37
38
$header = new Header();
39
$header->attachElement($security);
40
41
$rst  = new RequestSecurityToken(new Version('2.1.6.1.1'));
42
$body = new Body();
43
$body->attachElement($rst);
44
45
$envelope->attachElement($header);
46
$envelope->attachElement($body);
47
48
$doc = createDocument();
49
50
$envelope->assemble($doc);
51
52
print htmlentities($doc->saveXML());
53
print str_repeat('-', 50) . PHP_EOL;
54
55
$envelope = new Envelope();
56
57
$security = new Security();
58
$token    = new SecurityContextToken('bipro:7860072500822840554');
59
$security->attachElement($token);
60
61
$header = new Header();
62
$header->attachElement($security);
63
64
$request  = new Request(new Version('2.1.4.1.1'));
65
$shipment = new ListShipments($request);
66
67
$body = new Body();
68
$body->attachElement($shipment);
69
70
$envelope->attachElement($header);
71
$envelope->attachElement($body);
72
73
$doc = createDocument();
74
75
$envelope->assemble($doc);
76
77
print htmlentities($doc->saveXML());
78
print str_repeat('-', 50) . PHP_EOL;
79
80
$envelope = new Envelope();
81
82
$security = new Security();
83
$token    = new SecurityContextToken('bipro:7860072500822840554');
84
$security->attachElement($token);
85
86
$header = new Header();
87
$header->attachElement($security);
88
89
$request = new Request(new Version('2.1.4.1.1'));
90
$request->setConsumerId(2);
91
$request->setId(1);
92
$shipment = new GetShipment($request);
93
94
$body = new Body();
95
$body->attachElement($shipment);
96
97
$envelope->attachElement($header);
98
$envelope->attachElement($body);
99
100
$doc = createDocument();
101
102
$envelope->assemble($doc);
103
104
print htmlentities($doc->saveXML());
105
print str_repeat('-', 50) . PHP_EOL;
106
107
$envelope = new Envelope();
108
109
$security = new Security();
110
$token    = new SecurityContextToken('bipro:7860072500822840554');
111
$security->attachElement($token);
112
113
$header = new Header();
114
$header->attachElement($security);
115
116
$request = new Request(new Version('2.1.4.1.1'));
117
$request->setConsumerId(2);
118
$request->setId(1);
119
$shipment = new AcknowledgeShipment($request);
120
121
$body = new Body();
122
$body->attachElement($shipment);
123
124
$envelope->attachElement($header);
125
$envelope->attachElement($body);
126
127
$doc = createDocument();
128
129
$envelope->assemble($doc);
130
131
print htmlentities($doc->saveXML());