PhpSpec\Wrapper\Subject\Caller::set PHP Метод

set() публичный Метод

public set ( string $property, mixed $value = null ) : mixed
$property string
$value mixed
Результат mixed
    public function set($property, $value = null)
    {
        if (null === $this->getWrappedObject()) {
            throw $this->settingPropertyOnNonObject($property);
        }
        $unwrapper = new Unwrapper();
        $value = $unwrapper->unwrapOne($value);
        if ($this->isObjectPropertyWritable($property)) {
            return $this->getWrappedObject()->{$property} = $value;
        }
        throw $this->propertyNotFound($property);
    }

Usage Example

Пример #1
0
 /**
  * @param string $property
  * @param mixed  $value
  *
  * @return mixed
  */
 public function __set($property, $value = null)
 {
     return $this->caller->set($property, $value);
 }