1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* BaconPdf |
4
|
|
|
* |
5
|
|
|
* @link http://github.com/Bacon/BaconPdf For the canonical source repository |
6
|
|
|
* @copyright 2015 Ben Scholzen (DASPRiD) |
7
|
|
|
* @license http://opensource.org/licenses/BSD-2-Clause Simplified BSD License |
8
|
|
|
*/ |
9
|
|
|
|
10
|
|
|
namespace Bacon\PdfBenchmark; |
11
|
|
|
|
12
|
|
|
use Athletic\AthleticEvent; |
13
|
|
|
use Bacon\Pdf\Writer\ObjectWriter; |
14
|
|
|
use SplFileObject; |
15
|
|
|
|
16
|
|
|
class ObjectWriterEvent extends AthleticEvent |
17
|
|
|
{ |
18
|
|
|
/** |
19
|
|
|
* @var ObjectWriter |
20
|
|
|
*/ |
21
|
|
|
private $objectWriter; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* {@inheritdoc} |
25
|
|
|
*/ |
26
|
|
|
public function setUp() |
27
|
|
|
{ |
28
|
|
|
$this->objectWriter = new ObjectWriter(new SplFileObject('php://memory', 'w+')); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* @iterations 10000 |
33
|
|
|
*/ |
34
|
|
|
public function writeRawLine() |
35
|
|
|
{ |
36
|
|
|
$this->objectWriter->writeRawLine('foo'); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @iterations 10000 |
41
|
|
|
*/ |
42
|
|
|
public function startDictionary() |
43
|
|
|
{ |
44
|
|
|
$this->objectWriter->startDictionary(); |
45
|
|
|
} |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @iterations 10000 |
49
|
|
|
*/ |
50
|
|
|
public function endDictionary() |
51
|
|
|
{ |
52
|
|
|
$this->objectWriter->endDictionary(); |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @iterations 10000 |
57
|
|
|
*/ |
58
|
|
|
public function startArray() |
59
|
|
|
{ |
60
|
|
|
$this->objectWriter->startArray(); |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
/** |
64
|
|
|
* @iterations 10000 |
65
|
|
|
*/ |
66
|
|
|
public function endArray() |
67
|
|
|
{ |
68
|
|
|
$this->objectWriter->endArray(); |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* @iterations 10000 |
73
|
|
|
*/ |
74
|
|
|
public function writeNull() |
75
|
|
|
{ |
76
|
|
|
$this->objectWriter->writeNull(); |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* @iterations 10000 |
81
|
|
|
*/ |
82
|
|
|
public function writeBoolean() |
83
|
|
|
{ |
84
|
|
|
$this->objectWriter->writeBoolean(true); |
85
|
|
|
} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @iterations 10000 |
89
|
|
|
*/ |
90
|
|
|
public function writeIntegerNumber() |
91
|
|
|
{ |
92
|
|
|
$this->objectWriter->writeNumber(1); |
93
|
|
|
} |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @iterations 10000 |
97
|
|
|
*/ |
98
|
|
|
public function writeFloatNumber() |
99
|
|
|
{ |
100
|
|
|
$this->objectWriter->writeNumber(1.1); |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @iterations 10000 |
105
|
|
|
*/ |
106
|
|
|
public function writeName() |
107
|
|
|
{ |
108
|
|
|
$this->objectWriter->writeName('foo'); |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* @iterations 10000 |
113
|
|
|
*/ |
114
|
|
|
public function writeLiteralString() |
115
|
|
|
{ |
116
|
|
|
$this->objectWriter->writeLiteralString('foo'); |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
/** |
120
|
|
|
* @iterations 10000 |
121
|
|
|
*/ |
122
|
|
|
public function writeHexadecimalString() |
123
|
|
|
{ |
124
|
|
|
$this->objectWriter->writeHexadecimalString('foo'); |
125
|
|
|
} |
126
|
|
|
} |
127
|
|
|
|