| Conditions | 6 | 
| Paths | 8 | 
| Total Lines | 24 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | <?php | ||
| 15 |   public function expand($values) { | ||
| 16 | $result = []; | ||
| 17 | $values = (array) $values; | ||
| 18 |     foreach ($values as $entry) { | ||
| 19 |       $terms = explode(',', $entry); | ||
| 20 |       foreach ($terms as $term) { | ||
| 21 | // Try to split things out in order to find optional specified vocabs. | ||
| 22 | $term_name_or_tid = ''; | ||
| 23 |         $parts = explode(':', $term); | ||
| 24 |         if (count($parts) == 1) { | ||
| 25 | $term_name_or_tid = $term; | ||
| 26 | } | ||
| 27 |         elseif (count($parts) == 2) { | ||
| 28 | $term_name_or_tid = $term; | ||
| 29 | } | ||
| 30 |         if ($term_list = taxonomy_get_term_by_name($term_name_or_tid)) { | ||
| 31 | $term = reset($term_list); | ||
| 32 | $result[] = $term; | ||
| 33 | } | ||
| 34 | } | ||
| 35 | } | ||
| 36 | |||
| 37 | return $result; | ||
| 38 | } | ||
| 39 | |||
| 41 |