Completed
Pull Request — develop (#230)
by Franck
07:45
created

ColorMap::setNewMapping()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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 4
ccs 3
cts 3
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * This file is part of PHPPresentation - A pure PHP library for reading and writing
4
 * presentations documents.
5
 *
6
 * PHPPresentation is free software distributed under the terms of the GNU Lesser
7
 * General Public License version 3 as published by the Free Software Foundation.
8
 *
9
 * For the full copyright and license information, please read the LICENSE
10
 * file that was distributed with this source code. For the full list of
11
 * contributors, visit https://github.com/PHPOffice/PHPPresentation/contributors.
12
 *
13
 * @link        https://github.com/PHPOffice/PHPPresentation
14
 * @copyright   2009-2015 PHPPresentation contributors
15
 * @license     http://www.gnu.org/licenses/lgpl.txt LGPL version 3
16
 */
17
18
namespace PhpOffice\PhpPresentation\Style;
19
20
/**
21
 * PhpOffice\PhpPresentation\Style\ColorMap
22
 */
23
class ColorMap
24
{
25
    /**
26
     * Mapping - Stores the mapping betweenSlide and theme
27
     *
28
     * @var array
29
     */
30
    protected $mapping = array();
31
32
    /**
33
     * ColorMap constructor.
34
     * Create a new ColorMap with standard values
35
     */
36 191
    public function __construct()
37
    {
38 191
        $this->mapping = array("bg1" => "lt1",
39 191
            "tx1" => "dk1",
40 191
            "bg2" => "lt2",
41 191
            "tx2" => "dk2",
42 191
            "accent1" => "accent1",
43 191
            "accent2" => "accent2",
44 191
            "accent3" => "accent3",
45 191
            "accent4" => "accent4",
46 191
            "accent5" => "accent5",
47 191
            "accent6" => "accent6",
48 191
            "hlink" => "hlink",
49 191
            "folHlink" => "folHlink");
50 191
    }
51
52
    /**
53
     * Change the color of one of the elements in the map
54
     *
55
     * @param string $item
56
     * @param string $newThemeColor
57
     */
58
    public function changeColor($item, $newThemeColor)
59
    {
60
        $this->mapping[$item] = $newThemeColor;
61
    }
62
63
    /**
64
     * Store a new map. For use with the reader
65
     *
66
     * @param $newMappingArray
67
     */
68 3
    public function setNewMapping($newMappingArray)
69
    {
70 3
        $this->mapping = $newMappingArray;
71 3
    }
72
73
    /**
74
     * Get the whole mapping as an array
75
     *
76
     * @return array
77
     */
78 95
    public function getMapping()
79
    {
80 95
        return $this->mapping;
81
    }
82
}
83