hasKey() public method

Returns TRUE if $key is available.
public hasKey ( string $key ) : boolean
$key string
return boolean
 /**
  *
  * @param string $workspaceName
  * @return NodeInterface
  */
 protected function getLastVisitedNode($workspaceName)
 {
     if (!$this->session->isStarted() || !$this->session->hasKey('lastVisitedNode')) {
         return null;
     }
     try {
         $lastVisitedNode = $this->propertyMapper->convert($this->session->getData('lastVisitedNode'), NodeInterface::class);
         $q = new FlowQuery([$lastVisitedNode]);
         $lastVisitedNodeUserWorkspace = $q->context(['workspaceName' => $workspaceName])->get(0);
         return $lastVisitedNodeUserWorkspace;
     } catch (\Exception $exception) {
         return null;
     }
 }