<commit_before><?php

namespace Kbrw\RiakBundle\Service\Content;

use Kbrw\RiakBundle\Model\KV\Data;
use Kbrw\RiakBundle\Model\KV\Transmutable;

/**
 * @author remi
 */
class RiakKVHelper
{
    /**
     * @param string $key
     * @param string $content
     * @param string $contentType
     * @param string $fqcn
     * @param array $infos
     * @return \Kbrw\RiakBundle\Model\KV\Data
     */
    public function read($key, $content, $contentType, $fqcn, &$infos = array())
    {
        $data = new Data($key);
        try {
            $data->setStringContent($content);
            $normalizedContentType = $this->contentTypeNormalizer->getNormalizedContentType($contentType);
            if ($this->contentTypeNormalizer->isFormatSupportedForSerialization($normalizedContentType)) {
                $ts = microtime(true);
                $riakKVObject = $this->serializer->deserialize($data->getContent(true), $fqcn, $normalizedContentType);
                $infos["deserialization_time"] = microtime(true) - $ts;
                if ($riakKVObject !== false) {
                    if ($riakKVObject instanceof Transmutable) {
                        $riakKVObject = $riakKVObject->transmute();
                    }
                    $data->setContent($riakKVObject);
                }
            }
        } catch (\Exception $e) {
            $this->logger->err("Unable to create the Data object for key '$key'. Full message is : \n" . $e->getMessage() . "");
        }
        return $data;
    }

    /**
     * @param \Kbrw\RiakBundle\Service\Content\ContentTypeNormalizer $contentTypeNormalizer
     * @param \JMS\Serializer\Serializer $serializer
     * @param \Psr\Log\LoggerInterface $logger
     */
    function __construct($contentTypeNormalizer, $serializer, $logger)
    {
        $this->contentTypeNormalizer = $contentTypeNormalizer;
        $this->serializer = $serializer;<commit_msg>fix call to logger<commit_after><?php

namespace Kbrw\RiakBundle\Service\Content;

use Kbrw\RiakBundle\Model\KV\Data;
use Kbrw\RiakBundle\Model\KV\Transmutable;

/**
 * @author remi
 */
class RiakKVHelper
{
    /**
     * @param string $key
     * @param string $content
     * @param string $contentType
     * @param string $fqcn
     * @param array $infos
     * @return \Kbrw\RiakBundle\Model\KV\Data
     */
    public function read($key, $content, $contentType, $fqcn, &$infos = array())
    {
        $data = new Data($key);
        try {
            $data->setStringContent($content);
            $normalizedContentType = $this->contentTypeNormalizer->getNormalizedContentType($contentType);
            if ($this->contentTypeNormalizer->isFormatSupportedForSerialization($normalizedContentType)) {
                $ts = microtime(true);
                $riakKVObject = $this->serializer->deserialize($data->getContent(true), $fqcn, $normalizedContentType);
                $infos["deserialization_time"] = microtime(true) - $ts;
                if ($riakKVObject !== false) {
                    if ($riakKVObject instanceof Transmutable) {
                        $riakKVObject = $riakKVObject->transmute();
                    }
                    $data->setContent($riakKVObject);
                }
            }
        } catch (\Exception $e) {
            $this->logger->error("Unable to create the Data object for key '$key'. Full message is : \n" . $e->getMessage() . "");
        }
        return $data;
    }

    /**
     * @param \Kbrw\RiakBundle\Service\Content\ContentTypeNormalizer $contentTypeNormalizer
     * @param \JMS\Serializer\Serializer $serializer
     * @param \Psr\Log\LoggerInterface $logger
     */
    function __construct($contentTypeNormalizer, $serializer, $logger)
    {
        $this->contentTypeNormalizer = $contentTypeNormalizer;
        $this->serializer = $serializer;
{'fraction_non_alphanumeric': 0.13058239749281797, 'fraction_numerical': 0.0, 'mean_word_length': 2.365553602811951, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, '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': '2991789', 'n_tokens_mistral': 1154, 'n_tokens_neox': 1142, 'n_words': 202}