static function fromArray($array) { $res = new OAuth2(); foreach ($res as $key => &$value) { $val = $array[$key]; if (isset($val)) { $value = $val; } } $res->putToSession(); return $res; }