unwrapOne() public method

public unwrapOne ( mixed $argument ) : mixed
$argument mixed
return mixed
Example #1
0
 /**
  * @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]);
 }