src/Analyse/Caller/CallerFinder.php
protected function getVarName($file, $line)
    {
        // Set a fallback value.
        $varname = static::UNKNOWN_VALUE;

        // Retrieve the call from the sourcecode file.
        if ($this->pool->fileService->fileIsReadable($file) === false) {
            return $varname;
        }

        $line--;

        // Now that we have the line where it was called, we must check if
        // we have several commands in there.
        $possibleCommands = explode(';', $this->pool->fileService->readFile($file, $line, $line));
        // Now we must weed out the none krexx commands.
        foreach ($possibleCommands as $key => $command) {
            if (strpos(strtolower($command), strtolower($this->pattern)) === false) {
                unset($possibleCommands[$key]);
            }
        }

        // I have no idea how to determine the actual call of krexx if we
        // are dealing with several calls per line.
        if (count($possibleCommands) === 1) {
            // Now that we have our actual call, we must remove the krexx-part
            // from it.
            foreach ($this->callPattern as $funcname) {
                // This little baby tries to resolve everything inside the
                // brackets of the kreXX call.
                preg_match('/' . $funcname . '\s*\((.*)\)\s*/u', reset($possibleCommands), $name);
                if (isset($name[1]) === true) {
                    $varname = $this->pool->encodingService->encodeString(trim($name[1], " \t\n\r\0\x0B'\""));
                    break;
                }
            }
        }

        return $varname;
    }
protected function getVarName($file, $line)
    {
        // Set a fallback value.
        $varname = static::UNKNOWN_VALUE;

        // Retrieve the call from the sourcecode file.
        if ($this->pool->fileService->fileIsReadable($file) === false) {
            return $varname;
        }

        $line--;

        // Now that we have the line where it was called, we must check if
        // we have several commands in there.
        $possibleCommands = explode(';', $this->pool->fileService->readFile($file, $line, $line));
        // Now we must weed out the none krexx commands.
        foreach ($possibleCommands as $key => $command) {
            if (strpos(strtolower($command), strtolower($this->pattern)) === false) {
                unset($possibleCommands[$key]);
            }
        }

        // I have no idea how to determine the actual call of krexx if we
        // are dealing with several calls per line.
        if (count($possibleCommands) === 1) {
            // Now that we have our actual call, we must remove the krexx-part
            // from it.
            foreach ($this->callPattern as $funcname) {
                // This little baby tries to resolve everything inside the
                // brackets of the kreXX call.
                preg_match('/' . $funcname . '\s*\((.*)\)\s*/u', reset($possibleCommands), $name);
                if (isset($name[1]) === true) {
                    $varname = $this->pool->encodingService->encodeString(trim($name[1], " \t\n\r\0\x0B'\""));
                    break;
                }
            }
        }

        return $varname;
    }
protected function getVarName ( $ file , $ line ) { // Set a fallback value. $ varname = static :: UNKNOWN_VALUE ; // Retrieve the call from the sourcecode file. if ( $ this -> pool -> fileService -> fileIsReadable ( $ file ) === false ) { return $ varname ; } $ line -- ; // Now that we have the line where it was called, we must check if // we have several commands in there. $ possibleCommands = explode ( ';' , $ this -> pool -> fileService -> readFile ( $ file , $ line , $ line ) ) ; // Now we must weed out the none krexx commands. foreach ( $ possibleCommands as $ key => $ command ) { if ( strpos ( strtolower ( $ command ) , strtolower ( $ this -> pattern ) ) === false ) { unset ( $ possibleCommands [ $ key ] ) ; } } // I have no idea how to determine the actual call of krexx if we // are dealing with several calls per line. if ( count ( $ possibleCommands ) === 1 ) { // Now that we have our actual call, we must remove the krexx-part // from it. foreach ( $ this -> callPattern as $ funcname ) { // This little baby tries to resolve everything inside the // brackets of the kreXX call. preg_match ( '/' . $ funcname . '\s*\((.*)\)\s*/u' , reset ( $ possibleCommands ) , $ name ) ; if ( isset ( $ name [ 1 ] ) === true ) { $ varname = $ this -> pool -> encodingService -> encodeString ( trim ( $ name [ 1 ] , " \t\n\r\0\x0B'\"" ) ) ; break ; } } } return $ varname ; }
Tries to extract the name of the variable which we try to analyse.

@param string $file
Path to the sourcecode file.
@param int $line
The line from where kreXX was called.

@return string
The name of the variable.
Tries to extract the name of the variable which we try to analyse .