Completed
Push — master ( 6067ed...20b4bf )
by Julien
11s
created

DocumentFactory::makeFromStream()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace TheCodingMachine\Gotenberg;
4
5
use GuzzleHttp\Psr7\LazyOpenStream;
6
use Psr\Http\Message\StreamInterface;
7
8
class DocumentFactory
9
{
10
    /**
11
     * @param string $fileName
12
     * @param string $filePath
13
     * @return Document
14
     */
15
    public static function makeFromPath(string $fileName, string $filePath): Document
16
    {
17
        return new Document($fileName, new LazyOpenStream($filePath, 'r'));
18
    }
19
20
    /**
21
     * @param string $fileName
22
     * @param StreamInterface $fileStream
23
     * @return Document
24
     */
25
    public static function makeFromStream(string $fileName, StreamInterface $fileStream): Document
26
    {
27
        return new Document($fileName, $fileStream);
28
    }
29
}
30