Updated from some -dev modules to alpha, beta or full releases
[yaffs-website] / vendor / psy / psysh / src / Context.php
index 41e0f64df1b2e944e0eddfd17c99423dafb51e53..c0e58e89b17f246d1bcf8ba9d8f9a68bf19d11d1 100644 (file)
@@ -33,6 +33,7 @@ class Context
     private $lastException;
     private $lastStdout;
     private $boundObject;
+    private $boundClass;
 
     /**
      * Get a context variable.
@@ -221,11 +222,14 @@ class Context
     /**
      * Set the bound object ($this variable) for the interactive shell.
      *
+     * Note that this unsets the bound class, if any exists.
+     *
      * @param object|null $boundObject
      */
     public function setBoundObject($boundObject)
     {
         $this->boundObject = is_object($boundObject) ? $boundObject : null;
+        $this->boundClass = null;
     }
 
     /**
@@ -238,6 +242,29 @@ class Context
         return $this->boundObject;
     }
 
+    /**
+     * Set the bound class (self) for the interactive shell.
+     *
+     * Note that this unsets the bound object, if any exists.
+     *
+     * @param string|null $boundClass
+     */
+    public function setBoundClass($boundClass)
+    {
+        $this->boundClass = (is_string($boundClass) && $boundClass !== '') ? $boundClass : null;
+        $this->boundObject = null;
+    }
+
+    /**
+     * Get the bound class (self) for the interactive shell.
+     *
+     * @return string|null
+     */
+    public function getBoundClass()
+    {
+        return $this->boundClass;
+    }
+
     /**
      * Set command-scope magic variables: $__class, $__file, etc.
      *