Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/old/vendor/codeception/codeception/src/Codeception/Lib/Console/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/codeception/codeception/src/Codeception/Lib/Console/ReplHistory.php
<?php

declare(strict_types=1);

namespace Codeception\Lib\Console;

class ReplHistory
{
    protected string $outputFile;

    protected array $stashedCommands = [];

    protected static ?self $instance = null;

    private function __construct()
    {
        $this->outputFile = codecept_output_dir('stashed-commands');

        if (file_exists($this->outputFile)) {
            unlink($this->outputFile);
        }
    }

    public static function getInstance(): ReplHistory
    {
        if (static::$instance == null) {
            static::$instance = new self();
        }

        return static::$instance;
    }

    public function add($command): void
    {
        $this->stashedCommands[] = $command;
    }

    public function getAll(): array
    {
        return $this->stashedCommands;
    }

    public function clear(): void
    {
        $this->stashedCommands = [];
    }

    public function save(): void
    {
        if (empty($this->stashedCommands)) {
            return;
        }

        file_put_contents($this->outputFile, implode("\n", $this->stashedCommands) . "\n", FILE_APPEND);

        codecept_debug("Stashed commands have been saved to {$this->outputFile}");

        $this->clear();
    }
}

Spamworldpro Mini