FeaturePhp/Generator/RuntimeGenerator.php
public function traceRuntimeCalls($files, $productLine) {
        $runtimeCalls = array();
        
        foreach ($files as $file) {            
            $content = $file->getContent();
            if ($content instanceof fphp\File\StoredFileContent) {
                $fileSource = $content->getFileSource();
                $content = file_get_contents($fileSource);
            } else {
                $fileSource = "(text file)";
                $content = $content->getSummary();
            }
            
            foreach (explode("\n", $content) as $idx => $line)
                if (strstr($line, "$this->class::$this->getter")) {
                    preg_match("/$this->class::$this->getter\(.*?[\"'](.*?)[\"'].*?\)/", $line, $matches);
                    try {
                        $feature = $productLine->getFeature($matches[1]);
                    } catch (fphp\Model\ModelException $e) {
                        throw new RuntimeGeneratorException("invalid runtime feature \"$matches[1]\"");
                    }
                    $runtimeCalls[] = new fphp\Artifact\TracingLink(
                        "runtime",
                        $productLine->getArtifact($feature),
                        new fphp\Artifact\LinePlace($fileSource, $idx + 1),
                        new fphp\Artifact\LinePlace($file->getTarget(), $idx + 1));
                }
        }
        
        return $runtimeCalls;
    }
public function traceRuntimeCalls($files, $productLine) {
        $runtimeCalls = array();
        
        foreach ($files as $file) {            
            $content = $file->getContent();
            if ($content instanceof fphp\File\StoredFileContent) {
                $fileSource = $content->getFileSource();
                $content = file_get_contents($fileSource);
            } else {
                $fileSource = "(text file)";
                $content = $content->getSummary();
            }
            
            foreach (explode("\n", $content) as $idx => $line)
                if (strstr($line, "$this->class::$this->getter")) {
                    preg_match("/$this->class::$this->getter\(.*?[\"'](.*?)[\"'].*?\)/", $line, $matches);
                    try {
                        $feature = $productLine->getFeature($matches[1]);
                    } catch (fphp\Model\ModelException $e) {
                        throw new RuntimeGeneratorException("invalid runtime feature \"$matches[1]\"");
                    }
                    $runtimeCalls[] = new fphp\Artifact\TracingLink(
                        "runtime",
                        $productLine->getArtifact($feature),
                        new fphp\Artifact\LinePlace($fileSource, $idx + 1),
                        new fphp\Artifact\LinePlace($file->getTarget(), $idx + 1));
                }
        }
        
        return $runtimeCalls;
    }
public function traceRuntimeCalls ( $ files , $ productLine ) { $ runtimeCalls = array ( ) ; foreach ( $ files as $ file ) { $ content = $ file -> getContent ( ) ; if ( $ content instanceof fphp \ File \ StoredFileContent ) { $ fileSource = $ content -> getFileSource ( ) ; $ content = file_get_contents ( $ fileSource ) ; } else { $ fileSource = "(text file)" ; $ content = $ content -> getSummary ( ) ; } foreach ( explode ( "\n" , $ content ) as $ idx => $ line ) if ( strstr ( $ line , "$this->class::$this->getter" ) ) { preg_match ( "/$this->class::$this->getter\(.*?[\"'](.*?)[\"'].*?\)/" , $ line , $ matches ) ; try { $ feature = $ productLine -> getFeature ( $ matches [ 1 ] ) ; } catch ( fphp \ Model \ ModelException $ e ) { throw new RuntimeGeneratorException ( "invalid runtime feature \"$matches[1]\"" ) ; } $ runtimeCalls [ ] = new fphp \ Artifact \ TracingLink ( "runtime" , $ productLine -> getArtifact ( $ feature ) , new fphp \ Artifact \ LinePlace ( $ fileSource , $ idx + 1 ) , new fphp \ Artifact \ LinePlace ( $ file -> getTarget ( ) , $ idx + 1 ) ) ; } } return $ runtimeCalls ; }
Returns tracing links for all calls of the runtime class.
@param \FeaturePhp\File\File[] $files
@param \FeaturePhp\ProductLine\ProductLine $productLine
@return \FeaturePhp\Artifact\TracingLink[]
Returns tracing links for all calls of the runtime class .