Completed
Pull Request — develop (#195)
by Franck
07:42
created

AbstractWriter::setPhpPresentation()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 9.4285
cc 1
eloc 3
nc 1
nop 1
crap 1
1
<?php
2
3
namespace PhpOffice\PhpPresentation\Writer;
4
5
use PhpOffice\Common\Adapter\Zip\ZipInterface;
6
use PhpOffice\PhpPresentation\PhpPresentation;
7
8
abstract class AbstractWriter
9
{
10
    /**
11
     * Private unique hash table
12
     *
13
     * @var \PhpOffice\PhpPresentation\HashTable
14
     */
15
    protected $oDrawingHashTable;
16
17
    /**
18
     * Private PhpPresentation
19
     *
20
     * @var PhpPresentation
21
     */
22
    protected $oPresentation;
23
24
    /**
25
     * @var ZipInterface
26
     */
27
    protected $oZipAdapter;
28
29
    /**
30
     * Get drawing hash table
31
     *
32
     * @return \PhpOffice\PhpPresentation\HashTable
33
     */
34 151
    public function getDrawingHashTable()
35
    {
36 151
        return $this->oDrawingHashTable;
37
    }
38
39
    /**
40
     * Get PhpPresentation object
41
     *
42
     * @return PhpPresentation
43
     * @throws \Exception
44
     */
45 161
    public function getPhpPresentation()
46
    {
47 161
        if (empty($this->oPresentation)) {
48 5
            throw new \Exception("No PhpPresentation assigned.");
49
        }
50 156
        return $this->oPresentation;
51
    }
52
53
    /**
54
     * Get PhpPresentation object
55
     *
56
     * @param  PhpPresentation                       $pPhpPresentation PhpPresentation object
57
     * @throws \Exception
58
     * @return \PhpOffice\PhpPresentation\Writer\ODPresentation
59
     */
60 170
    public function setPhpPresentation(PhpPresentation $pPhpPresentation = null)
61
    {
62 170
        $this->oPresentation = $pPhpPresentation;
63 170
        return $this;
64
    }
65
66
67
    /**
68
     * @param ZipInterface $oZipAdapter
69
     * @return $this
70
     */
71 171
    public function setZipAdapter(ZipInterface $oZipAdapter)
72
    {
73 171
        $this->oZipAdapter = $oZipAdapter;
74 171
        return $this;
75
    }
76
77
    /**
78
     * @return ZipInterface
79
     */
80 154
    public function getZipAdapter()
81
    {
82 154
        return $this->oZipAdapter;
83
    }
84
}
85