You are here

public function LazyDouble::getInstance in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php \Prophecy\Doubler\LazyDouble::getInstance()

Creates double instance or returns already created one.

Return value

DoubleInterface

File

vendor/phpspec/prophecy/src/Prophecy/Doubler/LazyDouble.php, line 113

Class

LazyDouble
Lazy double. Gives simple interface to describe double before creating it.

Namespace

Prophecy\Doubler

Code

public function getInstance() {
  if (null === $this->double) {
    if (null !== $this->arguments) {
      return $this->double = $this->doubler
        ->double($this->class, $this->interfaces, $this->arguments);
    }
    $this->double = $this->doubler
      ->double($this->class, $this->interfaces);
  }
  return $this->double;
}