<commit_before><?php

namespace IntraLibrary\LibraryObject;

use \IntraLibrary\IntraLibraryException;

/**
 * A lightweight object representing taxonomy data from the REST Taxonomy service
 *
 * @package IntraLibrary_PHP
 * @author  <NAME>, <<EMAIL>>
 *
 */
class TaxonomyObject
{
    const TAXONOMY 	= 'taxonomy';
    const TAXON 	= 'taxon';

    private $type;
    private $identifier;
    private $name;
    private $description;
    private $refId;
    private $source;
    private $parentId 	= null;
    private $parentType = null;
    private $childIds 	= array();
    private $usefors		= null;

    /**
     * Create an IntraLibrary Taxonomy Object
     * (used to represent Taxons and Taxonomies)
     *
     * @param string $type The type of taxonomy object
     * @param array  $data The taxon object's data
     * @throws IntraLibraryException if the type does not match self::TAXON or self::TAXONOMY
     */
    public function __construct($type, $data)
    {
        $this->identifier	= $data['id'];
        $this->name 		= $data['name'];
        $this->description 	= $data['description'];
        $this->usefors 		= isset($data['usefors']) ? $data['usefors'] : NULL;

        switch ($type) {
            case self::TAXON:
                $this->refId = $data['refId'];
                break;
            case self::TAXONOMY:
                $this->source = $data['source'];
                break;
            default:
                throw new IntraLibraryException('Invalid Taxonomy Object type');
        }

        $this->type 		= $type;
    }

    /**
     * Set this object's parent data
     *
     * @param TaxonomyObject $parent the parent object
     * @return void<commit_msg>checkstyle fix<commit_after><?php

namespace IntraLibrary\LibraryObject;

use \IntraLibrary\IntraLibraryException;

/**
 * A lightweight object representing taxonomy data from the REST Taxonomy service
 *
 * @package IntraLibrary_PHP
 * @author  <NAME>, <<EMAIL>>
 *
 */
class TaxonomyObject
{
    const TAXONOMY 	= 'taxonomy';
    const TAXON 	= 'taxon';

    private $type;
    private $identifier;
    private $name;
    private $description;
    private $refId;
    private $source;
    private $parentId 	= null;
    private $parentType = null;
    private $childIds 	= array();
    private $usefors		= null;

    /**
     * Create an IntraLibrary Taxonomy Object
     * (used to represent Taxons and Taxonomies)
     *
     * @param string $type The type of taxonomy object
     * @param array  $data The taxon object's data
     * @throws IntraLibraryException if the type does not match self::TAXON or self::TAXONOMY
     */
    public function __construct($type, $data)
    {
        $this->identifier	= $data['id'];
        $this->name 		= $data['name'];
        $this->description 	= $data['description'];
        $this->usefors 		= isset($data['usefors']) ? $data['usefors'] : null;

        switch ($type) {
            case self::TAXON:
                $this->refId = $data['refId'];
                break;
            case self::TAXONOMY:
                $this->source = $data['source'];
                break;
            default:
                throw new IntraLibraryException('Invalid Taxonomy Object type');
        }

        $this->type 		= $type;
    }

    /**
     * Set this object's parent data
     *
     * @param TaxonomyObject $parent the parent object
     * @return void
{'fraction_non_alphanumeric': 0.11688693098384728, 'fraction_numerical': 0.0, 'mean_word_length': 2.300387596899225, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 23, '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': '6205', 'n_tokens_mistral': 1039, 'n_tokens_neox': 998, 'n_words': 276}