FeaturePhp/Model/ConfigurationRenderer.php
private function analyzeConfiguration($configuration, $textOnly) {
        $validity = $configuration->isValid() ? "valid" : "invalid";

        $str = "";
        $selectedColor = "\033[1;32m";
        $deselectedColor = "\033[1;31m";
        
        if ($textOnly)
            $str .= "The given configuration has the following feature selection:\n\n";
        else {
            $str .= "<div style='font-family: monospace'>";
            $str .= "<p>The given configuration has the following feature selection:</p>";
            $str .= "<ul>";
        }

        foreach ($configuration->getModel()->getFeatures() as $feature) {
            $isSelected = Feature::has($configuration->getSelectedFeatures(), $feature);
            $mark = $isSelected ? "x" : "&nbsp;";
            $class = $isSelected ? "selected" : "deselected";

            if ($textOnly)
                $str .= "[" . ($isSelected ? "x" : " ") . "] " .
                     ($isSelected ? $selectedColor : $deselectedColor) . $feature->getName() . "$this->defaultColor\n";
            else
                $str .= "<li>[$mark] <span class='feature $class'>" . $feature->getName() . "</span></li>";
        }

        if ($textOnly)
            $str .= "\nThis configuration is $validity.\n";
        else {
            $str .= "</ul>";
            $str .= "<p>This configuration is $validity.</p>";
            $str .= "</div>";
        }
        return $str;
    }
private function analyzeConfiguration($configuration, $textOnly) {
        $validity = $configuration->isValid() ? "valid" : "invalid";

        $str = "";
        $selectedColor = "\033[1;32m";
        $deselectedColor = "\033[1;31m";
        
        if ($textOnly)
            $str .= "The given configuration has the following feature selection:\n\n";
        else {
            $str .= "<div style='font-family: monospace'>";
            $str .= "<p>The given configuration has the following feature selection:</p>";
            $str .= "<ul>";
        }

        foreach ($configuration->getModel()->getFeatures() as $feature) {
            $isSelected = Feature::has($configuration->getSelectedFeatures(), $feature);
            $mark = $isSelected ? "x" : "&nbsp;";
            $class = $isSelected ? "selected" : "deselected";

            if ($textOnly)
                $str .= "[" . ($isSelected ? "x" : " ") . "] " .
                     ($isSelected ? $selectedColor : $deselectedColor) . $feature->getName() . "$this->defaultColor\n";
            else
                $str .= "<li>[$mark] <span class='feature $class'>" . $feature->getName() . "</span></li>";
        }

        if ($textOnly)
            $str .= "\nThis configuration is $validity.\n";
        else {
            $str .= "</ul>";
            $str .= "<p>This configuration is $validity.</p>";
            $str .= "</div>";
        }
        return $str;
    }
private function analyzeConfiguration ( $ configuration , $ textOnly ) { $ validity = $ configuration -> isValid ( ) ? "valid" : "invalid" ; $ str = "" ; $ selectedColor = "\033[1;32m" ; $ deselectedColor = "\033[1;31m" ; if ( $ textOnly ) $ str .= "The given configuration has the following feature selection:\n\n" ; else { $ str .= "<div style='font-family: monospace'>" ; $ str .= "<p>The given configuration has the following feature selection:</p>" ; $ str .= "<ul>" ; } foreach ( $ configuration -> getModel ( ) -> getFeatures ( ) as $ feature ) { $ isSelected = Feature :: has ( $ configuration -> getSelectedFeatures ( ) , $ feature ) ; $ mark = $ isSelected ? "x" : "&nbsp;" ; $ class = $ isSelected ? "selected" : "deselected" ; if ( $ textOnly ) $ str .= "[" . ( $ isSelected ? "x" : " " ) . "] " . ( $ isSelected ? $ selectedColor : $ deselectedColor ) . $ feature -> getName ( ) . "$this->defaultColor\n" ; else $ str .= "<li>[$mark] <span class='feature $class'>" . $ feature -> getName ( ) . "</span></li>" ; } if ( $ textOnly ) $ str .= "\nThis configuration is $validity.\n" ; else { $ str .= "</ul>" ; $ str .= "<p>This configuration is $validity.</p>" ; $ str .= "</div>" ; } return $ str ; }
Returns a configuration analysis.
@param Configuration $configuration
@param bool $textOnly whether to render text or HTML
@return string
Returns a configuration analysis .