<commit_before><?php

namespace Devedge\XmlRpc\Server\Handlers;

use Devedge\XmlRpc\Server\HandlerInterface;

/***
 * Class SimpleHandler
 * the most simple of handlers, will take a random object and call its methods
 * @package Devedge\XmlRpc\Server\Handlers
 */
class SimpleHandler implements HandlerInterface
{

    protected $myObject;

    /**
     * @var \ReflectionClass
     */
    protected $reflectionClass;

    /**
     * @var string
     */
    protected $namespace;

    public function __construct($object, $namespace = null)
    {
        $this->myObject = $object;
        $this->reflectionClass = new \ReflectionClass($this->myObject);
        if (is_null($namespace)) {
            $namespace = __CLASS__;
        }
        $this->namespace = $namespace;
    }

    /**
     * @return array
     */
    public function getMethods()
    {
        $methods = [];
        foreach($this->reflectionClass->getMethods() as $method)
        {
            if (
                $method->isPublic() // only public
                && !$method->isStatic() // no static
                && substr($method->getName(), 0, 2) != '__' // no magic
            ){
                $methods[] = $method->getName();
            }

        }
        return $methods;
    }

    /**
     * @param string $method
     * @param array $params
     * @return string
     */
    public function handle($method, $params)
    {
        $method = $this->reflectionClass->getMethod($method);<commit_msg>workarround for some old apc bug that scrutinizier-ci is whining about<commit_after><?php

namespace Devedge\XmlRpc\Server\Handlers;

use Devedge\XmlRpc\Server\HandlerInterface;

/***
 * Class SimpleHandler
 * the most simple of handlers, will take a random object and call its methods
 * @package Devedge\XmlRpc\Server\Handlers
 */
class SimpleHandler implements HandlerInterface
{

    protected $myObject;

    /**
     * @var \ReflectionClass
     */
    protected $reflectionClass;

    /**
     * @var string
     */
    protected $namespace;

    public function __construct($object, $namespace = null)
    {
        $this->myObject = $object;
        $this->reflectionClass = new \ReflectionClass($this->myObject);
        if (is_null($namespace)) {
            $namespace = __CLASS__;
        }
        $this->namespace = $namespace;
    }

    /**
     * @return array
     */
    public function getMethods()
    {
        $methods = [];
        foreach($this->reflectionClass->getMethods() as $method)
        {
            if (
                $method->isPublic() // only public
                && !$method->isStatic() // no static
                && substr($method->name, 0, 2) != '__' // no magic
            ){
                $methods[] = $method->name;
            }

        }
        return $methods;
    }

    /**
     * @param string $method
     * @param array $params
     * @return string
     */
    public function handle($method, $params)
    {
        $method = $this->reflectionClass->getMethod($method);
{'fraction_non_alphanumeric': 0.13000330797221304, 'fraction_numerical': 0.0013231888852133643, 'mean_word_length': 1.9763779527559056, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '6124100', 'n_tokens_mistral': 860, 'n_tokens_neox': 830, 'n_words': 193}