!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/uploads/script/vendor/composer/composer/src/Composer/DependencyResolver/   drwxr-xr-x
Free 13.19 GB of 57.97 GB (22.76%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     DefaultPolicy.php (6.92 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

/*
 * This file is part of Composer.
 *
 * (c) Nils Adermann <naderman@naderman.de>
 *     Jordi Boggiano <j.boggiano@seld.be>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Composer\DependencyResolver;

use 
Composer\Package\PackageInterface;
use 
Composer\Package\AliasPackage;
use 
Composer\Package\BasePackage;
use 
Composer\Semver\Constraint\Constraint;

/**
 * @author Nils Adermann <naderman@naderman.de>
 * @author Jordi Boggiano <j.boggiano@seld.be>
 */
class DefaultPolicy implements PolicyInterface
{
    private 
$preferStable;
    private 
$preferLowest;

    public function 
__construct($preferStable false$preferLowest false)
    {
        
$this->preferStable $preferStable;
        
$this->preferLowest $preferLowest;
    }

    public function 
versionCompare(PackageInterface $aPackageInterface $b$operator)
    {
        if (
$this->preferStable && ($stabA $a->getStability()) !== ($stabB $b->getStability())) {
            return 
BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
        }

        
$constraint = new Constraint($operator$b->getVersion());
        
$version = new Constraint('=='$a->getVersion());

        return 
$constraint->matchSpecific($versiontrue);
    }

    public function 
selectPreferredPackages(Pool $pool, array $literals$requiredPackage null)
    {
        
$packages $this->groupLiteralsByName($pool$literals);
        
$policy $this;

        foreach (
$packages as &$nameLiterals) {
            
usort($nameLiterals, function ($a$b) use ($policy$pool$requiredPackage) {
                return 
$policy->compareByPriority($pool$pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackagetrue);
            });
        }

        foreach (
$packages as &$sortedLiterals) {
            
$sortedLiterals $this->pruneToBestVersion($pool$sortedLiterals);
            
$sortedLiterals $this->pruneRemoteAliases($pool$sortedLiterals);
        }

        
$selected \call_user_func_array('array_merge'array_values($packages));

        
// now sort the result across all packages to respect replaces across packages
        
usort($selected, function ($a$b) use ($policy$pool$requiredPackage) {
            return 
$policy->compareByPriority($pool$pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
        });

        return 
$selected;
    }

    protected function 
groupLiteralsByName(Pool $pool$literals)
    {
        
$packages = array();
        foreach (
$literals as $literal) {
            
$packageName $pool->literalToPackage($literal)->getName();

            if (!isset(
$packages[$packageName])) {
                
$packages[$packageName] = array();
            }
            
$packages[$packageName][] = $literal;
        }

        return 
$packages;
    }

    
/**
     * @protected
     */
    
public function compareByPriority(Pool $poolPackageInterface $aPackageInterface $b$requiredPackage null$ignoreReplace false)
    {
        
// prefer aliases to the original package
        
if ($a->getName() === $b->getName()) {
            
$aAliased $a instanceof AliasPackage;
            
$bAliased $b instanceof AliasPackage;
            if (
$aAliased && !$bAliased) {
                return -
1// use a
            
}
            if (!
$aAliased && $bAliased) {
                return 
1// use b
            
}
        }

        if (!
$ignoreReplace) {
            
// return original, not replaced
            
if ($this->replaces($a$b)) {
                return 
1// use b
            
}
            if (
$this->replaces($b$a)) {
                return -
1// use a
            
}

            
// for replacers not replacing each other, put a higher prio on replacing
            // packages with the same vendor as the required package
            
if ($requiredPackage && false !== ($pos strpos($requiredPackage'/'))) {
                
$requiredVendor substr($requiredPackage0$pos);

                
$aIsSameVendor strpos($a->getName(), $requiredVendor) === 0;
                
$bIsSameVendor strpos($b->getName(), $requiredVendor) === 0;

                if (
$bIsSameVendor !== $aIsSameVendor) {
                    return 
$aIsSameVendor ? -1;
                }
            }
        }

        
// priority equal, sort by package id to make reproducible
        
if ($a->id === $b->id) {
            return 
0;
        }

        return (
$a->id $b->id) ? -1;
    }

    
/**
     * Checks if source replaces a package with the same name as target.
     *
     * Replace constraints are ignored. This method should only be used for
     * prioritisation, not for actual constraint verification.
     *
     * @param  PackageInterface $source
     * @param  PackageInterface $target
     * @return bool
     */
    
protected function replaces(PackageInterface $sourcePackageInterface $target)
    {
        foreach (
$source->getReplaces() as $link) {
            if (
$link->getTarget() === $target->getName()
//                && (null === $link->getConstraint() ||
//                $link->getConstraint()->matches(new Constraint('==', $target->getVersion())))) {
                
) {
                return 
true;
            }
        }

        return 
false;
    }

    protected function 
pruneToBestVersion(Pool $pool$literals)
    {
        
$operator $this->preferLowest '<' '>';
        
$bestLiterals = array($literals[0]);
        
$bestPackage $pool->literalToPackage($literals[0]);
        foreach (
$literals as $i => $literal) {
            if (
=== $i) {
                continue;
            }

            
$package $pool->literalToPackage($literal);

            if (
$this->versionCompare($package$bestPackage$operator)) {
                
$bestPackage $package;
                
$bestLiterals = array($literal);
            } elseif (
$this->versionCompare($package$bestPackage'==')) {
                
$bestLiterals[] = $literal;
            }
        }

        return 
$bestLiterals;
    }

    
/**
     * Assumes that locally aliased (in root package requires) packages take priority over branch-alias ones
     *
     * If no package is a local alias, nothing happens
     */
    
protected function pruneRemoteAliases(Pool $pool, array $literals)
    {
        
$hasLocalAlias false;

        foreach (
$literals as $literal) {
            
$package $pool->literalToPackage($literal);

            if (
$package instanceof AliasPackage && $package->isRootPackageAlias()) {
                
$hasLocalAlias true;
                break;
            }
        }

        if (!
$hasLocalAlias) {
            return 
$literals;
        }

        
$selected = array();
        foreach (
$literals as $literal) {
            
$package $pool->literalToPackage($literal);

            if (
$package instanceof AliasPackage && $package->isRootPackageAlias()) {
                
$selected[] = $literal;
            }
        }

        return 
$selected;
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0059 ]--