public function testUnique() { is(15, strlen(Str::unique())); is(8, strlen(Str::unique(null))); is(10, strlen(Str::unique('t-'))); isNotSame(Str::unique(), Str::unique()); }
/** * Generates an HTML checkbox/radio list. * * @param array $options * @param string $name * @param array $selected * @param string|array $attrs * @param bool $tpl * @return string */ public function render(array $options, $name, $selected = array(), array $attrs = array(), $tpl = false) { $output = array(); $this->_setTpl($tpl); foreach ($options as $value => $label) { $label = trim($label); $id = Str::unique($this->_type . '-'); $value = $this->_cleanValue($value); $text = $this->_translate($label); $attrs = $this->_checkedOptions($value, $selected, $attrs); $output[] = $this->_elementTpl($name, $value, $id, $text, $attrs); } return implode(PHP_EOL, $output); }