code: public function toArray(bool $not_null = false): array {
          $arr = [];
          foreach ($this->getDefault() as $name => $default) {
              if (isset($this->$name)) {
                  if (is_object($this->$name)) {
                      $object = $this->$name;
                      $value  = method_exists($object, 'toArray') ?
                          $object->toArray() : $object;
                  } else {
                      $value  = $this->$name;
                  }
              } else {
                  $value  = $default;
              }
              if ($value === null && $not_null) {
                  continue;
              }
              $arr[$name] = $value;
          }
          return $arr;
      }
docs: 转换到数组
  @param bool $not_null
  @return array