for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace TheCodingMachine\GraphQL\Controllers;
use TheCodingMachine\GraphQL\Controllers\Annotations\Type;
class NamingStrategy implements NamingStrategyInterface
{
/**
* Returns the name of the GraphQL interface from a name of a concrete class (when the interface is created
* automatically to manage inheritance)
*/
public function getInterfaceNameFromConcreteName(string $concreteType): string
return $concreteType.'Interface';
}
* Returns the GraphQL output object type name based on the type className and the Type annotation.
public function getOutputTypeName(string $typeClassName, Type $type): string
if ($prevPos = strrpos($typeClassName, '\\')) {
$typeClassName = substr($typeClassName, $prevPos + 1);
// By default, if the class name ends with Type, let's take the name of the class for the type
if (substr($typeClassName, -4) === 'Type') {
return substr($typeClassName, 0, -4);
// Else, let's take the name of the targeted class
$typeClassName = $type->getClass();
return $typeClassName;