src/Mock/MockGenerator.php
public function generateClassName(MockDefinition $definition): string
    {
        $className = $definition->className();

        if ('' !== $className) {
            return $className;
        }

        $className = 'PhonyMock';
        $parentClassName = $definition->parentClassName();

        if ('' !== $parentClassName) {
            $subject = $parentClassName;
        } elseif ($interfaceNames = $definition->interfaceNames()) {
            $subject = $interfaceNames[0];
        } elseif ($traitNames = $definition->traitNames()) {
            $subject = $traitNames[0];
        } else {
            $subject = null;
        }

        if (null !== $subject) {
            $subjectAtoms = preg_split('/[_\\\\]/', $subject);
            $className .= '_' . array_pop($subjectAtoms);
        }

        $className .= '_' . $this->labelSequencer->next();

        return $className;
    }
public function generateClassName(MockDefinition $definition): string
    {
        $className = $definition->className();

        if ('' !== $className) {
            return $className;
        }

        $className = 'PhonyMock';
        $parentClassName = $definition->parentClassName();

        if ('' !== $parentClassName) {
            $subject = $parentClassName;
        } elseif ($interfaceNames = $definition->interfaceNames()) {
            $subject = $interfaceNames[0];
        } elseif ($traitNames = $definition->traitNames()) {
            $subject = $traitNames[0];
        } else {
            $subject = null;
        }

        if (null !== $subject) {
            $subjectAtoms = preg_split('/[_\\\\]/', $subject);
            $className .= '_' . array_pop($subjectAtoms);
        }

        $className .= '_' . $this->labelSequencer->next();

        return $className;
    }
public function generateClassName ( MockDefinition $ definition ) : string { $ className = $ definition -> className ( ) ; if ( '' !== $ className ) { return $ className ; } $ className = 'PhonyMock' ; $ parentClassName = $ definition -> parentClassName ( ) ; if ( '' !== $ parentClassName ) { $ subject = $ parentClassName ; } elseif ( $ interfaceNames = $ definition -> interfaceNames ( ) ) { $ subject = $ interfaceNames [ 0 ] ; } elseif ( $ traitNames = $ definition -> traitNames ( ) ) { $ subject = $ traitNames [ 0 ] ; } else { $ subject = null ; } if ( null !== $ subject ) { $ subjectAtoms = preg_split ( '/[_\\\\]/' , $ subject ) ; $ className .= '_' . array_pop ( $ subjectAtoms ) ; } $ className .= '_' . $ this -> labelSequencer -> next ( ) ; return $ className ; }
Generate a mock class name.

@param MockDefinition $definition The definition.

@return string The mock class name.
Generate a mock class name .