| Conditions | 4 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 51 | public function set_model( $model ) |
||
| 52 | { |
||
| 53 | // Check that the required arguments are provided. |
||
| 54 | foreach( $this->required_arguments() as $key ) |
||
| 55 | { |
||
| 56 | if ( !isset($model[$key]) ) |
||
| 57 | { |
||
| 58 | throw new \RuntimeException('The required argument "'.$key.'" was not provided for '.get_called_class()); |
||
| 59 | } |
||
| 60 | } |
||
| 61 | |||
| 62 | // Assign the name of the component as the id if no id was specified |
||
| 63 | if( !isset($model['id']) ) |
||
| 64 | { |
||
| 65 | $model['id'] = $model['name']; |
||
| 66 | } |
||
| 67 | |||
| 68 | $this->model = array_merge( $this->default_model(), $model ); |
||
| 69 | } |
||
| 70 | |||
| 75 | } |