public function matchPackageVersionEntities($availableVersions, $wantedVersion)
    {
        if (empty($availableVersions)) {
            $result = null;
        } else {
            $keys = [];
            foreach ($availableVersions as $pv) {
                $keys[$pv->getVersion()] = $pv;
            }
            $bestKey = $this->matchPackageVersions(array_keys($keys), $wantedVersion);
            $result = $keys[$bestKey];
        }

        return $result;
    }
public function matchPackageVersionEntities($availableVersions, $wantedVersion)
    {
        if (empty($availableVersions)) {
            $result = null;
        } else {
            $keys = [];
            foreach ($availableVersions as $pv) {
                $keys[$pv->getVersion()] = $pv;
            }
            $bestKey = $this->matchPackageVersions(array_keys($keys), $wantedVersion);
            $result = $keys[$bestKey];
        }

        return $result;
    }
public function matchPackageVersionEntities ( $ availableVersions , $ wantedVersion ) { if ( empty ( $ availableVersions ) ) { $ result = null ; } else { $ keys = [ ] ; foreach ( $ availableVersions as $ pv ) { $ keys [ $ pv -> getVersion ( ) ] = $ pv ; } $ bestKey = $ this -> matchPackageVersions ( array_keys ( $ keys ) , $ wantedVersion ) ; $ result = $ keys [ $ bestKey ] ; } return $ result ; }
Guess the best package version entity corresponding to a list of entity instances.

@param \CommunityTranslation\Entity\Package\Version[] $availableVersions
@param string $wantedVersion

@return \CommunityTranslation\Entity\Package\Version|null Returns null if $availableVersions is empty, an entity instance otherwise
Guess the best package version entity corresponding to a list of entity instances .