Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is
duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Due to PHP Bug #53727, is_subclass_of might return inconsistent results on some PHP versions if \Eccube\Service\Payment\...tMethodInterface::class can be an interface. If so, you could instead use ReflectionClass::implementsInterface.
Loading history...
32
throw new \InvalidArgumentException(
33
sprintf('Service "%s" must implement interface "%s".', $id, PaymentMethodInterface::class));