/**
  * Prepare the input.
  *
  * @param array $arguments Contains the passed arguments
  *                         [0]  string    $name      Checkbox group's name.
  *                         [1]  Array[]   $elements  Array of checkbox elements. These must be PHP Arrays which all contain the ["id"] and ["name"] attributes (unless either "key" or "value" are redefined in the opts)
  *                         [2]  string[]  $opts      Contains the option="value" key-value pairs to be added to the field
  *                         [3]  Array[]   $values    Contains the elements that need to be checked (an is in array comparison is made)
  */
 public function prepare($arguments)
 {
     $name = $arguments[0];
     $elements = $arguments[1];
     $opts = $arguments[2];
     $values = $arguments[3];
     $values = (array) $values;
     $hKey = Arr::get($opts, 'key', 'id');
     $hValue = Arr::get($opts, 'value', 'name');
     Arr::remove('key', $opts);
     Arr::remove('value', $opts);
     $html = '';
     foreach ($elements as $element) {
         $html .= '<div class="checkbox">';
         $html .= '<label>';
         $html .= $element[$hValue];
         $checkbox = new Checkbox();
         $html .= $checkbox->prepare([$name, $element[$hKey], $opts, in_array($element[$hKey], $values)]);
         $html .= '</div>';
         $html .= '</label>';
     }
     return $html;
 }
 public function testCheckboxPrepare()
 {
     $control = new Checkbox();
     $expected = '<input type="checkbox" checked name="test" value="tested"  class="toaster">';
     $this->assertEquals($control->prepare(['test', 'tested', ['class' => 'toaster'], 'true']), $expected);
 }