<commit_before><?php

/**
 * This file is part of the TextGenerator library.
 *
 * @author <NAME> <<EMAIL>>
 * @license MIT http://opensource.org/licenses/MIT
 */

namespace lukaszmakuch\TextGenerator;

use lukaszmakuch\TextGenerator\Exception\UnableToGetText;

/**
 * Ensures that the given input is an object of a supported class.
 * 
 * @author <NAME> <<EMAIL>>
 */
abstract class ObjectTextGenerator implements TextGenerator
{
    public function getTextBasedOn($input)
    {
        $this->throwExceptionIfUnsupported($input);
        return $this->getTextBasedOnObject($input);
    }
    
    /**
     * @return String class of supported objects
     */
    protected abstract function getClassOfSupportedObjects();
    
    /**
     * @param mixed $object object to translate<commit_msg>added doc of the object text generator<commit_after><?php

/**
 * This file is part of the TextGenerator library.
 *
 * @author <NAME> <<EMAIL>>
 * @license MIT http://opensource.org/licenses/MIT
 */

namespace lukaszmakuch\TextGenerator;

use lukaszmakuch\TextGenerator\Exception\UnableToGetText;

/**
 * Template of a generator that converts an object to text.
 * 
 * Ensures that the given input is an object of a supported class.
 * 
 * @author <NAME> <<EMAIL>>
 */
abstract class ObjectTextGenerator implements TextGenerator
{
    public function getTextBasedOn($input)
    {
        $this->throwExceptionIfUnsupported($input);
        return $this->getTextBasedOnObject($input);
    }
    
    /**
     * @return String class of supported objects
     */
    protected abstract function getClassOfSupportedObjects();
    
    /**
     * @param mixed $object object to translate
{'fraction_non_alphanumeric': 0.10554561717352415, 'fraction_numerical': 0.0, 'mean_word_length': 3.4274406332453826, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, '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': '3800458', 'n_tokens_mistral': 468, 'n_tokens_neox': 465, 'n_words': 137}