public function buildObject($instance = null)
    {
        if (is_null($instance)) {
            return (object) $this->fields;
        }
        foreach ($this->fields as $property => $value) {
            $method = 'set' . ucwords($property);
            if (is_callable([$instance, $method])) {
                $instance->{$method}($value);
            }
        }
    }
public function buildObject($instance = null)
    {
        if (is_null($instance)) {
            return (object) $this->fields;
        }
        foreach ($this->fields as $property => $value) {
            $method = 'set' . ucwords($property);
            if (is_callable([$instance, $method])) {
                $instance->{$method}($value);
            }
        }
    }
public function buildObject ( $ instance = null ) { if ( is_null ( $ instance ) ) { return ( object ) $ this -> fields ; } foreach ( $ this -> fields as $ property => $ value ) { $ method = 'set' . ucwords ( $ property ) ; if ( is_callable ( [ $ instance , $ method ] ) ) { $ instance -> { $ method } ( $ value ) ; } } }
Tries to set values to the specified object using available setter
methods.

@param object $instance
Tries to set values to the specified object using available setter methods .