1: <?php
2: /**
3: * PHP Token Reflection
4: *
5: * Version 1.3.1
6: *
7: * LICENSE
8: *
9: * This source file is subject to the new BSD license that is bundled
10: * with this library in the file LICENSE.
11: *
12: * @author Ondřej Nešpor
13: * @author Jaroslav Hanslík
14: */
15:
16: namespace TokenReflection\Stream;
17:
18: /**
19: * Token stream iterator created from a string.
20: */
21: class StringStream extends StreamBase
22: {
23: /**
24: * Constructor.
25: *
26: * Creates a token substream from a string.
27: *
28: * @param string $source PHP source code
29: * @param string $fileName File name
30: */
31: public function __construct($source, $fileName)
32: {
33: parent::__construct();
34:
35: $this->fileName = $fileName;
36: $this->processSource($source);
37: }
38: }