1<?php
2/**
3* Exception thrown if an unexpected end of file is detected.
4*
5* @license http://www.opensource.org/licenses/mit-license.php The MIT License
6* @copyright Copyright 2010-2014 PhpCss Team
7*/
8
9namespace PhpCss\Exception {
10
11  use PhpCss;
12
13  /**
14  * Exception thrown if an unexpected end of file is detected.
15  */
16  class UnexpectedEndOfFileException extends ParserException {
17
18    /**
19     * @param array(PhpCss\Scanner\Token) $expectedTokens
20     */
21    public function __construct(array $expectedTokens) {
22      $this->_expectedTokens = $expectedTokens;
23
24      $expectedTokenStrings = array();
25      foreach ($expectedTokens as $expectedToken) {
26        $expectedTokenStrings[] = PhpCss\Scanner\Token::typeToString($expectedToken);
27      }
28
29      parent::__construct(
30        'Parse error: Unexpected end of file was found while one of '.
31        implode(", ", $expectedTokenStrings).' was expected.'
32      );
33    }
34  }
35}
36