public function staticHandle($class)
{
if ($class instanceof StaticHandle) {
return $class;
}
if ($class instanceof Handle) {
$class = $class->clazz();
} elseif ($class instanceof Mock) {
$class = new ReflectionClass($class);
} elseif (is_string($class)) {
try {
$class = new ReflectionClass($class);
} catch (ReflectionException $e) {
throw new NonMockClassException($class, $e);
}
} elseif (!$class instanceof ReflectionClass) {
throw new InvalidMockClassException($class);
}
if (!$class->isSubclassOf('Eloquent\\Phony\\Mock\\Mock')) {
throw new NonMockClassException($class->getName());
}
$handleProperty = $class->getProperty('_staticHandle');
$handleProperty->setAccessible(true);
if ($handle = $handleProperty->getValue(null)) {
return $handle;
}
$handle = new StaticHandle($class, (object) array('defaultAnswerCallback' => 'Eloquent\\Phony\\Stub\\StubData::forwardsAnswerCallback', 'stubs' => (object) array(), 'isRecording' => true), $this->stubFactory, $this->stubVerifierFactory, $this->assertionRenderer, $this->assertionRecorder, $this->invoker);
$handleProperty->setValue(null, $handle);
return $handle;
}