1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: namespace TokenReflection\Stream;
17:
18: use TokenReflection\Broker as Broker, TokenReflection\Exception;
19:
20: 21: 22:
23: class FileStream extends StreamBase
24: {
25: 26: 27: 28: 29: 30: 31: 32:
33: public function __construct($fileName)
34: {
35: parent::__construct();
36:
37: $this->fileName = Broker::getRealPath($fileName);
38:
39: if (false === $this->fileName) {
40: throw new Exception\StreamException($this, 'File does not exist.', Exception\StreamException::DOES_NOT_EXIST);
41: }
42:
43: $contents = @file_get_contents($this->fileName);
44: if (false === $contents) {
45: throw new Exception\StreamException($this, 'File is not readable.', Exception\StreamException::NOT_READABLE);
46: }
47:
48: $this->processSource($contents);
49: }
50: }