private function isShortIdentifierGetter($method, ClassMetadata $class)
    {
        $identifier = lcfirst(substr($method->getName(), 3));
        $startLine  = $method->getStartLine();
        $endLine    = $method->getEndLine();
        $cheapCheck = (
            $method->getNumberOfParameters() == 0
            && substr($method->getName(), 0, 3) == 'get'
            && in_array($identifier, $class->getIdentifier(), true)
            && $class->hasField($identifier)
            && (($endLine - $startLine) <= 4)
        );

        if ($cheapCheck) {
            $code = file($method->getFileName());
            $code = trim(implode(' ', array_slice($code, $startLine - 1, $endLine - $startLine + 1)));

            $pattern = sprintf(self::PATTERN_MATCH_ID_METHOD, $method->getName(), $identifier);

            if (preg_match($pattern, $code)) {
                return true;
            }
        }

        return false;
    }
private function isShortIdentifierGetter($method, ClassMetadata $class)
    {
        $identifier = lcfirst(substr($method->getName(), 3));
        $startLine  = $method->getStartLine();
        $endLine    = $method->getEndLine();
        $cheapCheck = (
            $method->getNumberOfParameters() == 0
            && substr($method->getName(), 0, 3) == 'get'
            && in_array($identifier, $class->getIdentifier(), true)
            && $class->hasField($identifier)
            && (($endLine - $startLine) <= 4)
        );

        if ($cheapCheck) {
            $code = file($method->getFileName());
            $code = trim(implode(' ', array_slice($code, $startLine - 1, $endLine - $startLine + 1)));

            $pattern = sprintf(self::PATTERN_MATCH_ID_METHOD, $method->getName(), $identifier);

            if (preg_match($pattern, $code)) {
                return true;
            }
        }

        return false;
    }
private function isShortIdentifierGetter ( $ method , ClassMetadata $ class ) { $ identifier = lcfirst ( substr ( $ method -> getName ( ) , 3 ) ) ; $ startLine = $ method -> getStartLine ( ) ; $ endLine = $ method -> getEndLine ( ) ; $ cheapCheck = ( $ method -> getNumberOfParameters ( ) == 0 && substr ( $ method -> getName ( ) , 0 , 3 ) == 'get' && in_array ( $ identifier , $ class -> getIdentifier ( ) , true ) && $ class -> hasField ( $ identifier ) && ( ( $ endLine - $ startLine ) <= 4 ) ) ; if ( $ cheapCheck ) { $ code = file ( $ method -> getFileName ( ) ) ; $ code = trim ( implode ( ' ' , array_slice ( $ code , $ startLine - 1 , $ endLine - $ startLine + 1 ) ) ) ; $ pattern = sprintf ( self :: PATTERN_MATCH_ID_METHOD , $ method -> getName ( ) , $ identifier ) ; if ( preg_match ( $ pattern , $ code ) ) { return true ; } } return false ; }
Checks if the method is a short identifier getter.

What does this mean? For proxy objects the identifier is already known,
however accessing the getter for this identifier usually triggers the
lazy loading, leading to a query that may not be necessary if only the
ID is interesting for the userland code (for example in views that
generate links to the entity, but do not display anything else).

@param \ReflectionMethod                                  $method
@param \Doctrine\Common\Persistence\Mapping\ClassMetadata $class

@return boolean
Checks if the method is a short identifier getter .