PhpSpec\Wrapper\Subject\Caller::get PHP Method

get() public method

public get ( string $property ) : Subject | string
$property string
return PhpSpec\Wrapper\Subject | string
    public function get($property)
    {
        if ($this->lookingForConstants($property) && $this->constantDefined($property)) {
            return constant($this->wrappedObject->getClassName() . '::' . $property);
        }
        if (null === $this->getWrappedObject()) {
            throw $this->accessingPropertyOnNonObject($property);
        }
        if ($this->isObjectPropertyReadable($property)) {
            return $this->wrap($this->getWrappedObject()->{$property});
        }
        throw $this->propertyNotFound($property);
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param string $property
  *
  * @return string|Subject
  */
 public function __get($property)
 {
     return $this->caller->get($property);
 }