| Conditions | 7 |
| Paths | 10 |
| Total Lines | 26 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 15 | protected function import($data) { |
||
| 16 | |||
| 17 | if ( is_object( $data ) ) { |
||
| 18 | |||
| 19 | $data = get_object_vars( $data ); |
||
| 20 | |||
| 21 | } |
||
| 22 | |||
| 23 | if ( is_array( $data ) ) { |
||
| 24 | |||
| 25 | foreach ( $data as $key => $value ) { |
||
| 26 | |||
| 27 | if ( !empty( $key ) ) { |
||
| 28 | |||
| 29 | $this->$key = $value; |
||
| 30 | |||
| 31 | } else if ( !empty( $key ) && !method_exists($this, $key) ){ |
||
| 32 | |||
| 33 | $this->$key = $value; |
||
| 34 | |||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 38 | } |
||
| 39 | |||
| 40 | } |
||
| 41 | |||
| 42 | } |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.