public function id($id = null)
    {
        if ($id) {
            if (!$this->isValidId($id)) {
                throw new \InvalidArgumentException('$id may contain only [a-zA-Z0-9-_]');
            }
            if ($this->id) {
                throw new Exception('Cannot set id while session is active');
            }
            $this->requestedId = $id;
        }
        return $this->id;
    }
public function id($id = null)
    {
        if ($id) {
            if (!$this->isValidId($id)) {
                throw new \InvalidArgumentException('$id may contain only [a-zA-Z0-9-_]');
            }
            if ($this->id) {
                throw new Exception('Cannot set id while session is active');
            }
            $this->requestedId = $id;
        }
        return $this->id;
    }
public function id ( $ id = null ) { if ( $ id ) { if ( ! $ this -> isValidId ( $ id ) ) { throw new \ InvalidArgumentException ( '$id may contain only [a-zA-Z0-9-_]' ) ; } if ( $ this -> id ) { throw new Exception ( 'Cannot set id while session is active' ) ; } $ this -> requestedId = $ id ; } return $ this -> id ; }
Get the session ID, or request an ID to be used when the session begins.

@param string $id Requested session id. May contain only [a-zA-Z0-9-_]

@return string ('' means there is no active session)

@throws \InvalidArgumentException|Exception
Get the session ID or request an ID to be used when the session begins .