<commit_before><?php

namespace Ornament\Json;

use Ornament\Core\Decorator;
use JsonSerializable;
use StdClass;
use Iterator;
use Countable;

class Property extends Decorator implements JsonSerializable, Iterator, Countable
{
    private $decoded = null;
    private $position = 0;

    public function __construct(StdClass $object, string $property)
    {
        parent::__construct($object, $property);
        if (is_string($object->$property)) {
            $this->decoded = json_decode($object->$property);
        } else {
            $this->decoded = (object)$object->$property;
        }
    }

    public function __get(string $prop)<commit_msg>throw domainexception if not json<commit_after><?php

namespace Ornament\Json;

use Ornament\Core\Decorator;
use JsonSerializable;
use StdClass;
use Iterator;
use Countable;
use DomainException;

class Property extends Decorator implements JsonSerializable, Iterator, Countable
{
    private $decoded = null;
    private $position = 0;

    public function __construct(StdClass $object, string $property)
    {
        parent::__construct($object, $property);
        if (is_string($object->$property)) {
            if (!($decoded = json_decode($object->$property))) {
                throw new DomainException($object->$property);
            }
            $this->decoded = json_decode($object->$property);
        } else {
            $this->decoded = (object)$object->$property;
        }
    }

    public function __get(string $prop)
{'fraction_non_alphanumeric': 0.1157190635451505, 'fraction_numerical': 0.0013377926421404682, 'mean_word_length': 3.202247191011236, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '2799538', 'n_tokens_mistral': 429, 'n_tokens_neox': 420, 'n_words': 103}