PhpSpec\Wrapper\Subject\SubjectWithArrayAccess::offsetGet PHP Method

offsetGet() public method

public offsetGet ( string | integer $key ) : mixed
$key string | integer
return mixed
    public function offsetGet($key)
    {
        $unwrapper = new Unwrapper();
        $subject = $this->caller->getWrappedObject();
        $key = $unwrapper->unwrapOne($key);
        $this->checkIfSubjectImplementsArrayAccess($subject);
        return $subject[$key];
    }

Usage Example

Example #1
0
 /**
  * @param string|integer $key
  *
  * @return Subject
  */
 public function offsetGet($key)
 {
     return $this->wrap($this->arrayAccess->offsetGet($key));
 }