src/Analyse/Callback/Iterate/ThroughMethods.php
protected function getDeclarationPlace(\ReflectionMethod $reflectionMethod, \ReflectionClass $declaringClass)
    {
        $filename = $this->pool->fileService->filterFilePath($reflectionMethod->getFileName());
        if (empty($filename) === true) {
            return static::UNKNOWN_DECLARATION;
        }

        // If the filename of the $declaringClass and the $reflectionMethod differ,
        // we are facing a trait here.
        if ($reflectionMethod->getFileName() !== $declaringClass->getFileName() &&
            method_exists($declaringClass, 'getTraits')
        ) {
            // There is no real clean way to get the name of the trait that we
            // are looking at.
            $traitName = ':: unable to get the trait name ::';
            $trait = $this->retrieveDeclaringReflection($reflectionMethod, $declaringClass);
            if ($trait !== false) {
                $traitName = $trait->getName();
            }

            return $filename . "\n" .
                'in trait: ' . $traitName . "\n" .
                'in line: ' . $reflectionMethod->getStartLine();
        } else {
            return $filename . "\n" .
                'in class: ' . $reflectionMethod->class . "\n" .
                'in line: ' . $reflectionMethod->getStartLine();
        }
    }
protected function getDeclarationPlace(\ReflectionMethod $reflectionMethod, \ReflectionClass $declaringClass)
    {
        $filename = $this->pool->fileService->filterFilePath($reflectionMethod->getFileName());
        if (empty($filename) === true) {
            return static::UNKNOWN_DECLARATION;
        }

        // If the filename of the $declaringClass and the $reflectionMethod differ,
        // we are facing a trait here.
        if ($reflectionMethod->getFileName() !== $declaringClass->getFileName() &&
            method_exists($declaringClass, 'getTraits')
        ) {
            // There is no real clean way to get the name of the trait that we
            // are looking at.
            $traitName = ':: unable to get the trait name ::';
            $trait = $this->retrieveDeclaringReflection($reflectionMethod, $declaringClass);
            if ($trait !== false) {
                $traitName = $trait->getName();
            }

            return $filename . "\n" .
                'in trait: ' . $traitName . "\n" .
                'in line: ' . $reflectionMethod->getStartLine();
        } else {
            return $filename . "\n" .
                'in class: ' . $reflectionMethod->class . "\n" .
                'in line: ' . $reflectionMethod->getStartLine();
        }
    }
protected function getDeclarationPlace ( \ ReflectionMethod $ reflectionMethod , \ ReflectionClass $ declaringClass ) { $ filename = $ this -> pool -> fileService -> filterFilePath ( $ reflectionMethod -> getFileName ( ) ) ; if ( empty ( $ filename ) === true ) { return static :: UNKNOWN_DECLARATION ; } // If the filename of the $declaringClass and the $reflectionMethod differ, // we are facing a trait here. if ( $ reflectionMethod -> getFileName ( ) !== $ declaringClass -> getFileName ( ) && method_exists ( $ declaringClass , 'getTraits' ) ) { // There is no real clean way to get the name of the trait that we // are looking at. $ traitName = ':: unable to get the trait name ::' ; $ trait = $ this -> retrieveDeclaringReflection ( $ reflectionMethod , $ declaringClass ) ; if ( $ trait !== false ) { $ traitName = $ trait -> getName ( ) ; } return $ filename . "\n" . 'in trait: ' . $ traitName . "\n" . 'in line: ' . $ reflectionMethod -> getStartLine ( ) ; } else { return $ filename . "\n" . 'in class: ' . $ reflectionMethod -> class . "\n" . 'in line: ' . $ reflectionMethod -> getStartLine ( ) ; } }
Get the declaration place of this method.

@param \ReflectionMethod $reflectionMethod
Reflection of the method we are analysing.
@param \ReflectionClass $declaringClass
Reflection of the class we are analysing

@return string
The analysis result.
Get the declaration place of this method .