getAndWrap() public method

Get a value by path and wrap it into another context
public getAndWrap ( string $path = null ) : Context
$path string
return Context The wrapped value
 /**
  * Get a value by path and wrap it into another context
  *
  * The whitelist for the given path is applied to the new context.
  *
  * @param string $path
  * @return Context The wrapped value
  */
 public function getAndWrap($path = null)
 {
     // There are some cases where the $path is a ProtectedContext, especially when doing s.th. like
     // foo()[myOffset]. In this case we need to unwrap it.
     if ($path instanceof ProtectedContext) {
         $path = $path->unwrap();
     }
     $context = parent::getAndWrap($path);
     if ($context instanceof ProtectedContext && isset($this->whitelist[$path]) && is_array($this->whitelist[$path])) {
         $context->whitelist = $this->whitelist[$path];
     }
     return $context;
 }