<commit_before><?php
/**********************************************************\
|                                                          |
|                          hprose                          |
|                                                          |
| Official WebSite: http://www.hprose.com/                 |
|                   http://www.hprose.org/                 |
|                                                          |
\**********************************************************/

/**********************************************************\
 *                                                        *
 * HproseService.php                                      *
 *                                                        *
 * hprose service library for php.                        *
 *                                                        *
 * LastModified: Feb 28, 2015                             *
 * Author: <NAME> <<EMAIL>>                  *
 *                                                        *
\**********************************************************/

require_once('HproseCommon.php');
require_once('HproseIO.php');

class HproseRemoteCall {
    public $func;
    public $mode;
    public $simple;
    public function __construct($func, $mode, $simple) {
        $this->func = $func;
        $this->mode = $mode;
        $this->simple = $simple;
    }
}
abstract class HproseService {
    private static $magic_methods = array(
        "__construct",
        "__destruct",
        "__call",
        "__callStatic",
        "__get",
        "__set",
        "__isset",
        "__unset",
        "__sleep",
        "__wakeup",
        "__toString",
        "__invoke",
        "__set_state",
        "__clone"
    );
    protected static $errorTable = array(
        E_ERROR => 'Error',
        E_WARNING => 'Warning',
        E_PARSE => 'Parse Error',
        E_NOTICE => 'Notice',
        E_CORE_ERROR => 'Core Error',
        E_CORE_WARNING => 'Core Warning',
        E_COMPILE_ERROR => 'Compile Error',
        E_COMPILE_WARNING => 'Compile Warning',
        E_DEPRECATED => 'Deprecated',
        E_USER_ERROR => 'User Error',
        E_USER_WARNING => 'User Warning',
        E_USER_NOTICE => 'User Notice',
        E_USER_DEPRECATED => 'User Deprecated',
        E_STRICT => 'Runtime Notice',
        E_RECOVERABLE_ERROR  => 'Catchable Fatal Error'
    );
    private $calls = array();
    private $names = array();
    private $filters = array();
    private $simple = false;
    protected $debug = false;
    protected $error_types;
    public $onBeforeInvoke = null;
    public $onAfterInvoke = null;
    public $onSendError = null;

    public function __construct() {
        $this->error_types = E_ALL & ~E_NOTICE;
    }
    protected function inputFilter($data, $context) {
        $count = count($this->filters);
        for ($i = $count - 1; $i >= 0; $i--) {
            $data = $this->filters[$i]->inputFilter($data, $context);
        }
        return $data;
    }
    protected function outputFilter($data, $context) {
        $count = count($this->filters);
        for ($i = 0; $i < $count; $i++) {
            $data = $this->filters[$i]->outputFilter($data, $context);
        }
        return $data;
    }
    protected function sendError($error, $context) {
        if ($this->onSendError !== null) {
            $sendError = $this->onSendError;
            $sendError($error, $context);
        }
        @ob_clean();
        $data = HproseTags::TagError .
                hprose_serialize_string($error) .
                HproseTags::TagEnd;
        return $this->outputFilter($data, $context);
    }
    protected function doInvoke($input, $context) {
        $output = new HproseStringStream();
        do {
            $name = hprose_unserialize_string_with_stream($input, true);
            $alias = strtolower($name);
            if (array_key_exists($alias, $this->calls)) {
                $call = $this->calls[$alias];
            }
            elseif (array_key_exists('*', $this->calls)) {
                $call = $this->calls['*'];
            }
            else {
                throw new Exception("Can't find this function " . $name . "().");
            }
            $mode = $call->mode;
            $simple = $call->simple;
            if ($simple === null) {
                $simple = $this->simple;
            }
            $args = array();
            $byref = false;
            $tag = $input->getc();
            if ($tag == HproseTags::TagList) {
                $args = hprose_unserialize_list_with_stream($input);
                $tag = $input->getc();
                if ($tag == HproseTags::TagTrue) {
                    $byref = true;
                    $tag = $input->getc();
                }
            }
            if (($tag != HproseTags::TagEnd) && ($tag != HproseTags::TagCall)) {
                throw new Exception('Unknown tag: ' . $tag . "\r\n" .
                                     'with following data: ' . $input->toString());
            }
            if ($this->onBeforeInvoke !== null) {<commit_msg>Fixed pass parameters by reference.<commit_after><?php
/**********************************************************\
|                                                          |
|                          hprose                          |
|                                                          |
| Official WebSite: http://www.hprose.com/                 |
|                   http://www.hprose.org/                 |
|                                                          |
\**********************************************************/

/**********************************************************\
 *                                                        *
 * HproseService.php                                      *
 *                                                        *
 * hprose service library for php.                        *
 *                                                        *
 * LastModified: Mar 5, 2015                              *
 * Author: <NAME> <<EMAIL>>                  *
 *                                                        *
\**********************************************************/

require_once('HproseCommon.php');
require_once('HproseIO.php');

class HproseRemoteCall {
    public $func;
    public $mode;
    public $simple;
    public function __construct($func, $mode, $simple) {
        $this->func = $func;
        $this->mode = $mode;
        $this->simple = $simple;
    }
}
abstract class HproseService {
    private static $magic_methods = array(
        "__construct",
        "__destruct",
        "__call",
        "__callStatic",
        "__get",
        "__set",
        "__isset",
        "__unset",
        "__sleep",
        "__wakeup",
        "__toString",
        "__invoke",
        "__set_state",
        "__clone"
    );
    protected static $errorTable = array(
        E_ERROR => 'Error',
        E_WARNING => 'Warning',
        E_PARSE => 'Parse Error',
        E_NOTICE => 'Notice',
        E_CORE_ERROR => 'Core Error',
        E_CORE_WARNING => 'Core Warning',
        E_COMPILE_ERROR => 'Compile Error',
        E_COMPILE_WARNING => 'Compile Warning',
        E_DEPRECATED => 'Deprecated',
        E_USER_ERROR => 'User Error',
        E_USER_WARNING => 'User Warning',
        E_USER_NOTICE => 'User Notice',
        E_USER_DEPRECATED => 'User Deprecated',
        E_STRICT => 'Runtime Notice',
        E_RECOVERABLE_ERROR  => 'Catchable Fatal Error'
    );
    private $calls = array();
    private $names = array();
    private $filters = array();
    private $simple = false;
    protected $debug = false;
    protected $error_types;
    public $onBeforeInvoke = null;
    public $onAfterInvoke = null;
    public $onSendError = null;

    public function __construct() {
        $this->error_types = E_ALL & ~E_NOTICE;
    }
    protected function inputFilter($data, $context) {
        $count = count($this->filters);
        for ($i = $count - 1; $i >= 0; $i--) {
            $data = $this->filters[$i]->inputFilter($data, $context);
        }
        return $data;
    }
    protected function outputFilter($data, $context) {
        $count = count($this->filters);
        for ($i = 0; $i < $count; $i++) {
            $data = $this->filters[$i]->outputFilter($data, $context);
        }
        return $data;
    }
    protected function sendError($error, $context) {
        if ($this->onSendError !== null) {
            $sendError = $this->onSendError;
            $sendError($error, $context);
        }
        @ob_clean();
        $data = HproseTags::TagError .
                hprose_serialize_string($error) .
                HproseTags::TagEnd;
        return $this->outputFilter($data, $context);
    }
    protected function doInvoke($input, $context) {
        $output = new HproseStringStream();
        do {
            $name = hprose_unserialize_string_with_stream($input, true);
            $alias = strtolower($name);
            if (array_key_exists($alias, $this->calls)) {
                $call = $this->calls[$alias];
            }
            elseif (array_key_exists('*', $this->calls)) {
                $call = $this->calls['*'];
            }
            else {
                throw new Exception("Can't find this function " . $name . "().");
            }
            $mode = $call->mode;
            $simple = $call->simple;
            if ($simple === null) {
                $simple = $this->simple;
            }
            $args = array();
            $byref = false;
            $tag = $input->getc();
            if ($tag == HproseTags::TagList) {
                $args = hprose_unserialize_list_with_stream($input);
                $_args = array();
                foreach($args as &$arg) $_args[] = &$arg;
                $args = $_args;
                $tag = $input->getc();
                if ($tag == HproseTags::TagTrue) {
                    $byref = true;
                    $tag = $input->getc();
                }
            }
            if (($tag != HproseTags::TagEnd) && ($tag != HproseTags::TagCall)) {
                throw new Exception('Unknown tag: ' . $tag . "\r\n" .
                                     'with following data: ' . $input->toString());
            }
            if ($this->onBeforeInvoke !== null) {
{'fraction_non_alphanumeric': 0.17263279445727484, 'fraction_numerical': 0.0016358737490377213, 'mean_word_length': 1.4141695702671313, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 91, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7211566', 'n_tokens_mistral': 2734, 'n_tokens_neox': 2683, 'n_words': 555}