<commit_before><?php

namespace Bolt\Extension\Bolt\Members\Storage\Repository;

use Bolt\Extension\Bolt\Members\Storage\Entity;
use Bolt\Storage\Repository;

/**
 * Account meta repository.
 *
 * Copyright (C) 2014-2016 <NAME>
 *
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2014-2016, <NAME>
 * @license   https://opensource.org/licenses/MIT MIT
 */
class AccountMeta extends AbstractMembersRepository
{
    const ALIAS = 'm';

    /**
     * Fetches all meta data for an account.
     *
     * @param string $guid
     *
     * @return Entity\AccountMeta[]
     */
    public function getAccountMetaAll($guid)
    {
        $query = $this->getAccountMetaAllQuery($guid);

        if ($this->pagerEnabled) {
            return $this->getPager($query, 'guid');
        }

        $meta = $this->findWith($query);

        /** @var Entity\AccountMeta $value */
        foreach ($meta as $key => $value) {
            $meta[$value->getMeta()] = $value;
            unset($meta[$key]);
        }

        return $meta;
    }

    public function getAccountMetaAllQuery($guid)
    {
        $qb = $this->createQueryBuilder();
        $qb->select('*')
            ->where('guid = :guid')
            ->setParameter('guid', $guid)
        ;

        return $qb;
    }<commit_msg>Always ensure account meta is an array<commit_after><?php

namespace Bolt\Extension\Bolt\Members\Storage\Repository;

use Bolt\Extension\Bolt\Members\Storage\Entity;
use Bolt\Storage\Repository;

/**
 * Account meta repository.
 *
 * Copyright (C) 2014-2016 <NAME>
 *
 * @author    <NAME> <<EMAIL>>
 * @copyright Copyright (c) 2014-2016, <NAME>
 * @license   https://opensource.org/licenses/MIT MIT
 */
class AccountMeta extends AbstractMembersRepository
{
    const ALIAS = 'm';

    /**
     * Fetches all meta data for an account.
     *
     * @param string $guid
     *
     * @return Entity\AccountMeta[]
     */
    public function getAccountMetaAll($guid)
    {
        $query = $this->getAccountMetaAllQuery($guid);

        if ($this->pagerEnabled) {
            return $this->getPager($query, 'guid');
        }

        $meta = $this->findWith($query) ?: [];

        /** @var Entity\AccountMeta $value */
        foreach ($meta as $key => $value) {
            $meta[$value->getMeta()] = $value;
            unset($meta[$key]);
        }

        return $meta;
    }

    public function getAccountMetaAllQuery($guid)
    {
        $qb = $this->createQueryBuilder();
        $qb->select('*')
            ->where('guid = :guid')
            ->setParameter('guid', $guid)
        ;

        return $qb;
    }
{'fraction_non_alphanumeric': 0.1534330648254699, 'fraction_numerical': 0.01227464518603759, 'mean_word_length': 2.272271016311167, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, 'https://': 2, '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': '5435779', 'n_tokens_mistral': 829, 'n_tokens_neox': 790, 'n_words': 168}