/** * @param string $property * @param mixed $value * * @return mixed * * @throws \PhpSpec\Exception\Wrapper\SubjectException * @throws \PhpSpec\Exception\Fracture\PropertyNotFoundException */ public function set($property, $value = null) { if (null === $this->getWrappedObject()) { throw $this->settingPropertyOnNonObject($property); } $unwrapper = new Unwrapper(); $value = $unwrapper->unwrapOne($value); if ($this->isObjectPropertyAccessible($property, true)) { return $this->getWrappedObject()->{$property} = $value; } throw $this->propertyNotFound($property); }
/** * @param string|integer $key */ public function offsetUnset($key) { $unwrapper = new Unwrapper(); $subject = $this->caller->getWrappedObject(); $key = $unwrapper->unwrapOne($key); $this->checkIfSubjectImplementsArrayAccess($subject); unset($subject[$key]); }