4 * This file is part of the Prophecy.
5 * (c) Konstantin Kudryashov <ever.zet@gmail.com>
6 * Marcello Duarte <marcello.duarte@gmail.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Prophecy\Doubler;
18 * Generates classname for double.
20 * @author Konstantin Kudryashov <ever.zet@gmail.com>
24 private static $counter = 1;
29 * @param ReflectionClass $class
30 * @param ReflectionClass[] $interfaces
34 public function name(ReflectionClass $class = null, array $interfaces)
38 if (null !== $class) {
39 $parts[] = $class->getName();
41 foreach ($interfaces as $interface) {
42 $parts[] = $interface->getShortName();
47 $parts[] = 'stdClass';
50 return sprintf('Double\%s\P%d', implode('\\', $parts), self::$counter++);