<commit_before><?php
/**
 * Litus is a project by a group of students from the KU Leuven. The goal is to create
 * various applications to support the IT needs of student unions.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace CudiBundle\Hydrator\Sale;

use CommonBundle\Component\Hydrator\Exception\InvalidObjectException;

class Article extends \CommonBundle\Component\Hydrator\Hydrator
{
    static $stdKeys = array(
        'bookable', 'unbookable', 'sellable',
    );

    protected function doExtract($object = null)
    {
        if (null === $object) {
            return array();
        }

        $data = $this->stdExtract($object, $stdKeys);

        $data['can_expire'] = $object->canExpire();

        $data['purchase_price'] = number_format($object->getPurchasePrice()/100, 2);
        $data['sell_price'] = number_format($object->getSellPrice()/100, 2);

        $data['barcode'] = $object->getBarcode() != '' ? str_pad($object->getBarcode(), 12, '0', STR_PAD_LEFT) : '';
        $data['supplier'] = $object->getSupplier()->getId();

        return $data;
    }

    protected function doHydrate(array $data, $object = null)
    {
        static $stdKeys = array(
            'sell_price', 'purchase_price', 'can_expire',
        );<commit_msg>Bugfix<commit_after><?php
/**
 * Litus is a project by a group of students from the KU Leuven. The goal is to create
 * various applications to support the IT needs of student unions.
 *
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 * @author <NAME> <<EMAIL>>
 *
 * @license http://litus.cc/LICENSE
 */

namespace CudiBundle\Hydrator\Sale;

use CommonBundle\Component\Hydrator\Exception\InvalidObjectException;

class Article extends \CommonBundle\Component\Hydrator\Hydrator
{
    protected function doExtract($object = null)
    {
        static $stdKeys = array(
            'bookable', 'unbookable', 'sellable',
        );

        if (null === $object) {
            return array();
        }

        $data = $this->stdExtract($object, $stdKeys);

        $data['can_expire'] = $object->canExpire();

        $data['purchase_price'] = number_format($object->getPurchasePrice()/100, 2);
        $data['sell_price'] = number_format($object->getSellPrice()/100, 2);

        $data['barcode'] = $object->getBarcode() != '' ? str_pad($object->getBarcode(), 12, '0', STR_PAD_LEFT) : '';
        $data['supplier'] = $object->getSupplier()->getId();

        return $data;
    }

    protected function doHydrate(array $data, $object = null)
    {
        static $stdKeys = array(
            'sell_price', 'purchase_price', 'can_expire',
        );
{'fraction_non_alphanumeric': 0.17394158188382014, 'fraction_numerical': 0.007220216606498195, 'mean_word_length': 3.2274618585298196, 'pattern_counts': {'":': 0, '<': 59, '<?xml version=': 0, '>': 73, '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': '80', 'n_tokens_mistral': 1015, 'n_tokens_neox': 983, 'n_words': 228}