Gpf_Rpc_Params::getSessionId PHP Method

getSessionId() public method

public getSessionId ( )
        public function getSessionId()
        {
            $sessionId = $this->get(self::SESSION_ID);
            if ($sessionId === null || strlen(trim($sessionId)) == 0) {
                Gpf_Session::create(new Gpf_ApiModule());
            }
            return $sessionId;
        }

Usage Example

 function __construct(Gpf_Rpc_Params $params)
 {
     $this->methodName = $params->getMethod();
     $this->className = $params->getClass();
     $reflectionClass = new ReflectionClass($this->className);
     $reflectionMethod = $reflectionClass->getMethod($this->methodName);
     if (!$reflectionMethod->isPublic()) {
         throw new Gpf_Exception($this->className . '->' . $this->methodName . '() is not a service method (not public)');
     }
     $this->annotations = new Gpf_Rpc_Annotation($reflectionMethod);
     if (!$this->annotations->hasServiceAnnotation()) {
         throw new Gpf_Exception($this->className . '->' . $this->methodName . '() is not a service method (annotation)');
     }
     $this->initSession($params->getSessionId());
     $this->createInstance();
 }