public static function getOptions($data, $key, $value) {
    $options = [];
    if (empty($data) && !is_array($data)) {
      return [];
    }

    foreach ($data as $item) {
      $options[$item->$key] = $item->$value;
    }

    return $options;
  }
public static function getOptions($data, $key, $value) {
    $options = [];
    if (empty($data) && !is_array($data)) {
      return [];
    }

    foreach ($data as $item) {
      $options[$item->$key] = $item->$value;
    }

    return $options;
  }
public static function getOptions ( $ data , $ key , $ value ) { $ options = [ ] ; if ( empty ( $ data ) && ! is_array ( $ data ) ) { return [ ] ; } foreach ( $ data as $ item ) { $ options [ $ item -> $ key ] = $ item -> $ value ; } return $ options ; }
Get form item options.

@param array|null $data
Data to iterate, or NULL.
@param string $key
Key name.
@param string $value
Value name.

@return array
Array of options.
Get form item options .