src/classes/Slion/Meta/Base.php
public function fill($data, $excludes = []) {
        if (!is_array($data) && !is_object($data)) {
            throw new \InvalidArgumentException("fill data error");
        }

        $fields = $this->getDefault();
        if ($excludes) {
            foreach ($excludes as $name) {
                unset($fields[$name]);
            }
        }
        foreach ($fields as $name => $default) {
            isset($data[$name]) && $this->$name = $data[$name];
        }
        return $this;
    }
public function fill($data, $excludes = []) {
        if (!is_array($data) && !is_object($data)) {
            throw new \InvalidArgumentException("fill data error");
        }

        $fields = $this->getDefault();
        if ($excludes) {
            foreach ($excludes as $name) {
                unset($fields[$name]);
            }
        }
        foreach ($fields as $name => $default) {
            isset($data[$name]) && $this->$name = $data[$name];
        }
        return $this;
    }
public function fill ( $ data , $ excludes = [ ] ) { if ( ! is_array ( $ data ) && ! is_object ( $ data ) ) { throw new \ InvalidArgumentException ( "fill data error" ) ; } $ fields = $ this -> getDefault ( ) ; if ( $ excludes ) { foreach ( $ excludes as $ name ) { unset ( $ fields [ $ name ] ) ; } } foreach ( $ fields as $ name => $ default ) { isset ( $ data [ $ name ] ) && $ this -> $ name = $ data [ $ name ] ; } return $ this ; }
填充数据
@param array|self $data
@param array $excludes
@return self
填充数据