FeaturePhp/Model/ConfigurationRenderer.php
private function analyzeModel($model, $textOnly) {
        $featureNum = count($model->getFeatures());
        $rootFeatureName = $model->getRootFeature()->getName();
        $constraintNum = count($model->getConstraintSolver()->getConstraints());
        $ruleNum = count($model->getXmlModel()->getRules());

        $str = "";
        $maxLen = fphp\Helper\_String::getMaxLength($model->getFeatures(), "getName");
        
        if ($textOnly)
            $str .= "The given feature model with the root feature " .
                 "$this->accentColor$rootFeatureName$this->defaultColor has the following $featureNum features:\n\n";
        else {
            $str .= "<div>";
            $str .= "<p>The given feature model with the root feature <span class='feature'>$rootFeatureName</span> "
                 . "has the following $featureNum features:</p>";
            $str .= "<ul>";
        }

        foreach ($model->getFeatures() as $feature) {
            $description = $feature->getDescription();
            if ($this->productLine)
                $class = $this->productLine->getArtifact($feature)->isGenerated() ? "" : "unimplemented";
            else
                $class = "";

            if ($textOnly) {
                $color = $class === "unimplemented" ? "" : $this->accentColor;
                $str .= sprintf("%s%-{$maxLen}s$this->defaultColor %s\n", $color, $feature->getName(),
                                fphp\Helper\_String::truncate($description));
            } else
                $str .= "<li><span class='feature $class'>"
                     . $feature->getName()
                     . ($description ? "</span><br /><span style='font-size: 0.8em'>"
                        . str_replace("\n", "<br />", $description) . "</span>" : "")
                     . "</li>";
        }

        if ($textOnly)
            $str .= "\nThere are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).\n";
        else {
            $str .= "</ul>";
            $str .= "<p>There are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).</p>";
            $str .= "</div>";
        }
        return $str;
    }
private function analyzeModel($model, $textOnly) {
        $featureNum = count($model->getFeatures());
        $rootFeatureName = $model->getRootFeature()->getName();
        $constraintNum = count($model->getConstraintSolver()->getConstraints());
        $ruleNum = count($model->getXmlModel()->getRules());

        $str = "";
        $maxLen = fphp\Helper\_String::getMaxLength($model->getFeatures(), "getName");
        
        if ($textOnly)
            $str .= "The given feature model with the root feature " .
                 "$this->accentColor$rootFeatureName$this->defaultColor has the following $featureNum features:\n\n";
        else {
            $str .= "<div>";
            $str .= "<p>The given feature model with the root feature <span class='feature'>$rootFeatureName</span> "
                 . "has the following $featureNum features:</p>";
            $str .= "<ul>";
        }

        foreach ($model->getFeatures() as $feature) {
            $description = $feature->getDescription();
            if ($this->productLine)
                $class = $this->productLine->getArtifact($feature)->isGenerated() ? "" : "unimplemented";
            else
                $class = "";

            if ($textOnly) {
                $color = $class === "unimplemented" ? "" : $this->accentColor;
                $str .= sprintf("%s%-{$maxLen}s$this->defaultColor %s\n", $color, $feature->getName(),
                                fphp\Helper\_String::truncate($description));
            } else
                $str .= "<li><span class='feature $class'>"
                     . $feature->getName()
                     . ($description ? "</span><br /><span style='font-size: 0.8em'>"
                        . str_replace("\n", "<br />", $description) . "</span>" : "")
                     . "</li>";
        }

        if ($textOnly)
            $str .= "\nThere are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).\n";
        else {
            $str .= "</ul>";
            $str .= "<p>There are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).</p>";
            $str .= "</div>";
        }
        return $str;
    }
private function analyzeModel ( $ model , $ textOnly ) { $ featureNum = count ( $ model -> getFeatures ( ) ) ; $ rootFeatureName = $ model -> getRootFeature ( ) -> getName ( ) ; $ constraintNum = count ( $ model -> getConstraintSolver ( ) -> getConstraints ( ) ) ; $ ruleNum = count ( $ model -> getXmlModel ( ) -> getRules ( ) ) ; $ str = "" ; $ maxLen = fphp \ Helper \ _String :: getMaxLength ( $ model -> getFeatures ( ) , "getName" ) ; if ( $ textOnly ) $ str .= "The given feature model with the root feature " . "$this->accentColor$rootFeatureName$this->defaultColor has the following $featureNum features:\n\n" ; else { $ str .= "<div>" ; $ str .= "<p>The given feature model with the root feature <span class='feature'>$rootFeatureName</span> " . "has the following $featureNum features:</p>" ; $ str .= "<ul>" ; } foreach ( $ model -> getFeatures ( ) as $ feature ) { $ description = $ feature -> getDescription ( ) ; if ( $ this -> productLine ) $ class = $ this -> productLine -> getArtifact ( $ feature ) -> isGenerated ( ) ? "" : "unimplemented" ; else $ class = "" ; if ( $ textOnly ) { $ color = $ class === "unimplemented" ? "" : $ this -> accentColor ; $ str .= sprintf ( "%s%-{$maxLen}s$this->defaultColor %s\n" , $ color , $ feature -> getName ( ) , fphp \ Helper \ _String :: truncate ( $ description ) ) ; } else $ str .= "<li><span class='feature $class'>" . $ feature -> getName ( ) . ( $ description ? "</span><br /><span style='font-size: 0.8em'>" . str_replace ( "\n" , "<br />" , $ description ) . "</span>" : "" ) . "</li>" ; } if ( $ textOnly ) $ str .= "\nThere are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).\n" ; else { $ str .= "</ul>" ; $ str .= "<p>There are $constraintNum feature constraints ($ruleNum of them cross-tree constraints).</p>" ; $ str .= "</div>" ; } return $ str ; }
Returns a model analysis.
@param Model $model
@param bool $textOnly whether to render text or HTML
@return string
Returns a model analysis .