public function parseConstraints($constraints)
    {
        $prettyConstraint = $constraints;
        if (preg_match('{^([^,\s]*?)@(' . implode('|', array_keys(BasePackage::$stabilities)) . ')$}i', $constraints, $match)) {
            $constraints = empty($match[1]) ? '*' : $match[1];
        }

        if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
            $constraints = $match[1];
        }

        $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
        $orGroups = [];
        foreach ($orConstraints as $constraints) {
            $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
            if (count($andConstraints) > 1) {
                $constraintObjects = [];
                foreach ($andConstraints as $constraint) {
                    $constraintObjects = array_merge($constraintObjects, $this->parseConstraint($constraint));
                }
            } else {
                $constraintObjects = $this->parseConstraint($andConstraints[0]);
            }

            if (1 === count($constraintObjects)) {
                $constraint = $constraintObjects[0];
            } else {
                $constraint = new MultiConstraint($constraintObjects);
            }

            $orGroups[] = $constraint;
        }

        if (1 === count($orGroups)) {
            $constraint = $orGroups[0];
        } else {
            $constraint = new MultiConstraint($orGroups, false);
        }

        $constraint->setPrettyString($prettyConstraint);

        return $constraint;
    }
public function parseConstraints($constraints)
    {
        $prettyConstraint = $constraints;
        if (preg_match('{^([^,\s]*?)@(' . implode('|', array_keys(BasePackage::$stabilities)) . ')$}i', $constraints, $match)) {
            $constraints = empty($match[1]) ? '*' : $match[1];
        }

        if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
            $constraints = $match[1];
        }

        $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
        $orGroups = [];
        foreach ($orConstraints as $constraints) {
            $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
            if (count($andConstraints) > 1) {
                $constraintObjects = [];
                foreach ($andConstraints as $constraint) {
                    $constraintObjects = array_merge($constraintObjects, $this->parseConstraint($constraint));
                }
            } else {
                $constraintObjects = $this->parseConstraint($andConstraints[0]);
            }

            if (1 === count($constraintObjects)) {
                $constraint = $constraintObjects[0];
            } else {
                $constraint = new MultiConstraint($constraintObjects);
            }

            $orGroups[] = $constraint;
        }

        if (1 === count($orGroups)) {
            $constraint = $orGroups[0];
        } else {
            $constraint = new MultiConstraint($orGroups, false);
        }

        $constraint->setPrettyString($prettyConstraint);

        return $constraint;
    }
public function parseConstraints ( $ constraints ) { $ prettyConstraint = $ constraints ; if ( preg_match ( '{^([^,\s]*?)@(' . implode ( '|' , array_keys ( BasePackage :: $ stabilities ) ) . ')$}i' , $ constraints , $ match ) ) { $ constraints = empty ( $ match [ 1 ] ) ? '*' : $ match [ 1 ] ; } if ( preg_match ( '{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i' , $ constraints , $ match ) ) { $ constraints = $ match [ 1 ] ; } $ orConstraints = preg_split ( '{\s*\|\|?\s*}' , trim ( $ constraints ) ) ; $ orGroups = [ ] ; foreach ( $ orConstraints as $ constraints ) { $ andConstraints = preg_split ( '{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}' , $ constraints ) ; if ( count ( $ andConstraints ) > 1 ) { $ constraintObjects = [ ] ; foreach ( $ andConstraints as $ constraint ) { $ constraintObjects = array_merge ( $ constraintObjects , $ this -> parseConstraint ( $ constraint ) ) ; } } else { $ constraintObjects = $ this -> parseConstraint ( $ andConstraints [ 0 ] ) ; } if ( 1 === count ( $ constraintObjects ) ) { $ constraint = $ constraintObjects [ 0 ] ; } else { $ constraint = new MultiConstraint ( $ constraintObjects ) ; } $ orGroups [ ] = $ constraint ; } if ( 1 === count ( $ orGroups ) ) { $ constraint = $ orGroups [ 0 ] ; } else { $ constraint = new MultiConstraint ( $ orGroups , false ) ; } $ constraint -> setPrettyString ( $ prettyConstraint ) ; return $ constraint ; }
Parses as constraint string into LinkConstraint objects

@param  string                                                   $constraints Constraints
@return \Composer\Package\LinkConstraint\LinkConstraintInterface
Parses as constraint string into LinkConstraint objects