<commit_before><?php

/**
 * Site Contributions
 *
 * @author Mark
 */

namespace Minds\Controllers\api\v2\blockchain;

use Minds\Core\Di\Di;
use Minds\Core\Session;
use Minds\Interfaces;
use Minds\Api\Factory;

class contributions implements Interfaces\Api
{

    /**
     * Equivalent to HTTP GET method
     * @param  array $pages
     * @return mixed|null
     */
    public function get($pages)
    {
        $cacher = Di::_()->get('Cache');

        $from = isset($_GET['from']) ? $_GET['from'] : strtotime('midnight -7 days') * 1000;
        $to = isset($_GET['to']) ? $_GET['to'] : time() * 1000;
        $offset = $_GET['offset'] ? $_GET['offset'] : '';

        $repo = Di::_()->get('Rewards\Contributions\Repository');
        $result = $repo->getList([
            'from' => $from,
            'to' => $to,
            'user_guid' => Session::getLoggedInUser()->guid,
            'offset' => $offset
        ]);

        $collection = Di::_()->get('Rewards\Contributions\DailyCollection');
        $collection->setContributions($result['contributions']);
        
        $response = [
            'contributions' => Factory::exportable($collection),
            'load-next' => base64_encode($result['token'])
        ];

        return Factory::response($response);
    }

    /**
     * Equivalent to HTTP POST method
     * @param  array $pages
     * @return mixed|null
     */
    public function post($pages)
    {
        Factory::isLoggedIn();

        return Factory::response([]);
    }

    /**
     * Equivalent to HTTP PUT method
     * @param  array $pages
     * @return mixed|null
     */
    public function put($pages)
    {
        Factory::isLoggedIn();

        return Factory::response([]);
    }
<commit_msg>(feat): do single export vs array<commit_after><?php

/**
 * Site Contributions
 *
 * @author Mark
 */

namespace Minds\Controllers\api\v2\blockchain;

use Minds\Core\Di\Di;
use Minds\Core\Session;
use Minds\Interfaces;
use Minds\Api\Factory;

class contributions implements Interfaces\Api
{

    /**
     * Equivalent to HTTP GET method
     * @param  array $pages
     * @return mixed|null
     */
    public function get($pages)
    {
        $cacher = Di::_()->get('Cache');

        $from = isset($_GET['from']) ? $_GET['from'] : strtotime('midnight -7 days') * 1000;
        $to = isset($_GET['to']) ? $_GET['to'] : time() * 1000;
        $offset = $_GET['offset'] ? $_GET['offset'] : '';

        $repo = Di::_()->get('Rewards\Contributions\Repository');
        $result = $repo->getList([
            'from' => $from,
            'to' => $to,
            'user_guid' => Session::getLoggedInUser()->guid,
            'offset' => $offset
        ]);

        $collection = Di::_()->get('Rewards\Contributions\DailyCollection');
        $collection->setContributions($result['contributions']);
        
        $response = [
            'contributions' => $collection->export(),
            'load-next' => base64_encode($result['token'])
        ];

        return Factory::response($response);
    }

    /**
     * Equivalent to HTTP POST method
     * @param  array $pages
     * @return mixed|null
     */
    public function post($pages)
    {
        Factory::isLoggedIn();

        return Factory::response([]);
    }

    /**
     * Equivalent to HTTP PUT method
     * @param  array $pages
     * @return mixed|null
     */
    public function put($pages)
    {
        Factory::isLoggedIn();

        return Factory::response([]);
    }

{'fraction_non_alphanumeric': 0.16852646638054364, 'fraction_numerical': 0.0068669527896995704, 'mean_word_length': 2.3012275731822474, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 28, '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': '3796', 'n_tokens_mistral': 1081, 'n_tokens_neox': 1038, 'n_words': 211}