You are here

public function NameGenerator::name in Zircon Profile 8.0

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

Generates name.

Parameters

ReflectionClass $class:

ReflectionClass[] $interfaces:

Return value

string

File

vendor/phpspec/prophecy/src/Prophecy/Doubler/NameGenerator.php, line 34

Class

NameGenerator
Name generator. Generates classname for double.

Namespace

Prophecy\Doubler

Code

public function name(ReflectionClass $class = null, array $interfaces) {
  $parts = array();
  if (null !== $class) {
    $parts[] = $class
      ->getName();
  }
  else {
    foreach ($interfaces as $interface) {
      $parts[] = $interface
        ->getShortName();
    }
  }
  if (!count($parts)) {
    $parts[] = 'stdClass';
  }
  return sprintf('Double\\%s\\P%d', implode('\\', $parts), self::$counter++);
}