$class_start = ' class {{ proxy_class_shortname }}';
// For cases in which the implemented interface is a child of another
// interface, getInterfaceNames() also returns the parent. This causes a
// PHP error.
// In order to avoid that, check for each interface, whether one of its
// parents is also in the list and exclude it.
if ($interfaces =
$reflection->
getInterfaces()) { foreach ($interfaces as $interface) { // Exclude all parents from the list of implemented interfaces of the
// class.
if ($parent_interfaces =
$interface->
getInterfaceNames()) { foreach ($parent_interfaces as $parent_interface) { unset($interfaces[$parent_interface]);
} } } $interface_names =
[];
foreach ($interfaces as $interface) { $interface_names[] = '\\' .
$interface->
getName();
} $class_start .= ' implements ' .
implode(', ',
$interface_names);
}