<commit_before><?php
/**
 * Created by JiangJiaCai.
 * User: Administrator
 * Date: 2017/8/29 0029
 * Time: 10:43
 */

namespace com_jjcbs\lib;


use com_jjcbs\exceptions\AnnotationException;
use com_jjcbs\fun\AnnotationFun;
use com_jjcbs\interfaces\AnnotationMethodInterface;

/**
 * Class AnnotationMethodAbstract
 * @package com_jjcbs\lib
 */
abstract class AnnotationMethodAbstract implements AnnotationMethodInterface
{
    const DISABLE_SWITCH_NAME = 'disable';
    protected static $argv = [];
    protected static $param = [];
    protected static $input = '';
    protected static $body = ''; // body content

    /**
     * @param string $input
     * @return object
     */
    public static function setInput(string $input)
    {
        self::$input = $input;
    }



    public static function exec(array $argv, array $param, string $input = '')
    {
        // TODO: Implement exec() method.
        self::$argv = $argv;
        self::$param = $param;
        self::$body = $input;

        try{
            $funName = self::getMethodName();
            if ( self::DISABLE_SWITCH_NAME  === static::$funName(static::do()) ){
                throw new AnnotationException('the annotation not has ' . $funName . 'fun');
            }
            // return output
            return self::$input;
        }catch (AnnotationException $exception){
            static::exception($exception);
        }
    }

    /**
     * parsed method name
     * @return string
     */
    protected static function getMethodName(){
        return isset(self::$argv['methodName']) ? 'parsedMethod' : (self::$argv['varName'] ? 'parsedVar' : 'parsedClass');
    }

    /**
     * parsing method replace static $input
     * @param $data
     * @return mixed
     */
    abstract static protected function parsedMethod($data = null);
    abstract static protected function parsedClass($data = null);
    abstract static protected function parsedVar($data = null);

    /**
     * the annotation must do things
     * you must implement the method
     * @return mixed
     */
    abstract static protected function do();

    /**
     * if exception
     * @param AnnotationException $exception
     * @return mixed
     */
    abstract static protected function exception(AnnotationException $exception);
<commit_msg>修复一个undefind index  bug<commit_after><?php
/**
 * Created by JiangJiaCai.
 * User: Administrator
 * Date: 2017/8/29 0029
 * Time: 10:43
 */

namespace com_jjcbs\lib;


use com_jjcbs\exceptions\AnnotationException;
use com_jjcbs\fun\AnnotationFun;
use com_jjcbs\interfaces\AnnotationMethodInterface;

/**
 * Class AnnotationMethodAbstract
 * @package com_jjcbs\lib
 */
abstract class AnnotationMethodAbstract implements AnnotationMethodInterface
{
    const DISABLE_SWITCH_NAME = 'disable';
    protected static $argv = [];
    protected static $param = [];
    protected static $input = '';
    protected static $body = ''; // body content

    /**
     * @param string $input
     * @return object
     */
    public static function setInput(string $input)
    {
        self::$input = $input;
    }



    public static function exec(array $argv, array $param, string $input = '')
    {
        // TODO: Implement exec() method.
        self::$argv = $argv;
        self::$param = $param;
        self::$body = $input;

        try{
            $funName = self::getMethodName();
            if ( self::DISABLE_SWITCH_NAME  === static::$funName(static::do()) ){
                throw new AnnotationException('the annotation not has ' . $funName . 'fun');
            }
            // return output
            return self::$input;
        }catch (AnnotationException $exception){
            static::exception($exception);
        }
    }

    /**
     * parsed method name
     * @return string
     */
    protected static function getMethodName(){
        return isset(self::$argv['methodName']) ? 'parsedMethod' : (isset(self::$argv['varName']) ? 'parsedVar' : 'parsedClass');
    }

    /**
     * parsing method replace static $input
     * @param $data
     * @return mixed
     */
    abstract static protected function parsedMethod($data = null);
    abstract static protected function parsedClass($data = null);
    abstract static protected function parsedVar($data = null);

    /**
     * the annotation must do things
     * you must implement the method
     * @return mixed
     */
    abstract static protected function do();

    /**
     * if exception
     * @param AnnotationException $exception
     * @return mixed
     */
    abstract static protected function exception(AnnotationException $exception);

{'fraction_non_alphanumeric': 0.1185089420383538, 'fraction_numerical': 0.006464124111182934, 'mean_word_length': 2.609642301710731, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2265714', 'n_tokens_mistral': 1274, 'n_tokens_neox': 1247, 'n_words': 342}