| Conditions | 6 |
| Paths | 6 |
| Total Lines | 19 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 8.048 |
| Changes | 0 | ||
| 1 | <?php |
||
| 41 | 38 | public function set_value($value) |
|
| 42 | { |
||
| 43 | 38 | if ($this->config['type'] === 'urlname') { |
|
| 44 | |||
| 45 | 2 | if (empty($value)) { |
|
| 46 | 1 | $title_field = (!empty($this->config['type_config']['title_field'])) ? $this->config['type_config']['title_field'] : 'title'; |
|
| 47 | 1 | $value = midcom_helper_misc::urlize($this->object->{$title_field}); |
|
| 48 | 1 | } elseif (!empty($this->config['type_config']['allow_catenate'])) { |
|
| 49 | $copy = clone $this->object; |
||
| 50 | $copy->{$this->config['storage']['location']} = $value; |
||
| 51 | $resolver = new midcom_helper_reflector_nameresolver($copy); |
||
| 52 | if (!$resolver->name_is_unique()) { |
||
| 53 | $value = $resolver->generate_unique_name(); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 57 | |||
| 58 | 38 | $this->set = true; |
|
| 59 | 38 | $this->object->{$this->config['storage']['location']} = $value; |
|
| 60 | 38 | } |
|
| 66 |