Completed
Pull Request — master (#446)
by thomas
228:15 queued 224:06
created

Types::uint16le()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace BitWasp\Bitcoin\Serializer;
4
5
use BitWasp\Buffertools\CachingTypeFactory;
6
use BitWasp\Buffertools\Types\ByteString;
7
use BitWasp\Buffertools\Types\Int128;
8
use BitWasp\Buffertools\Types\Int16;
9
use BitWasp\Buffertools\Types\Int256;
10
use BitWasp\Buffertools\Types\Int32;
11
use BitWasp\Buffertools\Types\Int64;
12
use BitWasp\Buffertools\Types\Int8;
13
use BitWasp\Buffertools\Types\Uint128;
14
use BitWasp\Buffertools\Types\Uint16;
15
use BitWasp\Buffertools\Types\Uint256;
16
use BitWasp\Buffertools\Types\Uint32;
17
use BitWasp\Buffertools\Types\Uint64;
18
use BitWasp\Buffertools\Types\Uint8;
19
use BitWasp\Buffertools\Types\VarInt;
20
use BitWasp\Buffertools\Types\VarString;
21
22
class Types
23
{
24
    /**
25
     * @return CachingTypeFactory
26
     */
27
    public static function factory()
28
    {
29
        static $factory;
30
        if (null === $factory) {
31
            $factory = new CachingTypeFactory();
32
        }
33
34
        return $factory;
35
    }
36
37
    /**
38
     * @param int $length
39
     * @return ByteString
40
     */
41
    public static function bytestring($length)
42
    {
43
        return static::factory()->{__FUNCTION__}($length);
44
    }
45
46
    /**
47
     * @param int $length
48
     * @return ByteString
49
     */
50
    public static function bytestringle($length)
51
    {
52
        return static::factory()->{__FUNCTION__}($length);
53
    }
54
55
    /**
56
     * @return Uint8
57
     */
58
    public static function uint8()
59
    {
60
        return static::factory()->{__FUNCTION__}();
61
    }
62
63
    /**
64
     * @return Uint8
65
     */
66
    public static function uint8le()
67
    {
68
        return static::factory()->{__FUNCTION__}();
69
    }
70
71
    /**
72
     * @return Uint16
73
     */
74
    public static function uint16()
75
    {
76
        return static::factory()->{__FUNCTION__}();
77
    }
78
79
    /**
80
     * @return Uint16
81
     */
82
    public static function uint16le()
83
    {
84
        return static::factory()->{__FUNCTION__}();
85
    }
86
87
    /**
88
     * @return Uint32
89
     */
90
    public static function uint32()
91
    {
92
        return static::factory()->{__FUNCTION__}();
93
    }
94
95
    /**
96
     * @return Uint32
97
     */
98
    public static function uint32le()
99
    {
100
        return static::factory()->{__FUNCTION__}();
101
    }
102
103
    /**
104
     * @return Uint64
105
     */
106
    public static function uint64()
107
    {
108
        return static::factory()->{__FUNCTION__}();
109
    }
110
111
    /**
112
     * @return Uint64
113
     */
114
    public static function uint64le()
115
    {
116
        return static::factory()->{__FUNCTION__}();
117
    }
118
119
    /**
120
     * @return Uint128
121
     */
122
    public static function uint128()
123
    {
124
        return static::factory()->{__FUNCTION__}();
125
    }
126
127
    /**
128
     * @return Uint128
129
     */
130
    public static function uint128le()
131
    {
132
        return static::factory()->{__FUNCTION__}();
133
    }
134
135
    /**
136
     * @return Uint256
137
     */
138
    public static function uint256()
139
    {
140
        return static::factory()->{__FUNCTION__}();
141
    }
142
143
    /**
144
     * @return Uint256
145
     */
146
    public static function uint256le()
147
    {
148
        return static::factory()->{__FUNCTION__}();
149
    }
150
151
    /**
152
     * @return Int8
153
     */
154
    public static function int8()
155
    {
156
        return static::factory()->{__FUNCTION__}();
157
    }
158
159
    /**
160
     * @return Int8
161
     */
162
    public static function int8le()
163
    {
164
        return static::factory()->{__FUNCTION__}();
165
    }
166
167
    /**
168
     * @return Int16
169
     */
170
    public static function int16()
171
    {
172
        return static::factory()->{__FUNCTION__}();
173
    }
174
175
    /**
176
     * @return Int16
177
     */
178
    public static function int16le()
179
    {
180
        return static::factory()->{__FUNCTION__}();
181
    }
182
183
    /**
184
     * @return Int32
185
     */
186
    public static function int32()
187
    {
188
        return static::factory()->{__FUNCTION__}();
189
    }
190
191
    /**
192
     * @return Int32
193
     */
194
    public static function int32le()
195
    {
196
        return static::factory()->{__FUNCTION__}();
197
    }
198
199
    /**
200
     * @return Int64
201
     */
202
    public static function int64()
203
    {
204
        return static::factory()->{__FUNCTION__}();
205
    }
206
207
    /**
208
     * @return Int64
209
     */
210
    public static function int64le()
211
    {
212
        return static::factory()->{__FUNCTION__}();
213
    }
214
215
    /**
216
     * @return Int128
217
     */
218
    public static function int128()
219
    {
220
        return static::factory()->{__FUNCTION__}();
221
    }
222
223
    /**
224
     * @return Int128
225
     */
226
    public static function int128le()
227
    {
228
        return static::factory()->{__FUNCTION__}();
229
    }
230
231
    /**
232
     * @return Int256
233
     */
234
    public static function int256()
235
    {
236
        return static::factory()->{__FUNCTION__}();
237
    }
238
239
    /**
240
     * @return Int256
241
     */
242
    public static function int256le()
243
    {
244
        return static::factory()->{__FUNCTION__}();
245
    }
246
247
    /**
248
     * @return VarInt
249
     */
250
    public static function varint()
251
    {
252
        return static::factory()->{__FUNCTION__}();
253
    }
254
255
    /**
256
     * @return VarString
257
     */
258
    public static function varstring()
259
    {
260
        return static::factory()->{__FUNCTION__}();
261
    }
262
263
    /**
264
     * @param callable $reader
265
     * @return \BitWasp\Buffertools\Types\Vector
266
     */
267
    public static function vector(callable $reader)
268
    {
269
        return static::factory()->vector($reader);
270
    }
271
}
272