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/textalk/websocket/lib/Message/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/old/vendor/textalk/websocket/lib/Message/Message.php
<?php

/**
 * Copyright (C) 2014-2022 Textalk/Abicart and contributors.
 *
 * This file is part of Websocket PHP and is free software under the ISC License.
 * License text: https://raw.githubusercontent.com/Textalk/websocket-php/master/COPYING
 */

namespace WebSocket\Message;

use DateTime;

abstract class Message
{
    protected $opcode;
    protected $payload;
    protected $timestamp;

    public function __construct(string $payload = '')
    {
        $this->payload = $payload;
        $this->timestamp = new DateTime();
    }

    public function getOpcode(): string
    {
        return $this->opcode;
    }

    public function getLength(): int
    {
        return strlen($this->payload);
    }

    public function getTimestamp(): DateTime
    {
        return $this->timestamp;
    }

    public function getContent(): string
    {
        return $this->payload;
    }

    public function setContent(string $payload = ''): void
    {
        $this->payload = $payload;
    }

    public function hasContent(): bool
    {
        return $this->payload != '';
    }

    public function __toString(): string
    {
        return get_class($this);
    }

    // Split messages into frames
    public function getFrames(bool $masked = true, int $framesize = 4096): array
    {

        $frames = [];
        $split = str_split($this->getContent(), $framesize) ?: [''];
        foreach ($split as $payload) {
            $frames[] = [false, $payload, 'continuation', $masked];
        }
        $frames[0][2] = $this->opcode;
        $frames[array_key_last($frames)][0] = true;
        return $frames;
    }
}

Spamworldpro Mini