Bg::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 8
nc 2
nop 3
1
<?php
2
3
/*
4
 * This file is part of the ReportBundle package
5
 * 
6
 * (c) symball <http://simonball.me>
7
 * 
8
 * For the full copyright and license information, please view the LICENSE file 
9
 * that was distributed with this source code.
10
 */
11
12
/**
13
 * Set the background color for a cell
14
 *
15
 * @author Simon Ball <simonball at simonball dot me>
16
 */
17
18
namespace Symball\ReportBundle\Styles;
19
20
use Symball\ReportBundle\Service\ReportBuilder;
21
use Symball\ReportBundle\Interfaces\StyleInterface;
22
23
class Bg implements StyleInterface
24
{
25
26
    public function run(ReportBuilder &$context, $coordString, $options)
27
    {
28
        if (!isset($options['color'])) {
29
            $options['color'] = $options['default_bg_color'];
30
        }
31
32
        $context->sheet()
33
        ->getStyle($coordString)
34
        ->applyFromArray(['fill' => array(
35
            'type' => \PHPExcel_Style_Fill::FILL_SOLID,
36
        'color' => array('rgb' => $options['color']), )]);
37
    }
38
}
39