public function assign($vals)
    {
        if (count($vals) === 0) {
            return 0;
        }

        $n = 0;
        foreach ($vals as $k => $v) {
            if ($this->set($k, $v)) {
                $n++;
            }
        }

        return $n;
    }