Width::run()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 14
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
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 width of a given 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 Width implements StyleInterface
24
{
25
    
26
    public function run(ReportBuilder &$context, $coordString, $options) {
27
        
28
        switch ($options['type']) {
29
        case 'auto':
30
          $context->sheet()
31
          ->getColumnDimension($coordString)
32
          ->setAutoSize(true);
33
          break;
34
35
        default:
36
          throw new \Exception('Unrecognised style width option: '.$options['type']);
37
          break;
0 ignored issues
show
Unused Code introduced by
break; does not seem to be reachable.

This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed.

Unreachable code is most often the result of return, die or exit statements that have been added for debug purposes.

function fx() {
    try {
        doSomething();
        return true;
    }
    catch (\Exception $e) {
        return false;
    }

    return false;
}

In the above example, the last return false will never be executed, because a return statement has already been met in every possible execution path.

Loading history...
38
      }
39
    }
40
}
41