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

ColorMap::changeColor()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
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
0 ignored issues
show
Coding Style introduced by
The property $MAPPING_DEFAULT is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
24
{
25
    const COLOR_BG1 = 'bg1';
26
    const COLOR_BG2 = 'bg2';
27
    const COLOR_TX1 = 'tx1';
28
    const COLOR_TX2 = 'tx2';
29
    const COLOR_ACCENT1 = 'accent1';
30
    const COLOR_ACCENT2 = 'accent2';
31
    const COLOR_ACCENT3 = 'accent3';
32
    const COLOR_ACCENT4 = 'accent4';
33
    const COLOR_ACCENT5 = 'accent5';
34
    const COLOR_ACCENT6 = 'accent6';
35
    const COLOR_HLINK = 'hlink';
36
    const COLOR_FOLHLINK = 'folHlink';
37
38
    /**
39
     * Mapping - Stores the mapping betweenSlide and theme
40
     *
41
     * @var array
42
     */
43
    protected $mapping = array();
44
45
    public static $MAPPING_DEFAULT = array(
46
        self::COLOR_BG1 => 'lt1',
47
        self::COLOR_TX1 => 'dk1',
48
        self::COLOR_BG2 => 'lt2',
49
        self::COLOR_TX2 => 'dk2',
50
        self::COLOR_ACCENT1 => 'accent1',
51
        self::COLOR_ACCENT2 => 'accent2',
52
        self::COLOR_ACCENT3 => 'accent3',
53
        self::COLOR_ACCENT4 => 'accent4',
54
        self::COLOR_ACCENT5 => 'accent5',
55
        self::COLOR_ACCENT6 => 'accent6',
56
        self::COLOR_HLINK => 'hlink',
57
        self::COLOR_FOLHLINK => 'folHlink'
58
    );
59
60
    /**
61
     * ColorMap constructor.
62
     * Create a new ColorMap with standard values
63
     */
64
    public function __construct()
0 ignored issues
show
Coding Style Naming introduced by
The variable $MAPPING_DEFAULT is not named in camelCase.

This check marks variable names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
65
    {
66
        $this->mapping = self::$MAPPING_DEFAULT;
67
    }
68
69
    /**
70
     * Change the color of one of the elements in the map
71
     *
72
     * @param string $item
73
     * @param string $newThemeColor
74
     */
75
    public function changeColor($item, $newThemeColor)
76
    {
77
        $this->mapping[$item] = $newThemeColor;
78
    }
79
80
    /**
81
     * Store a new map. For use with the reader
82
     *
83
     * @param array $arrayMapping
84
     */
85
    public function setMapping(array $arrayMapping = array())
86
    {
87
        $this->mapping = $arrayMapping;
88
    }
89
90
    /**
91
     * Get the whole mapping as an array
92
     *
93
     * @return array
94
     */
95
    public function getMapping()
96
    {
97
        return $this->mapping;
98
    }
99
}
100