/**
  * Create an instance of the mock object of the given mock class.
  *
  * @param \Box\TestScribe\Mock\MockClass $mock
  * @param array                               $arguments
  *  Arguments to the constructor
  *
  * @return object
  */
 public function createMockObjectFromMockClass(MockClass $mock, array $arguments)
 {
     $mockClassName = $mock->getMockClassName();
     $reflectionClass = new \ReflectionClass($mockClassName);
     array_unshift($arguments, $mock);
     $obj = $reflectionClass->newInstanceArgs($arguments);
     if (!$obj) {
         throw new \RuntimeException("Can't instantiate mock class ( {$mockClassName} ).");
     }
     return $obj;
 }
 /**
  * Create and load a class dynamically that is associated 1 to 1
  * to the given MockClass instance.
  * Used for static invocation only.
  * The class name is the same as the mock object name.
  *
  * @param MockClass $mock
  *
  * @return void
  */
 public function create($mock)
 {
     // The mock object name is unique.
     $className = $mock->getMockObjectName();
     $this->createAndLoadDynamicClass($className);
     // The dynamically generated class uses MockTraitStatic
     // which supports setMockInstance method.
     // This allows a static method invocation to be associated
     // with a unique instance of MockClass.
     /** @noinspection PhpUndefinedMethodInspection */
     $className::setMockInstance($mock);
 }