$i) { if (! isset($tokens_values[$token])) { continue; } $value = $tokens_values[$token]; // convert an array to a CSV string if (is_array($value)) { $value = '"' . implode('", "', $value) . '"'; } $values[$i] = $value; } $formatter = new MessageFormatter($locale, $string); if (! $formatter) { throw new Exception\CannotInstantiateFormatter( intl_get_error_message(), intl_get_error_code() ); } $result = $formatter->format($values); if ($result === false) { throw new Exception\CannotFormat( $formatter->getErrorMessage(), $formatter->getErrorCode() ); } return $result; } }