Completed
Push — master ( 7007ea...286185 )
by Hannes
04:49
created

RawSource::getPages()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace iio\libmergepdf;
4
5
use setasign\Fpdi\PdfParser\StreamReader;
6
7
/**
8
 * Pdf source from raw string
9
 */
10
class RawSource implements SourceInterface
11
{
12
    /**
13
     * @var string
14
     */
15
    private $contents;
16
17
    /**
18
     * @var Pages
19
     */
20
    private $pages;
21
22
    /**
23
     * @param string $contents
24
     * @param Pages  $pages
25
     */
26
    public function __construct($contents, Pages $pages = null)
27
    {
28
        $this->contents = $contents;
29
        $this->pages = $pages ?: new Pages;
30
    }
31
32
    public function getName()
33
    {
34
        return "raw-content";
35
    }
36
37
    public function getStreamReader()
38
    {
39
        return StreamReader::createByString($this->contents);
40
    }
41
42
    public function getPages()
43
    {
44
        return $this->pages;
45
    }
46
}
47