| Conditions | 3 |
| Paths | 1 |
| Total Lines | 17 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 12 |
| Changes | 0 | ||
| 1 | <?php |
||
| 53 | protected function setProperties( WP_Post $post ) |
||
| 54 | { |
||
| 55 | $defaults = [ |
||
| 56 | 'author' => __( 'Anonymous', 'site-reviews' ), |
||
| 57 | 'date' => '', |
||
| 58 | 'review_id' => '', |
||
| 59 | 'review_type' => '', |
||
| 60 | ]; |
||
| 61 | $meta = array_filter( |
||
| 62 | array_map( 'array_shift', (array)get_post_meta( $post->ID )), |
||
| 63 | 'strlen' |
||
| 64 | ); |
||
| 65 | $properties = glsr( CreateReviewDefaults::class )->restrict( array_merge( $defaults, $meta )); |
||
| 66 | $this->modified = $this->isModified( $properties ); |
||
| 67 | array_walk( $properties, function( $value, $key ) { |
||
| 68 | if( !property_exists( $this, $key ) || isset( $this->$key ))return; |
||
| 69 | $this->$key = $value; |
||
| 70 | }); |
||
| 73 |