Sindbad~EG File Manager

Current Path : /opt/nginxhttpd_/vendor/extensions-cpanel/cpanel-development-lib/src/Hook/
Upload File :
Current File : //opt/nginxhttpd_/vendor/extensions-cpanel/cpanel-development-lib/src/Hook/AbstractHook.php

<?php

namespace O2switch\CpanelLib\Hook;

abstract class AbstractHook
{
    protected $data;

    public function __construct()
    {
        $this->data = $this->getPassedData();
    }

    /**
     * Get input from STDIN, return an array.
     *
     * @return array|mixed
     */
    protected function getPassedData()
    {
        $raw_data = '';
        $stdin_fh = fopen('php://stdin', 'r');
        if (is_resource($stdin_fh)) {
            stream_set_blocking($stdin_fh, 0);
            while (($line = fgets($stdin_fh, 1024)) !== false) {
                $raw_data .= trim($line);
            }
            fclose($stdin_fh);
        }

        // Process and JSON-decode the raw output.
        if (!empty($raw_data)) {
            $input_data = json_decode($raw_data, true);
        } else {
            $input_data = array('context' => array(), 'data' => array(), 'hook' => array());
        }

        // Return the output.
        return $input_data;
    }
}

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists