You are here

class RuntimePublicReflectionPropertyTestProxyMock in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/RuntimePublicReflectionPropertyTest.php \Doctrine\Tests\Common\Reflection\RuntimePublicReflectionPropertyTestProxyMock

Mock that simulates proxy public property lazy loading

Hierarchy

Expanded class hierarchy of RuntimePublicReflectionPropertyTestProxyMock

File

vendor/doctrine/common/tests/Doctrine/Tests/Common/Reflection/RuntimePublicReflectionPropertyTest.php, line 73

Namespace

Doctrine\Tests\Common\Reflection
View source
class RuntimePublicReflectionPropertyTestProxyMock implements Proxy {

  /**
   * @var \Closure|null
   */
  private $initializer = null;

  /**
   * @var \Closure|null
   */
  private $initialized = false;

  /**
   * @var string
   */
  public $checkedProperty = 'testValue';

  /**
   * {@inheritDoc}
   */
  public function __getInitializer() {
    return $this->initializer;
  }

  /**
   * {@inheritDoc}
   */
  public function __setInitializer(\Closure $initializer = null) {
    $this->initializer = $initializer;
  }

  /**
   * {@inheritDoc}
   */
  public function __getLazyProperties() {
  }

  /**
   * {@inheritDoc}
   */
  public function __load() {
  }

  /**
   * {@inheritDoc}
   */
  public function __isInitialized() {
    return $this->initialized;
  }

  /**
   * {@inheritDoc}
   */
  public function __setInitialized($initialized) {
    $this->initialized = (bool) $initialized;
  }

  /**
   * @param string $name
   */
  public function __get($name) {
    if ($this->initializer) {
      $cb = $this->initializer;
      $cb();
    }
    return $this->checkedProperty;
  }

  /**
   * @param string $name
   * @param mixed  $value
   */
  public function __set($name, $value) {
    if ($this->initializer) {
      $cb = $this->initializer;
      $cb();
    }

    // triggers notices if `$name` is used: see https://bugs.php.net/bug.php?id=63463
    $this->checkedProperty = $value;
  }

  /**
   * @param string $name
   *
   * @return integer
   */
  public function __isset($name) {
    if ($this->initializer) {
      $cb = $this->initializer;
      $cb();
    }
    return isset($this->checkedProperty);
  }

  /**
   * {@inheritDoc}
   */
  public function __setCloner(\Closure $cloner = null) {
  }

  /**
   * {@inheritDoc}
   */
  public function __getCloner() {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Proxy::MARKER constant Marker for Proxy class names.
Proxy::MARKER_LENGTH constant Length of the proxy marker.
RuntimePublicReflectionPropertyTestProxyMock::$checkedProperty public property
RuntimePublicReflectionPropertyTestProxyMock::$initialized private property
RuntimePublicReflectionPropertyTestProxyMock::$initializer private property
RuntimePublicReflectionPropertyTestProxyMock::__get public function
RuntimePublicReflectionPropertyTestProxyMock::__getCloner public function Retrieves the callback to be used when cloning the proxy. Overrides Proxy::__getCloner
RuntimePublicReflectionPropertyTestProxyMock::__getInitializer public function Retrieves the initializer callback used to initialize the proxy. Overrides Proxy::__getInitializer
RuntimePublicReflectionPropertyTestProxyMock::__getLazyProperties public function Retrieves the list of lazy loaded properties for a given proxy Overrides Proxy::__getLazyProperties
RuntimePublicReflectionPropertyTestProxyMock::__isInitialized public function Returns whether this proxy is initialized or not. Overrides Proxy::__isInitialized
RuntimePublicReflectionPropertyTestProxyMock::__isset public function
RuntimePublicReflectionPropertyTestProxyMock::__load public function Initializes this proxy if its not yet initialized. Overrides Proxy::__load
RuntimePublicReflectionPropertyTestProxyMock::__set public function
RuntimePublicReflectionPropertyTestProxyMock::__setCloner public function Sets the callback to be used when cloning the proxy. That initializer should accept a single parameter, which is the cloned proxy instance itself. Overrides Proxy::__setCloner
RuntimePublicReflectionPropertyTestProxyMock::__setInitialized public function Marks the proxy as initialized or not. Overrides Proxy::__setInitialized
RuntimePublicReflectionPropertyTestProxyMock::__setInitializer public function Sets the initializer callback to be used when initializing the proxy. That initializer should accept 3 parameters: $proxy, $method and $params. Those are respectively the proxy object that is being initialized, the method name that triggered… Overrides Proxy::__setInitializer