src/Composer/Repository/Pear/PackageDependencyParser.php
private function buildDependency20Info($depArray)
    {
        $result = array();
        $optionals = array();
        $defaultOptionals = array();
        foreach ($depArray as $depType => $depTypeGroup) {
            if (!is_array($depTypeGroup)) {
                continue;
            }
            if ('required' == $depType || 'optional' == $depType) {
                foreach ($depTypeGroup as $depItemType => $depItem) {
                    switch ($depItemType) {
                        case 'php':
                            $result[] = new DependencyConstraint(
                                $depType,
                                $this->parse20VersionConstraint($depItem),
                                'php',
                                ''
                            );
                            break;
                        case 'package':
                            $deps = $this->buildDepPackageConstraints($depItem, $depType);
                            $result = array_merge($result, $deps);
                            break;
                        case 'extension':
                            $deps = $this->buildDepExtensionConstraints($depItem, $depType);
                            $result = array_merge($result, $deps);
                            break;
                        case 'subpackage':
                            $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
                            $defaultOptionals += $deps;
                            break;
                        case 'os':
                        case 'pearinstaller':
                            break;
                        default:
                            break;
                    }
                }
            } elseif ('group' == $depType) {
                if ($this->isHash($depTypeGroup)) {
                    $depTypeGroup = array($depTypeGroup);
                }

                foreach ($depTypeGroup as $depItem) {
                    $groupName = $depItem['attribs']['name'];
                    if (!isset($optionals[$groupName])) {
                        $optionals[$groupName] = array();
                    }

                    if (isset($depItem['subpackage'])) {
                        $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
                    } else {
                        $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
                    }
                }
            }
        }

        if (count($defaultOptionals) > 0) {
            $optionals['*'] = $defaultOptionals;
        }

        return new DependencyInfo($result, $optionals);
    }
private function buildDependency20Info($depArray)
    {
        $result = array();
        $optionals = array();
        $defaultOptionals = array();
        foreach ($depArray as $depType => $depTypeGroup) {
            if (!is_array($depTypeGroup)) {
                continue;
            }
            if ('required' == $depType || 'optional' == $depType) {
                foreach ($depTypeGroup as $depItemType => $depItem) {
                    switch ($depItemType) {
                        case 'php':
                            $result[] = new DependencyConstraint(
                                $depType,
                                $this->parse20VersionConstraint($depItem),
                                'php',
                                ''
                            );
                            break;
                        case 'package':
                            $deps = $this->buildDepPackageConstraints($depItem, $depType);
                            $result = array_merge($result, $deps);
                            break;
                        case 'extension':
                            $deps = $this->buildDepExtensionConstraints($depItem, $depType);
                            $result = array_merge($result, $deps);
                            break;
                        case 'subpackage':
                            $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
                            $defaultOptionals += $deps;
                            break;
                        case 'os':
                        case 'pearinstaller':
                            break;
                        default:
                            break;
                    }
                }
            } elseif ('group' == $depType) {
                if ($this->isHash($depTypeGroup)) {
                    $depTypeGroup = array($depTypeGroup);
                }

                foreach ($depTypeGroup as $depItem) {
                    $groupName = $depItem['attribs']['name'];
                    if (!isset($optionals[$groupName])) {
                        $optionals[$groupName] = array();
                    }

                    if (isset($depItem['subpackage'])) {
                        $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
                    } else {
                        $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
                    }
                }
            }
        }

        if (count($defaultOptionals) > 0) {
            $optionals['*'] = $defaultOptionals;
        }

        return new DependencyInfo($result, $optionals);
    }
Builds dependency information from package.xml 2.0 format

@param array $depArray Dependency data in package.xml 1.0 format
@return DependencyInfo