<commit_before><?php
/**
 * @author Jenner <<EMAIL>>
 * @license https://opensource.org/licenses/MIT MIT
 * @datetime: 2015/11/11 17:50
 */

namespace Jenner\SimpleFork;


class Utils
{
    public static function checkOverwriteRunMethod($child_class)
    {
        $parent_class = '\\Jenner\\SimpleFork\\Process';
        if ($child_class == $parent_class) {
            $message = "you should extend the `{$parent_class}`" .
                " and overwrite the run method";
            throw new \RuntimeException($message);
        }

        $child = new \ReflectionClass($child_class);
        $parent_methods = $child->getParentClass()->getMethods(\ReflectionMethod::IS_PUBLIC);

        foreach ($parent_methods as $parent_method) {
            if ($parent_method->getName() !== 'run') continue;

            $declaring_class = $child->getMethod($parent_method->getName())
                ->getDeclaringClass()
                ->getName();

            echo $declaring_class . PHP_EOL;
            echo $parent_class . PHP_EOL;
            if ($declaring_class === $parent_class) {
                $message = "you must overwrite the run method";
                throw new \RuntimeException($message);
            }
        }
    }
}<commit_msg>tests<commit_after><?php
/**
 * @author Jenner <<EMAIL>>
 * @license https://opensource.org/licenses/MIT MIT
 * @datetime: 2015/11/11 17:50
 */

namespace Jenner\SimpleFork;


class Utils
{
    public static function checkOverwriteRunMethod($child_class)
    {
        $parent_class = '\\Jenner\\SimpleFork\\Process';
        if ($child_class == $parent_class) {
            $message = "you should extend the `{$parent_class}`" .
                " and overwrite the run method";
            throw new \RuntimeException($message);
        }

        $child = new \ReflectionClass($child_class);
        $parent_methods = $child->getParentClass()->getMethods(\ReflectionMethod::IS_PUBLIC);

        foreach ($parent_methods as $parent_method) {
            if ($parent_method->getName() !== 'run') continue;

            $declaring_class = $child->getMethod($parent_method->getName())
                ->getDeclaringClass()
                ->getName();

            if ($declaring_class === $parent_class) {
                $message = "you must overwrite the run method";
                throw new \RuntimeException($message);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.13305613305613306, 'fraction_numerical': 0.00997920997920998, 'mean_word_length': 2.264586160108548, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, 'https://': 2, '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': '709972', 'n_tokens_mistral': 692, 'n_tokens_neox': 648, 'n_words': 140}