FeaturePhp/Model/ConstraintSolver.php
private static function alternative($feature) {
        if ($feature->getAlternative()) {
            $children = array();
            foreach ($feature->getChildren() as $child)
                $children[] = Logic::is($child);

            $alternativeConstraints = array();
            for ($i = 0; $i < count($children); $i++)
                for ($j = 0; $j < $i; $j++)
                    $alternativeConstraints[] = Logic::not(Logic::_and($children[$i], $children[$j]));

            return Logic::_and(Logic::equiv(Logic::is($feature),
                                            call_user_func_array("\FeaturePhp\Helper\Logic::_or", $children)),
                               call_user_func_array("\FeaturePhp\Helper\Logic::_and", $alternativeConstraints));
        }
    }
private static function alternative($feature) {
        if ($feature->getAlternative()) {
            $children = array();
            foreach ($feature->getChildren() as $child)
                $children[] = Logic::is($child);

            $alternativeConstraints = array();
            for ($i = 0; $i < count($children); $i++)
                for ($j = 0; $j < $i; $j++)
                    $alternativeConstraints[] = Logic::not(Logic::_and($children[$i], $children[$j]));

            return Logic::_and(Logic::equiv(Logic::is($feature),
                                            call_user_func_array("\FeaturePhp\Helper\Logic::_or", $children)),
                               call_user_func_array("\FeaturePhp\Helper\Logic::_and", $alternativeConstraints));
        }
    }
private static function alternative ( $ feature ) { if ( $ feature -> getAlternative ( ) ) { $ children = array ( ) ; foreach ( $ feature -> getChildren ( ) as $ child ) $ children [ ] = Logic :: is ( $ child ) ; $ alternativeConstraints = array ( ) ; for ( $ i = 0 ; $ i < count ( $ children ) ; $ i ++ ) for ( $ j = 0 ; $ j < $ i ; $ j ++ ) $ alternativeConstraints [ ] = Logic :: not ( Logic :: _and ( $ children [ $ i ] , $ children [ $ j ] ) ) ; return Logic :: _and ( Logic :: equiv ( Logic :: is ( $ feature ) , call_user_func_array ( "\FeaturePhp\Helper\Logic::_or" , $ children ) ) , call_user_func_array ( "\FeaturePhp\Helper\Logic::_and" , $ alternativeConstraints ) ) ; } }
Semantics for a feature that provides an alternative choice.
Exactly one child of such a feature is selected.
@param Feature $feature
@return callable
Semantics for a feature that provides an alternative choice . Exactly one child of such a feature is selected .