Completed
Push — master ( 30aab1...cadcfa )
by Asmir
07:00
created

FileInputStream::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
namespace Masterminds\HTML5\Parser;
3
4
/**
5
 * The FileInputStream loads a file to be parsed.
6
 *
7
 * So right now we read files into strings and then process the
8
 * string. We chose to do this largely for the sake of expediency of
9
 * development, and also because we could optimize toward processing
10
 * arbitrarily large chunks of the input. But in the future, we'd
11
 * really like to rewrite this class to efficiently handle lower level
12
 * stream reads (and thus efficiently handle large documents).
13
 *
14
 * @deprecated since 2.4, to remove in 3.0. Use a string in the scanner instead.
15
 */
16
class FileInputStream extends StringInputStream implements InputStream
17
{
18
    /**
19
     * Load a file input stream.
20
     *
21
     * @param string $data The file or url path to load.
22
     * @param string $encoding The encoding to use for the data.
23
     * @param string $debug A fprintf format to use to echo the data on stdout.
24
     */
25
    public function __construct($data, $encoding = 'UTF-8', $debug = '')
26
    {
27
        // Get the contents of the file.
28
        $content = file_get_contents($data);
29
30
        parent::__construct($content, $encoding, $debug);
31
    }
32
}
33