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

DocumentFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A makeFromStream() 0 3 1
A makeFromPath() 0 3 1
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