| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 0 | ||
| 1 | <?php |
||
| 95 | 1 | function options() { |
|
| 96 | |||
| 97 | $args = [ |
||
| 98 | 1 | 'color' => $this->color(), |
|
| 99 | 1 | 'fontFamily' => $this->font_family(), |
|
| 100 | 1 | 'fontSize' => $this->font_size(), |
|
| 101 | 1 | 'fontWeight' => $this->font_weight(), |
|
| 102 | 1 | 'text' => $this->text(), |
|
| 103 | ]; |
||
| 104 | |||
| 105 | 1 | $args = array_filter( $args, function( $value ) { |
|
| 106 | 1 | return ! is_null( $value ); |
|
| 107 | 1 | } ); |
|
| 108 | |||
| 109 | if ( empty( $args['text'] ) ) { |
||
| 110 | $args = ''; |
||
| 111 | } |
||
| 112 | |||
| 113 | return $args; |
||
| 114 | |||
| 115 | } |
||
| 116 | |||
| 118 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.