<commit_before><?php
/**
 * @package Morph
 * @subpackage Property
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME> 2009
 */

/**
 * Allows a Morph_Object to compose many Morph_Objects
 *
 * Composition means that the contained objects will not be
 * saved inidivually to the database. So, they will not get
 * ids and will not be individually retrievable
 *
 * @package Morph
 * @subpackage Property
 */
class  Morph_Property_ComposeMany extends Morph_Property_Generic
{

    /**
     * Holds the name of the class this property should contain
     * @var string
     */
    protected $Type;


    public function __construct($name, $type)
    {
        $this->Type = $type;
        $default = new Morph_Collection();
        $default->setPermissableType($type);
        parent::__construct($name, $default);
    }

    /**
     * (non-PHPdoc)
     * @see tao/classes/Morph/property/Morph_Property_Generic#getValue()
     */
    public function getValue()
    {
        return $this->Value;
    }

    /**
     * (non-PHPdoc)
     * @see tao/classes/Morph/property/Morph_Property_Generic#setValue()
     */
    public function setValue(Morph_Collection $value){
        if ($value->count() > 0) {
            foreach ($value as $object) {
                $this->isPermissableType($object);
            }
        }
        $this->Value = $value;
    }

    /**
     * (non-PHPdoc)
     * @see tao/classes/Morph/property/Morph_Property_Generic#__setRawValue()
     */
    public function __setRawValue($value)
    {
        $collection = new Morph_Collection();
        if (count($value) > 0) {
            foreach ($value as $item) {
                $object = new $this->Type;
                $object->__setData($item, Morph_Object::STATE_CLEAN);
                $collection->append($object);
            }
        }
    }

    /**
     * (non-PHPdoc)
     * @see tao/classes/Morph/Property/Morph_Property_Generic#__getRawValue()
     */
    public function __getRawValue()
    {
        $rawValue = array();
        if($this->Value->count() > 0){
            //$rawValue = $this->Value->getArrayCopy();
            foreach ($this->Value as $value) {
                $rawValue[] = $value->__getData();
            }<commit_msg>fixing issue with the retrieval of compose many properties<commit_after><?php
/**
 * @package Morph
 * @subpackage Property
 * @author <NAME> <<EMAIL>>
 * @copyright <NAME> 2009
 */

/**
 * Allows a Morph_Object to compose many Morph_Objects
 *
 * Composition means that the contained objects will not be
 * saved inidivually to the database. So, they will not get
 * ids and will not be individually retrievable
 *
 * @package Morph
 * @subpackage Property
 */
class  Morph_Property_ComposeMany extends Morph_Property_Generic
{

    /**
     * Holds the name of the class this property should contain
     * @var string
     */
    protected $Type;


    public function __construct($name, $type)
    {
        $this->Type = $type;
        $default = new Morph_Collection();
        $default->setPermissableType($type);
        parent::__construct($name, $default);
    }

    /**
     * (non-PHPdoc)
     * @see tao/classes/Morph/property/Morph_Property_Generic#getValue()
     */
    public function getValue()
    {
        return $this->Value;
    }

    /**
     * (non-PHPdoc)
     * @see tao/classes/Morph/property/Morph_Property_Generic#setValue()
     */
    public function setValue(Morph_Collection $value){
        if ($value->count() > 0) {
            foreach ($value as $object) {
                $this->isPermissableType($object);
            }
        }
        $this->Value = $value;
    }

    /**
     * (non-PHPdoc)
     * @see tao/classes/Morph/property/Morph_Property_Generic#__setRawValue()
     */
    public function __setRawValue($value)
    {
        $collection = new Morph_Collection();
        if (count($value) > 0) {
            foreach ($value as $item) {
                $object = new $this->Type;
                $object->__setData($item, Morph_Object::STATE_CLEAN);
                $collection->append($object);
            }
        }
        $this->Value = $collection;
    }

    /**
     * (non-PHPdoc)
     * @see tao/classes/Morph/Property/Morph_Property_Generic#__getRawValue()
     */
    public function __getRawValue()
    {
        $rawValue = array();
        if($this->Value->count() > 0){
            //$rawValue = $this->Value->getArrayCopy();
            foreach ($this->Value as $value) {
                $rawValue[] = $value->__getData();
            }
{'fraction_non_alphanumeric': 0.13230429988974643, 'fraction_numerical': 0.0030871003307607497, 'mean_word_length': 2.183157894736842, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 48, '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': '5318215', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1330, 'n_words': 296}