<commit_before><?php
/*
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the MIT license. For more information, see
 * <http://www.doctrine-project.org>.
 */

namespace Doctrine\KeyValueStore\Mapping;

use Doctrine\Common\Persistence\Mapping\ClassMetadata as BaseClassMetadata;

class ClassMetadata implements BaseClassMetadata
{
    public $name;
    public $storageName;
    public $rootClassName;
    public $fields = array();
    public $identifier = array();
    public $isCompositeKey = false;
    public $transientFields = array();
    public $reflFields = array();
    public $reflClass;

    private $_prototype;

    public function __construct($className)
    {
        $this->name = $className;
    }

    public function mapIdentifier($fieldName)
    {
        $this->identifier[] = $fieldName;
        $this->isCompositeKey = count($this->identifier) > 1;
        $this->mapField(array('fieldName' => $fieldName, 'id' => true));
    }

    public function mapField($mapping)
    {
        if ( ! isset($this->transientFields[$mapping['fieldName']])) {
            $this->fields[$mapping['fieldName']] = $mapping;
        }
    }

    public function skipTransientField($fieldName)
    {
        $this->transientFields[$fieldName] = true;
    }

    /**
     * Creates a new instance of the mapped class, without invoking the constructor.
     *
     * @return object
     */
    public function newInstance()
    {
        if ($this->_prototype === null) {
            $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
        }

        return clone $this->_prototype;
    }

    public function __sleep()
    {
        return array('fields', 'isCompositeKey', 'identifier', 'name');
    }

    public function getIdentifierValues($object)
    {
        $id = array();
        foreach ($this->identifier as $field) {
            $value = $this->reflFields[$field]->getValue($object);
            if ($value !== null) {
                $id[$field] = $value;
            }
        }
        return $id;
    }
    /**
     * Get fully-qualified class name of this persistent class.
     *
     * @return string
     */
    function getName(){}

    /**
     * Gets the mapped identifier field name.
     *
     * The returned structure is an array of the identifier field names.
     *
     * @return array
     */
    function getIdentifier(){}<commit_msg>Add missing field for class metadata serialization (needed when using redis cache)<commit_after><?php
/*
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * This software consists of voluntary contributions made by many individuals
 * and is licensed under the MIT license. For more information, see
 * <http://www.doctrine-project.org>.
 */

namespace Doctrine\KeyValueStore\Mapping;

use Doctrine\Common\Persistence\Mapping\ClassMetadata as BaseClassMetadata;

class ClassMetadata implements BaseClassMetadata
{
    public $name;
    public $storageName;
    public $rootClassName;
    public $fields = array();
    public $identifier = array();
    public $isCompositeKey = false;
    public $transientFields = array();
    public $reflFields = array();
    public $reflClass;

    private $_prototype;

    public function __construct($className)
    {
        $this->name = $className;
    }

    public function mapIdentifier($fieldName)
    {
        $this->identifier[] = $fieldName;
        $this->isCompositeKey = count($this->identifier) > 1;
        $this->mapField(array('fieldName' => $fieldName, 'id' => true));
    }

    public function mapField($mapping)
    {
        if ( ! isset($this->transientFields[$mapping['fieldName']])) {
            $this->fields[$mapping['fieldName']] = $mapping;
        }
    }

    public function skipTransientField($fieldName)
    {
        $this->transientFields[$fieldName] = true;
    }

    /**
     * Creates a new instance of the mapped class, without invoking the constructor.
     *
     * @return object
     */
    public function newInstance()
    {
        if ($this->_prototype === null) {
            $this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
        }

        return clone $this->_prototype;
    }

    public function __sleep()
    {
        return array('fields', 'isCompositeKey', 'identifier', 'name', 'storageName');
    }

    public function getIdentifierValues($object)
    {
        $id = array();
        foreach ($this->identifier as $field) {
            $value = $this->reflFields[$field]->getValue($object);
            if ($value !== null) {
                $id[$field] = $value;
            }
        }
        return $id;
    }
    /**
     * Get fully-qualified class name of this persistent class.
     *
     * @return string
     */
    function getName(){}

    /**
     * Gets the mapped identifier field name.
     *
     * The returned structure is an array of the identifier field names.
     *
     * @return array
     */
    function getIdentifier(){}
{'fraction_non_alphanumeric': 0.11075757575757576, 'fraction_numerical': 0.0006060606060606061, 'mean_word_length': 2.8579777907656343, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '1456461', 'n_tokens_mistral': 1837, 'n_tokens_neox': 1715, 'n_words': 589}