-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInputExt.php
87 lines (76 loc) · 2.24 KB
/
InputExt.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* efxphp (http://emilmalinov.com/efxphp)
*
* @copyright Copyright (c) 2015 Emil Malinov
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
* @link http://github.com/emilkm/efxphp
* @package efxphp
*/
namespace emilkm\efxphp\Amf;
use emilkm\efxphp\Amf\Types\ByteArray;
use emilkm\efxphp\Amf\Types\Date;
use emilkm\efxphp\Amf\Types\Vector;
use emilkm\efxphp\Amf\Types\Xml;
use emilkm\efxphp\Amf\Types\XmlDocument;
use Exception;
use DateTime;
use DateTimeZone;
use SimpleXMLElement;
use DOMElement;
/**
* @author Emil Malinov
* @package efxphp
* @subpackage amf
*/
class InputExt extends AbstractInput
{
const AMF_AMF3 = 1;
const AMF_BIGENDIAN = 2;
const AMF_OBJECT_AS_ASSOC = 4;
const AMF3_NSND_ARRAY_AS_OBJECT = 8;
const AMF_USE_RLAND_DATE = 16;
const AMF_USE_RLAND_XML = 32;
const AMF_USE_RLAND_XMLDOCUMENT = 64;
const AMFC_DATE = 0;
const AMFC_BYTEARRAY = 1;
const AMFC_XML = 2;
const AMFC_XMLDOCUMENT = 3;
const AMFC_VECTOR = 4;
const AMFC_EXTERNALIZABLE = 5;
private $userlandTypes = [
'emilkm\\efxphp\\Amf\\Types\\Date' => self::AMFC_DATE,
'emilkm\\efxphp\\Amf\\Types\\ByteArray' => self::AMFC_BYTEARRAY,
'emilkm\\efxphp\\Amf\\Types\\Xml' => self::AMFC_XML,
'emilkm\\efxphp\\Amf\\Types\\XmlDocument' => self::AMFC_XMLDOCUMENT,
'emilkm\\efxphp\\Amf\\Types\\Vector' => self::AMFC_VECTOR
];
public $decodeFlags;
public function __construct()
{
parent::__construct();
}
/**
* References are handled within the extension, nothing to do here.
*/
public function resetReferences()
{
}
/**
* Public entry point to read a top level AMF Object, such as
* a header value or a message body.
*
* @return mixed
*
* @throws Exception
*/
public function readObject()
{
$this->decodeFlags = ((!$this->bigEndianMachine ? self::AMF_BIGENDIAN : 0)
| ($this->decodeAmfObjectAsArray ? self::AMF_OBJECT_AS_ASSOC : 0)
| ($this->useRlandDateType ? self::AMF_USE_RLAND_DATE : 0)
);
$data = amf_decode($this->data, $this->pos, $this->decodeFlags, $this->userlandTypes);
return $data;
}
}