<commit_before><?php
/**
 * Created by IntelliJ IDEA.
 * User: rek
 * Date: 2016/6/17
 * Time: 下午2:32
 */

namespace x2ts\rpc;


use ReflectionObject;
use x2ts\Component;
use x2ts\ComponentFactory as X;
use x2ts\Toolkit;

/**
 * Class RPCWrapper
 *
 * @package x2ts\rpc
 */
abstract class RPCWrapper extends Component {
    protected $package = null;

    public function __construct() {
        if ($this->package === null) {
            $this->package = Toolkit::to_snake_case(
                (new ReflectionObject($this))->getShortName()
            );
        }
    }

    /**
     * @return bool|string
     */
    private function findRpcComponentId() {
        /** @var array $componentArr */
        $componentArr = X::conf('component');
        foreach ($componentArr as $name => $conf) {
            if ($conf['class'] === RPC::class) {
                return $name;
            }
        }
        return false;
    }

    /**
     * @param string $name
     * @param array  $arguments
     *
     * @return mixed
     * @throws \x2ts\rpc\RPCException
     */
    public function __call($name, $arguments) {
        Toolkit::trace("Package: {$this->package}");
        $rpc = $this->findRpcComponentId();<commit_msg>make findRpcComponentId as protected function<commit_after><?php
/**
 * Created by IntelliJ IDEA.
 * User: rek
 * Date: 2016/6/17
 * Time: 下午2:32
 */

namespace x2ts\rpc;


use ReflectionObject;
use x2ts\Component;
use x2ts\ComponentFactory as X;
use x2ts\Toolkit;

/**
 * Class RPCWrapper
 *
 * @package x2ts\rpc
 */
abstract class RPCWrapper extends Component {
    protected $package = null;

    public function __construct() {
        if ($this->package === null) {
            $this->package = Toolkit::to_snake_case(
                (new ReflectionObject($this))->getShortName()
            );
        }
    }

    /**
     * @return bool|string
     */
    protected function findRpcComponentId() {
        /** @var array $componentArr */
        $componentArr = X::conf('component');
        foreach ($componentArr as $name => $conf) {
            if ($conf['class'] === RPC::class) {
                return $name;
            }
        }
        return false;
    }

    /**
     * @param string $name
     * @param array  $arguments
     *
     * @return mixed
     * @throws \x2ts\rpc\RPCException
     */
    public function __call($name, $arguments) {
        Toolkit::trace("Package: {$this->package}");
        $rpc = $this->findRpcComponentId();
{'fraction_non_alphanumeric': 0.14136546184738955, 'fraction_numerical': 0.01285140562248996, 'mean_word_length': 2.141235813366961, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6299930', 'n_tokens_mistral': 785, 'n_tokens_neox': 762, 'n_words': 173}