Test Failed
Push — graphviz-refactoring ( 3f1b14 )
by Luis
02:18
created

plGraphvizProcessorOptions::__set()   B

Complexity

Conditions 5
Paths 6

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 8.8571
c 0
b 0
f 0
cc 5
eloc 9
nc 6
nop 2
1
<?php
2
3
class plGraphvizProcessorOptions extends plProcessorOptions 
4
{    
5
    public function __construct() 
6
    {
7
        $this->properties = array( 
8
            'style'                 =>  array( 
9
                'data'          => plGraphvizProcessorStyle::factory( 'default' ),
10
                'type'          => self::STRING,
11
                'description'   => 'Style to use for the dot creation'
12
            ),
13
            'createAssociations'    =>  array( 
14
                'data'          => true,
15
                'type'          => self::BOOL,
16
                'description'   => 'Create connections between classes that include each other. (This information can only be extracted if it is present in docblock comments)'
17
            ),
18
        );
19
    }
20
21
    public function __set( $key, $val ) 
22
    {
23
        switch( $key ) 
24
        {
25
            case 'style':
26
                $this->properties[$key]['data'] = plGraphvizProcessorStyle::factory( (string)$val );
27
            break;
28
            case 'createAssociations':
29
                $this->properties[$key]['data'] = ( $val === '0' || $val === 'false' ) ? false : true;
30
            break;
31
            default:
32
                throw new plProcessorOptionException( $key, plProcessorOptionException::WRITE );
33
        }
34
35
    }
36
}
37
38
?>
0 ignored issues
show
Best Practice introduced by
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...
39