Mutagenesis\Mutable::_parseStringToken PHP Метод

_parseStringToken() защищенный Метод

Parse a given token (in string form) to identify its type and ascertain whether it can be replaced with a mutated form. The mutated form, if any, is returned for future integration into a mutated version of the source code being tested.
protected _parseStringToken ( array $token, integer $index ) : mixed
$token array The token to check for viable mutations
$index integer The index of the token in the method's body
Результат mixed Return null if no mutation, or a mutation object
    protected function _parseStringToken($token, $index)
    {
        $type = '';
        switch ($token) {
            case '+':
                $type = 'OperatorAddition';
                break;
            case '-':
                $type = 'OperatorSubtraction';
                break;
        }
        if (!empty($type)) {
            $mutationClass = 'Mutagenesis\\Mutation\\' . $type;
            if (!class_exists($mutationClass)) {
                require_once str_replace('\\', '/', ltrim($mutationClass, '\\')) . '.php';
            }
            $mutation = new $mutationClass($this->getFilename());
            return $mutation;
        }
    }