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

Software: Apache/2.4.68 (Linux) PHP/7.4.33. PHP/7.4.33 

uname -a: Linux bjb2293782.nichost.ru 6.6.151-1.el8.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Aug 10
11:16:02 MSK 2026 x86_64
 

uid=12584(bjb2293782) gid=12584(bjb2293782) groups=12584(bjb2293782)  

Safe-mode: OFF (not secure)

/usr/share/php/Composer/IO/   drwxr-xr-x
Free 60.59 GB of 99.95 GB (60.62%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     ConsoleIO.php (10.25 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php declare(strict_types=1);

/*
 * 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\IO;

use 
Composer\Question\StrictConfirmationQuestion;
use 
Symfony\Component\Console\Helper\HelperSet;
use 
Symfony\Component\Console\Helper\ProgressBar;
use 
Symfony\Component\Console\Helper\Table;
use 
Symfony\Component\Console\Input\InputInterface;
use 
Symfony\Component\Console\Output\ConsoleOutputInterface;
use 
Symfony\Component\Console\Output\OutputInterface;
use 
Symfony\Component\Console\Question\ChoiceQuestion;
use 
Symfony\Component\Console\Question\Question;

/**
 * The Input/Output helper.
 *
 * @author François Pluchino <francois.pluchino@opendisplay.com>
 * @author Jordi Boggiano <j.boggiano@seld.be>
 */
class ConsoleIO extends BaseIO
{
    
/** @var InputInterface */
    
protected $input;
    
/** @var OutputInterface */
    
protected $output;
    
/** @var HelperSet */
    
protected $helperSet;
    
/** @var string */
    
protected $lastMessage '';
    
/** @var string */
    
protected $lastMessageErr '';

    
/** @var float */
    
private $startTime;
    
/** @var array<IOInterface::*, OutputInterface::VERBOSITY_*> */
    
private $verbosityMap;

    
/**
     * Constructor.
     *
     * @param InputInterface  $input     The input instance
     * @param OutputInterface $output    The output instance
     * @param HelperSet       $helperSet The helperSet instance
     */
    
public function __construct(InputInterface $inputOutputInterface $outputHelperSet $helperSet)
    {
        
$this->input $input;
        
$this->output $output;
        
$this->helperSet $helperSet;
        
$this->verbosityMap = [
            
self::QUIET => OutputInterface::VERBOSITY_QUIET,
            
self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
            
self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
            
self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
            
self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
        ];
    }

    
/**
     * @return void
     */
    
public function enableDebugging(float $startTime)
    {
        
$this->startTime $startTime;
    }

    
/**
     * @inheritDoc
     */
    
public function isInteractive()
    {
        return 
$this->input->isInteractive();
    }

    
/**
     * @inheritDoc
     */
    
public function isDecorated()
    {
        return 
$this->output->isDecorated();
    }

    
/**
     * @inheritDoc
     */
    
public function isVerbose()
    {
        return 
$this->output->isVerbose();
    }

    
/**
     * @inheritDoc
     */
    
public function isVeryVerbose()
    {
        return 
$this->output->isVeryVerbose();
    }

    
/**
     * @inheritDoc
     */
    
public function isDebug()
    {
        return 
$this->output->isDebug();
    }

    
/**
     * @inheritDoc
     */
    
public function write($messagesbool $newline trueint $verbosity self::NORMAL)
    {
        
$this->doWrite($messages$newlinefalse$verbosity);
    }

    
/**
     * @inheritDoc
     */
    
public function writeError($messagesbool $newline trueint $verbosity self::NORMAL)
    {
        
$this->doWrite($messages$newlinetrue$verbosity);
    }

    
/**
     * @inheritDoc
     */
    
public function writeRaw($messagesbool $newline trueint $verbosity self::NORMAL)
    {
        
$this->doWrite($messages$newlinefalse$verbositytrue);
    }

    
/**
     * @inheritDoc
     */
    
public function writeErrorRaw($messagesbool $newline trueint $verbosity self::NORMAL)
    {
        
$this->doWrite($messages$newlinetrue$verbositytrue);
    }

    
/**
     * @param string[]|string $messages
     */
    
private function doWrite($messagesbool $newlinebool $stderrint $verbositybool $raw false): void
    
{
        
$sfVerbosity $this->verbosityMap[$verbosity];
        if (
$sfVerbosity $this->output->getVerbosity()) {
            return;
        }

        if (
$raw) {
            
$sfVerbosity |= OutputInterface::OUTPUT_RAW;
        }

        if (
null !== $this->startTime) {
            
$memoryUsage memory_get_usage() / 1024 1024;
            
$timeSpent microtime(true) - $this->startTime;
            
$messages array_map(static function ($message) use ($memoryUsage$timeSpent): string {
                return 
sprintf('[%.1fMiB/%.2fs] %s'$memoryUsage$timeSpent$message);
            }, (array) 
$messages);
        }

        if (
true === $stderr && $this->output instanceof ConsoleOutputInterface) {
            
$this->output->getErrorOutput()->write($messages$newline$sfVerbosity);
            
$this->lastMessageErr implode($newline "\n" '', (array) $messages);

            return;
        }

        
$this->output->write($messages$newline$sfVerbosity);
        
$this->lastMessage implode($newline "\n" '', (array) $messages);
    }

    
/**
     * @inheritDoc
     */
    
public function overwrite($messagesbool $newline true, ?int $size nullint $verbosity self::NORMAL)
    {
        
$this->doOverwrite($messages$newline$sizefalse$verbosity);
    }

    
/**
     * @inheritDoc
     */
    
public function overwriteError($messagesbool $newline true, ?int $size nullint $verbosity self::NORMAL)
    {
        
$this->doOverwrite($messages$newline$sizetrue$verbosity);
    }

    
/**
     * @param string[]|string $messages
     */
    
private function doOverwrite($messagesbool $newline, ?int $sizebool $stderrint $verbosity): void
    
{
        
// messages can be an array, let's convert it to string anyway
        
$messages implode($newline "\n" '', (array) $messages);

        
// since overwrite is supposed to overwrite last message...
        
if (!isset($size)) {
            
// removing possible formatting of lastMessage with strip_tags
            
$size strlen(strip_tags($stderr $this->lastMessageErr $this->lastMessage));
        }
        
// ...let's fill its length with backspaces
        
$this->doWrite(str_repeat("\x08"$size), false$stderr$verbosity);

        
// write the new message
        
$this->doWrite($messagesfalse$stderr$verbosity);

        
// In cmd.exe on Win8.1 (possibly 10?), the line can not be cleared, so we need to
        // track the length of previous output and fill it with spaces to make sure the line is cleared.
        // See https://github.com/composer/composer/pull/5836 for more details
        
$fill $size strlen(strip_tags($messages));
        if (
$fill 0) {
            
// whitespace whatever has left
            
$this->doWrite(str_repeat(' '$fill), false$stderr$verbosity);
            
// move the cursor back
            
$this->doWrite(str_repeat("\x08"$fill), false$stderr$verbosity);
        }

        if (
$newline) {
            
$this->doWrite(''true$stderr$verbosity);
        }

        if (
$stderr) {
            
$this->lastMessageErr $messages;
        } else {
            
$this->lastMessage $messages;
        }
    }

    
/**
     * @return ProgressBar
     */
    
public function getProgressBar(int $max 0)
    {
        return new 
ProgressBar($this->getErrorOutput(), $max);
    }

    
/**
     * @inheritDoc
     */
    
public function ask($question$default null)
    {
        
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
        
$helper $this->helperSet->get('question');
        
$question = new Question($question$default);

        return 
$helper->ask($this->input$this->getErrorOutput(), $question);
    }

    
/**
     * @inheritDoc
     */
    
public function askConfirmation($question$default true)
    {
        
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
        
$helper $this->helperSet->get('question');
        
$question = new StrictConfirmationQuestion($question$default);

        return 
$helper->ask($this->input$this->getErrorOutput(), $question);
    }

    
/**
     * @inheritDoc
     */
    
public function askAndValidate($question$validator$attempts null$default null)
    {
        
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
        
$helper $this->helperSet->get('question');
        
$question = new Question($question$default);
        
$question->setValidator($validator);
        
$question->setMaxAttempts($attempts);

        return 
$helper->ask($this->input$this->getErrorOutput(), $question);
    }

    
/**
     * @inheritDoc
     */
    
public function askAndHideAnswer($question)
    {
        
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
        
$helper $this->helperSet->get('question');
        
$question = new Question($question);
        
$question->setHidden(true);

        return 
$helper->ask($this->input$this->getErrorOutput(), $question);
    }

    
/**
     * @inheritDoc
     */
    
public function select($question$choices$default$attempts false$errorMessage 'Value "%s" is invalid'$multiselect false)
    {
        
/** @var \Symfony\Component\Console\Helper\QuestionHelper $helper */
        
$helper $this->helperSet->get('question');
        
$question = new ChoiceQuestion($question$choices$default);
        
$question->setMaxAttempts($attempts ?: null); // IOInterface requires false, and Question requires null or int
        
$question->setErrorMessage($errorMessage);
        
$question->setMultiselect($multiselect);

        
$result $helper->ask($this->input$this->getErrorOutput(), $question);

        
$isAssoc = (bool) \count(array_filter(array_keys($choices), 'is_string'));
        if (
$isAssoc) {
            return 
$result;
        }

        if (!
is_array($result)) {
            return (string) 
array_search($result$choicestrue);
        }

        
$results = [];
        foreach (
$choices as $index => $choice) {
            if (
in_array($choice$resulttrue)) {
                
$results[] = (string) $index;
            }
        }

        return 
$results;
    }

    public function 
getTable(): Table
    
{
        return new 
Table($this->output);
    }

    private function 
getErrorOutput(): OutputInterface
    
{
        if (
$this->output instanceof ConsoleOutputInterface) {
            return 
$this->output->getErrorOutput();
        }

        return 
$this->output;
    }
}

:: 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.0058 ]--