phpmock\MockRegistry::getInstance PHP Метод

getInstance() публичный статический Метод

Returns the singleton.
public static getInstance ( ) : MockRegistry
Результат MockRegistry The singleton.
    public static function getInstance()
    {
        if (empty(self::$instance)) {
            self::$instance = new self();
        }
        return self::$instance;
    }

Usage Example

Пример #1
0
 /**
  * Calls the enabled mock, or the built-in function otherwise.
  *
  * @param string $functionName The function name.
  * @param string $fqfn         The fully qualified function name.
  * @param array  $arguments    The arguments.
  *
  * @return mixed The result of the called function.
  * @see Mock::define()
  * @SuppressWarnings(PHPMD)
  */
 public static function call($functionName, $fqfn, &$arguments)
 {
     $registry = MockRegistry::getInstance();
     $mock = $registry->getMock($fqfn);
     self::removeDefaultArguments($arguments);
     if (empty($mock)) {
         // call the built-in function if the mock was not enabled.
         return call_user_func_array($functionName, $arguments);
     } else {
         // call the mock function.
         return $mock->call($arguments);
     }
 }
All Usage Examples Of phpmock\MockRegistry::getInstance