// +---------------------------------------------------------------------- namespace crmeb\form\components; use crmeb\form\BaseComponent; use crmeb\form\BuildInterface; /** * 选择地址 * Class Addres * @package crmeb\form\components */ class Addres extends BaseComponent implements BuildInterface { const NAME = 'addres'; /** * @var string[] */ protected $rule = [ 'title' => '', 'field' => '', 'value' => '', 'info' => '', ]; /** * Map constructor. * @param string $field * @param string $title * @param array $value */ public function __construct(string $field, string $title, array $value = null) { $this->rule['field'] = $field; $this->rule['title'] = $title; $this->rule['value'] = empty($value) ? '' : $value; } /** * @param string $info * @return $this */ public function info(string $info) { $this->rule['info'] = $info; return $this; } /** * @return array|string[] */ public function toArray(): array { $this->rule['name'] = self::NAME; $this->before(); return $this->rule; } }