<commit_before><?php

namespace Grid\Paragraph\Model\Dashboard;

use Grid\Customize\Model\Rule;
use Grid\Customize\Model\Rule\HydrateSimpleProperties;
use Grid\Paragraph\Model\Paragraph;
use Zork\Model\LocaleAwareTrait;
use Zork\Model\LocaleAwareInterface;
use Zork\Model\LocaleAwaresAwareInterface;
use Zork\Model\MapperAwareInterface;
use Zork\Model\Mapper\ReadWriteMapperInterface;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\Hydrator\HydratorInterface;

/**
 * \Paragraph\Model\Dashboard\Mapper
 *
 * @author <NAME> <<EMAIL>>
 */
class Mapper implements HydratorInterface,
                        LocaleAwareInterface,
                        ReadWriteMapperInterface,
                        LocaleAwaresAwareInterface
{

    use LocaleAwareTrait;

    /**
     * @var \Paragraph\Model\Dashboard\Customization
     */
    protected $customization;

    /**
     * @var \Paragraph\Model\Paragraph\Mapper
     */
    protected $paragraphMapper;

    /**
     * @var \Customize\Model\Rule\Mapper
     */
    protected $customizeRuleMapper;

    /**
     * @var \Paragraph\Model\Dashboard\Structure
     */
    protected $structurePrototype;

    /**
     * @var \Customize\Model\Rule\HydrateSimpleProperties
     */
    protected $hydrateSimpleProperties;

    /**
     * @return \Paragraph\Model\Dashboard\Customization
     */
    public function getCustomization()
    {
        return $this->customization;
    }

    /**
     * @param \Paragraph\Model\Dashboard\Customization $customization
     * @return \Paragraph\Model\Dashboard\Mapper
     */
    public function setCustomization( Customization $customization )
    {
        $this->customization = $customization;
        return $this;
    }

    /**
     * @return \Paragraph\Model\Paragraph\Mapper
     */
    public function getParagraphMapper()
    {
        return $this->paragraphMapper;
    }

    /**
     * @param \Paragraph\Model\Paragraph\Mapper $paragraphMapper
     * @return \Paragraph\Model\Dashboard\Mapper
     */
    public function setParagraphMapper( Grid\Paragraph\Mapper $paragraphMapper )
    {
        $this->paragraphMapper = $paragraphMapper;
        return $this;
    }

    /**
     * Get locale-awares bound objects
     *
     * @return array
     */
    public function getLocaleAwares()
    {
        return array( $this->getParagraphMapper() );
    }

    /**
     * @return \Customize\Model\Rule\Mapper
     */
    public function getCustomizeRuleMapper()
    {
        return $this->customizeRuleMapper;
    }

    /**
     * @return \Customize\Model\Rule\HydrateSimpleProperties
     */
    public function getHydrateSimpleProperties()
    {
        if ( null === $this->hydrateSimpleProperties )
        {
            $this->hydrateSimpleProperties = new HydrateSimpleProperties(
                $this->getCustomizeRuleMapper()
            );
        }

        return $this->hydrateSimpleProperties;
    }

    /**
     * @param \Customize\Model\Rule\Mapper $customizeRuleMapper
     * @return \Paragraph\Model\Dashboard\Mapper
     */
    public function setCustomizeRuleMapper( Rule\Mapper $customizeRuleMapper )
    {
        $this->customizeRuleMapper = $customizeRuleMapper;
        return $this;
    }

    /**
     * Get structure prototype
     *
     * @return \Zork\Model\Structure\StructureAbstract
     */
    public function getStructurePrototype()
    {
        return $this->structurePrototype;
    }

    /**
     * Set structure prototype
     *
     * @param \Zork\Model\Structure\StructureAbstract $structurePrototype
     * @return \Zork\Model\Mapper\DbAware\ReadOnlyMapperAbstract
     */
    public function setStructurePrototype( $structurePrototype )
    {
        if ( $structurePrototype instanceof MapperAwareInterface )
        {
            $structurePrototype->setMapper( $this );
        }

        $this->structurePrototype = $structurePrototype;
        return $this;
    }

    /**
     * Create structure from plain data
     *
     * @param array $data
     * @return \Zork\Model\Structure\StructureAbstract
     */
    protected function createStructure( array $data )
    {
        $structure = clone $this->structurePrototype;
        $structure->setOptions( $data );

        if ( $structure instanceof MapperAwareInterface )
        {
            $structure->setMapper( $this );
        }

        return $structure;
    }

    /**
     * @param \Paragraph\Model\Paragraph\Mapper $paragraphMapper
     * @param \Customize\Model\Rule\Mapper $customizeRuleMapper
     * @param \Paragraph\Model\Dashboard\Structure $paragraphDashboardStructurePrototype
     */
    public function __construct( Customization $customization,
                                 Grid\Paragraph\Mapper $paragraphMapper,
                                 Rule\Mapper $customizeRuleMapper,
                                 Structure $paragraphDashboardStructurePrototype = null)
    {
        $this->setCustomization( $customization )
             ->setParagraphMapper( $paragraphMapper )
             ->setCustomizeRuleMapper( $customizeRuleMapper )
             ->setStructurePrototype( $paragraphDashboardStructurePrototype ?: new Structure );
    }
<commit_msg>fix typo<commit_after><?php

namespace Grid\Paragraph\Model\Dashboard;

use Grid\Customize\Model\Rule;
use Grid\Customize\Model\Rule\HydrateSimpleProperties;
use Grid\Paragraph\Model\Paragraph;
use Zork\Model\LocaleAwareTrait;
use Zork\Model\LocaleAwareInterface;
use Zork\Model\LocaleAwaresAwareInterface;
use Zork\Model\MapperAwareInterface;
use Zork\Model\Mapper\ReadWriteMapperInterface;
use Zend\Stdlib\ArrayUtils;
use Zend\Stdlib\Hydrator\HydratorInterface;

/**
 * \Paragraph\Model\Dashboard\Mapper
 *
 * @author <NAME> <<EMAIL>>
 */
class Mapper implements HydratorInterface,
                        LocaleAwareInterface,
                        ReadWriteMapperInterface,
                        LocaleAwaresAwareInterface
{

    use LocaleAwareTrait;

    /**
     * @var \Paragraph\Model\Dashboard\Customization
     */
    protected $customization;

    /**
     * @var \Paragraph\Model\Paragraph\Mapper
     */
    protected $paragraphMapper;

    /**
     * @var \Customize\Model\Rule\Mapper
     */
    protected $customizeRuleMapper;

    /**
     * @var \Paragraph\Model\Dashboard\Structure
     */
    protected $structurePrototype;

    /**
     * @var \Customize\Model\Rule\HydrateSimpleProperties
     */
    protected $hydrateSimpleProperties;

    /**
     * @return \Paragraph\Model\Dashboard\Customization
     */
    public function getCustomization()
    {
        return $this->customization;
    }

    /**
     * @param \Paragraph\Model\Dashboard\Customization $customization
     * @return \Paragraph\Model\Dashboard\Mapper
     */
    public function setCustomization( Customization $customization )
    {
        $this->customization = $customization;
        return $this;
    }

    /**
     * @return \Paragraph\Model\Paragraph\Mapper
     */
    public function getParagraphMapper()
    {
        return $this->paragraphMapper;
    }

    /**
     * @param \Paragraph\Model\Paragraph\Mapper $paragraphMapper
     * @return \Paragraph\Model\Dashboard\Mapper
     */
    public function setParagraphMapper( Paragraph\Mapper $paragraphMapper )
    {
        $this->paragraphMapper = $paragraphMapper;
        return $this;
    }

    /**
     * Get locale-awares bound objects
     *
     * @return array
     */
    public function getLocaleAwares()
    {
        return array( $this->getParagraphMapper() );
    }

    /**
     * @return \Customize\Model\Rule\Mapper
     */
    public function getCustomizeRuleMapper()
    {
        return $this->customizeRuleMapper;
    }

    /**
     * @return \Customize\Model\Rule\HydrateSimpleProperties
     */
    public function getHydrateSimpleProperties()
    {
        if ( null === $this->hydrateSimpleProperties )
        {
            $this->hydrateSimpleProperties = new HydrateSimpleProperties(
                $this->getCustomizeRuleMapper()
            );
        }

        return $this->hydrateSimpleProperties;
    }

    /**
     * @param \Customize\Model\Rule\Mapper $customizeRuleMapper
     * @return \Paragraph\Model\Dashboard\Mapper
     */
    public function setCustomizeRuleMapper( Rule\Mapper $customizeRuleMapper )
    {
        $this->customizeRuleMapper = $customizeRuleMapper;
        return $this;
    }

    /**
     * Get structure prototype
     *
     * @return \Zork\Model\Structure\StructureAbstract
     */
    public function getStructurePrototype()
    {
        return $this->structurePrototype;
    }

    /**
     * Set structure prototype
     *
     * @param \Zork\Model\Structure\StructureAbstract $structurePrototype
     * @return \Zork\Model\Mapper\DbAware\ReadOnlyMapperAbstract
     */
    public function setStructurePrototype( $structurePrototype )
    {
        if ( $structurePrototype instanceof MapperAwareInterface )
        {
            $structurePrototype->setMapper( $this );
        }

        $this->structurePrototype = $structurePrototype;
        return $this;
    }

    /**
     * Create structure from plain data
     *
     * @param array $data
     * @return \Zork\Model\Structure\StructureAbstract
     */
    protected function createStructure( array $data )
    {
        $structure = clone $this->structurePrototype;
        $structure->setOptions( $data );

        if ( $structure instanceof MapperAwareInterface )
        {
            $structure->setMapper( $this );
        }

        return $structure;
    }

    /**
     * @param \Paragraph\Model\Paragraph\Mapper $paragraphMapper
     * @param \Customize\Model\Rule\Mapper $customizeRuleMapper
     * @param \Paragraph\Model\Dashboard\Structure $paragraphDashboardStructurePrototype
     */
    public function __construct( Customization $customization,
                                 Paragraph\Mapper $paragraphMapper,
                                 Rule\Mapper $customizeRuleMapper,
                                 Structure $paragraphDashboardStructurePrototype = null)
    {
        $this->setCustomization( $customization )
             ->setParagraphMapper( $paragraphMapper )
             ->setCustomizeRuleMapper( $customizeRuleMapper )
             ->setStructurePrototype( $paragraphDashboardStructurePrototype ?: new Structure );
    }

{'fraction_non_alphanumeric': 0.10231118847306837, 'fraction_numerical': 0.0, 'mean_word_length': 2.3296844816484223, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '980113', 'n_tokens_mistral': 2849, 'n_tokens_neox': 2822, 'n_words': 473}