Library/ClassDefinition.php
public function checkInterfaceImplements(self $classDefinition, self $interfaceDefinition)
    {
        foreach ($interfaceDefinition->getMethods() as $method) {
            if (!$classDefinition->hasMethod($method->getName())) {
                throw new CompilerException(
                    sprintf(
                        'Class %s must implement a method called: "%s" as requirement of interface: "%s"',
                        $classDefinition->getCompleteName(),
                        $method->getName(),
                        $interfaceDefinition->getCompleteName()
                    )
                );
            }

            if (!$method->hasParameters()) {
                continue;
            }

            $implementedMethod = $classDefinition->getMethod($method->getName());
            if ($implementedMethod->getNumberOfRequiredParameters() > $method->getNumberOfRequiredParameters() ||
                $implementedMethod->getNumberOfParameters() < $method->getNumberOfParameters()
            ) {
                throw new CompilerException(
                    sprintf(
                        'Method %s::%s() does not have the same number of required parameters in interface: "%s"',
                        $classDefinition->getCompleteName(),
                        $method->getName(),
                        $interfaceDefinition->getCompleteName()
                    )
                );
            }
        }
    }
public function checkInterfaceImplements(self $classDefinition, self $interfaceDefinition)
    {
        foreach ($interfaceDefinition->getMethods() as $method) {
            if (!$classDefinition->hasMethod($method->getName())) {
                throw new CompilerException(
                    sprintf(
                        'Class %s must implement a method called: "%s" as requirement of interface: "%s"',
                        $classDefinition->getCompleteName(),
                        $method->getName(),
                        $interfaceDefinition->getCompleteName()
                    )
                );
            }

            if (!$method->hasParameters()) {
                continue;
            }

            $implementedMethod = $classDefinition->getMethod($method->getName());
            if ($implementedMethod->getNumberOfRequiredParameters() > $method->getNumberOfRequiredParameters() ||
                $implementedMethod->getNumberOfParameters() < $method->getNumberOfParameters()
            ) {
                throw new CompilerException(
                    sprintf(
                        'Method %s::%s() does not have the same number of required parameters in interface: "%s"',
                        $classDefinition->getCompleteName(),
                        $method->getName(),
                        $interfaceDefinition->getCompleteName()
                    )
                );
            }
        }
    }
public function checkInterfaceImplements ( self $ classDefinition , self $ interfaceDefinition ) { foreach ( $ interfaceDefinition -> getMethods ( ) as $ method ) { if ( ! $ classDefinition -> hasMethod ( $ method -> getName ( ) ) ) { throw new CompilerException ( sprintf ( 'Class %s must implement a method called: "%s" as requirement of interface: "%s"' , $ classDefinition -> getCompleteName ( ) , $ method -> getName ( ) , $ interfaceDefinition -> getCompleteName ( ) ) ) ; } if ( ! $ method -> hasParameters ( ) ) { continue ; } $ implementedMethod = $ classDefinition -> getMethod ( $ method -> getName ( ) ) ; if ( $ implementedMethod -> getNumberOfRequiredParameters ( ) > $ method -> getNumberOfRequiredParameters ( ) || $ implementedMethod -> getNumberOfParameters ( ) < $ method -> getNumberOfParameters ( ) ) { throw new CompilerException ( sprintf ( 'Method %s::%s() does not have the same number of required parameters in interface: "%s"' , $ classDefinition -> getCompleteName ( ) , $ method -> getName ( ) , $ interfaceDefinition -> getCompleteName ( ) ) ) ; } } }
Checks if a class implements an interface.

@param ClassDefinition $classDefinition
@param ClassDefinition $interfaceDefinition

@throws CompilerException
Checks if a class implements an interface .