public function unwrapOne($argument)
{
if (is_array($argument)) {
return array_map(array($this, 'unwrapOne'), $argument);
}
if (!is_object($argument)) {
return $argument;
}
if ($argument instanceof ObjectWrapper) {
return $argument->getWrappedObject();
}
if ($argument instanceof ProphecyInterface) {
$argument = $argument->reveal();
}
return $argument;
}
/** * @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); }