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

AbstractWriter   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 6
c 2
b 0
f 0
lcom 1
cbo 0
dl 0
loc 77
ccs 14
cts 14
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getDrawingHashTable() 0 4 1
A getPhpPresentation() 0 7 2
A setPhpPresentation() 0 5 1
A setZipAdapter() 0 5 1
A getZipAdapter() 0 4 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