Auth_Yadis_SessionLoader::fromSession PHP Method

fromSession() public method

Given a session data value (an array), this creates an object (returned by $this->newObject()) whose attributes and values are those in $data. Returns null if $data lacks keys found in $this->requiredKeys(). Returns null if $this->check($data) evaluates to false. Returns null if $this->newObject() evaluates to false.
public fromSession ( $data )
    function fromSession($data)
    {
        if (!$data) {
            return null;
        }
        $required = $this->requiredKeys();
        foreach ($required as $k) {
            if (!array_key_exists($k, $data)) {
                return null;
            }
        }
        if (!$this->check($data)) {
            return null;
        }
        $data = array_merge($data, $this->prepareForLoad($data));
        $obj = $this->newObject($data);
        if (!$obj) {
            return null;
        }
        foreach ($required as $k) {
            $obj->{$k} = $data[$k];
        }
        return $obj;
    }