| Conditions | 4 |
| Paths | 4 |
| Total Lines | 12 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function normalize( array $attributes ) |
||
| 21 | { |
||
| 22 | if( !isset( $attributes['assigned_to'] )) { |
||
| 23 | return $attributes; |
||
| 24 | } |
||
| 25 | if( $attributes['assigned_to'] == 'post_id' ) { |
||
| 26 | $attributes['assigned_to'] = $attributes['post_id']; |
||
| 27 | } |
||
| 28 | else if( $attributes['assigned_to'] == 'parent_id' ) { |
||
| 29 | $attributes['assigned_to'] = wp_get_post_parent_id( $attributes['post_id'] ); |
||
| 30 | } |
||
| 31 | return $attributes; |
||
| 32 | } |
||
| 54 |