You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: parse.go
    path of file: ./repos/trivy/pkg/dependency/parser/php/composer
    
    the code of the file until where you have to start completion: package composer

import (
	"io"
	"sort"
	"strings"

	"github.com/liamg/jfather"
	"golang.org/x/exp/maps"
	"golang.org/x/xerrors"

	"github.com/aquasecurity/tr
    
func (p *Parser) Parse(r xio.ReadSeekerAt) ([]types.Library, []types.Dependency, error) {
	var lockFile lockFile
	input, err := io.ReadAll(r)
	if err != nil {
		return nil, nil, xerrors.Errorf("read error: %w", err)
	}
	if err = jfather.Unmarshal(input, &lockFile); err != nil {
		return nil, nil, xerrors.Errorf("decode error: %w", err)
	}

	libs := make(map[string]types.Library)
	foundDeps := make(map[string][]string)
	for _, pkg := range lockFile.Packages {
		lib := types.Library{
			ID:       utils.PackageID(pkg.Name, pkg.Version),
			Name:     pkg.Name,
			Version:  pkg.Version,
			Indirect: false, // composer.lock file doesn't have info about Direct/Indirect deps. Will think that all dependencies are Direct
			License:  strings.Join(pkg.License, ", "),
			Locations: []types.Location{
				{
					StartLine: pkg.StartLine,
					EndLine:   pkg.EndLine,
				},
			},
		}
		libs[lib.Name] = lib

		var dependsOn []string
		for depName := range pkg.Require {
			// Require field includes required php version, skip this
			// Also skip PHP extensions
			if depName == "php" || strings.HasPrefix(depName, "ext") {
				continue
			}
			dependsOn = append(dependsOn, depName) // field uses range of versions, so later we will fill in the versions from the libraries
		}
		if len(dependsOn) > 0 {
			foundDeps[lib.ID] = dependsOn
		}
	}

	// fill deps versions
	var deps []types.Dependency
	for libID, depsOn := range foundDeps {
		var dependsOn []string
		for _, depName := range depsOn {
			if lib, ok := libs[depName]; ok {
				dependsOn = append(dependsOn, lib.ID)
				continue
			}
			log.Logger.Debugf("unable to find version of %s", depName)
		}
		sort.Strings(dependsOn)
		deps = append(deps, types.Dependency{
			ID:        libID,
			DependsOn: dependsOn,
		})
	}

	libSlice := maps.Values(libs)
	sort.Sort(types.Libraries(libSlice))
	sort.Sort(types.Dependencies(deps))

	return libSlice, deps, nil
}