<commit_before><?php
namespace Perry\Representation;

class Base
{
    protected $genericMembers = array();

    /**
     * @param null|array|object|string $inputData
     * @throws \Exception
     */
    public function __construct($inputData)
    {
        if (is_null($inputData)) {
            throw new \Exception("got NULL in Base Construtor");
        }
        if (!is_array($inputData) && !is_object($inputData)) {
            $inputData = json_decode($inputData, false);
        }

        if (is_object($inputData)) {
            $inputData = get_object_vars($inputData);
        }

        foreach ($inputData as $key => $value) {
            $method = 'set'.ucfirst($key);
            // if there is a setter method for this call the setter
            if (method_exists($this, $method)) {
                $this->{$method}($value);
            } else {<commit_msg>make sure inputData is traversable<commit_after><?php
namespace Perry\Representation;

class Base
{
    protected $genericMembers = array();

    /**
     * @param null|array|object|string $inputData
     * @throws \Exception
     */
    public function __construct($inputData)
    {
        if (is_null($inputData)) {
            throw new \Exception("got NULL in Base Construtor");
        }
        if (!is_array($inputData) && !is_object($inputData)) {
            $inputData = json_decode($inputData, false);
        }

        if (is_object($inputData)) {
            $inputData = get_object_vars($inputData);
        }

        if (!is_array($inputData)) {
            throw new \Exception("$inputData is not an array, and therefor can't be traversed");
        }

        foreach ($inputData as $key => $value) {
            $method = 'set'.ucfirst($key);
            // if there is a setter method for this call the setter
            if (method_exists($this, $method)) {
                $this->{$method}($value);
            } else {
{'fraction_non_alphanumeric': 0.13072916666666667, 'fraction_numerical': 0.0, 'mean_word_length': 2.144026186579378, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3377774', 'n_tokens_mistral': 546, 'n_tokens_neox': 535, 'n_words': 134}