Lines Matching defs:token

240      * @param null|bool|string $token
245 public function readValue($token = null, $expectedType = null)
247 if ($token === null) {
248 $token = $this->tokenizer->getNextToken();
251 if ($token === false) {
253 throw new Type\PdfTypeException('Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE);
258 switch ($token) {
260 $this->ensureExpectedType($token, $expectedType);
270 $this->ensureExpectedType($token, $expectedType);
274 $this->ensureExpectedType($token, $expectedType);
278 $this->ensureExpectedType($token, $expectedType);
282 if (\is_numeric($token)) {
290 'Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE
295 $token,
306 'Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE
310 return PdfIndirectObjectReference::create($token, $token2);
322 'Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE
325 return PdfNumeric::create($token);
328 if ($token === 'true' || $token === 'false') {
329 $this->ensureExpectedType($token, $expectedType);
330 return PdfBoolean::create($token === 'true');
333 if ($token === 'null') {
334 $this->ensureExpectedType($token, $expectedType);
340 'Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE
345 $v->value = $token;
352 * Ensures that the token will evaluate to an expected object type (or not).
354 * @param string $token
359 private function ensureExpectedType($token, $expectedType)
372 if ($expectedType === null || $mapping[$token] === $expectedType) {
376 throw new Type\PdfTypeException('Got unexpected token type.', Type\PdfTypeException::INVALID_DATA_TYPE);