<commit_before><?php
/**
 * ProductLang
 *
 * FoodCoopShop - The open source software for your foodcoop
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @since         FoodCoopShop 1.0.0
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 * @author        <NAME> <<EMAIL>>
 * @copyright     Copyright (c) <NAME>, http://www.rothauer-it.com
 * @link          https://www.foodcoopshop.com
 */
class ProductLang extends AppModel
{

    public $useTable = 'product_lang';

    public $primaryKey = 'id_product';

    public $belongsTo = array(
        'Product' => array(
            'foreignKey' => 'id_product'
        )
    );

    /**
     * @param array $products
     *  Array
     *  (
     *      [0] => Array
     *          (
     *              [productId] => Array
     *                  (
     *                      [name] => Brokkoli-1
     *                      [description] => gr�nes Gem�se: Strunk mit R�schen auch angeschwollenen Knospen-1
     *                      [description_short] => kbA, vom Gem�sehof Wild-Obermayr-1
     *                      [unity] => ca. 0,4 kg-1
     *                  )
     *          )
     *  )
     * @return boolean $success
     */
    public function changeName($products)
    {

        $productsLang2save = array();

        foreach ($products as $product) {
            $productId = key($product);
            $name = $product[$productId];
            $ids = $this->Product->getProductIdAndAttributeId($productId);
            if ($ids['attributeId'] > 0) {
                throw new InvalidParameterException('change name is not allowed for product attributes');
            }
            $newName = StringComponent::removeSpecialChars(strip_tags(trim($name['name'])));
            if (strlen($newName) < 2) {
                throw new InvalidParameterException('Der Name des Produktes <b>'.$newName.'</b> muss mindestens zwei Zeichen lang sein.');
            } else {
                $productsLang2save[] = array(
                    'id_product' => $ids['productId'],<commit_msg>umlaute<commit_after><?php
/**
 * ProductLang
 *
 * FoodCoopShop - The open source software for your foodcoop
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @since         FoodCoopShop 1.0.0
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 * @author        <NAME> <<EMAIL>>
 * @copyright     Copyright (c) <NAME>, http://www.rothauer-it.com
 * @link          https://www.foodcoopshop.com
 */
class ProductLang extends AppModel
{

    public $useTable = 'product_lang';

    public $primaryKey = 'id_product';

    public $belongsTo = array(
        'Product' => array(
            'foreignKey' => 'id_product'
        )
    );

    /**
     * @param array $products
     *  Array
     *  (
     *      [0] => Array
     *          (
     *              [productId] => Array
     *                  (
     *                      [name] => Brokkoli-1
     *                      [description] => grünes Gemüse: Strunk mit Röschen auch angeschwollenen Knospen-1
     *                      [description_short] => kbA, vom Gemüsehof Wild-Obermayr-1
     *                      [unity] => ca. 0,4 kg-1
     *                  )
     *          )
     *  )
     * @return boolean $success
     */
    public function changeName($products)
    {

        $productsLang2save = array();

        foreach ($products as $product) {
            $productId = key($product);
            $name = $product[$productId];
            $ids = $this->Product->getProductIdAndAttributeId($productId);
            if ($ids['attributeId'] > 0) {
                throw new InvalidParameterException('change name is not allowed for product attributes');
            }
            $newName = StringComponent::removeSpecialChars(strip_tags(trim($name['name'])));
            if (strlen($newName) < 2) {
                throw new InvalidParameterException('Der Name des Produktes <b>'.$newName.'</b> muss mindestens zwei Zeichen lang sein.');
            } else {
                $productsLang2save[] = array(
                    'id_product' => $ids['productId'],
{'fraction_non_alphanumeric': 0.12092391304347826, 'fraction_numerical': 0.006340579710144928, 'mean_word_length': 1.818761965539247, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 39, 'https://': 2, 'lorem ipsum': 0, 'www.': 6, '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': '5070980', 'n_tokens_mistral': 1251, 'n_tokens_neox': 1212, 'n_words': 299}