<commit_before><?php
/**
 * pro
 * @author edgebal
 */

namespace Minds\Controllers\api\v2;

use Exception;
use Minds\Core\Di\Di;
use Minds\Core\Pro\Manager;
use Minds\Core\Session;
use Minds\Interfaces;
use Minds\Api\Factory;

class pro implements Interfaces\Api
{
    /**
     * Equivalent to HTTP GET method
     * @param array $pages
     * @return mixed|null
     * @throws Exception
     */
    public function get($pages)
    {
        /** @var Manager $manager */
        $manager = Di::_()->get('Pro\Manager');
        $manager
            ->setUser(Session::getLoggedinUser());

        return Factory::response([
            'isActive' => $manager->isActive(),
        ]);
    }

    /**<commit_msg>(fix): sentry error on pro endpoints<commit_after><?php
/**
 * pro
 * @author edgebal
 */

namespace Minds\Controllers\api\v2;

use Exception;
use Minds\Core\Di\Di;
use Minds\Core\Pro\Manager;
use Minds\Core\Session;
use Minds\Interfaces;
use Minds\Api\Factory;

class pro implements Interfaces\Api
{
    /**
     * Equivalent to HTTP GET method
     * @param array $pages
     * @return mixed|null
     * @throws Exception
     */
    public function get($pages)
    {
        $user = Session::getLoggedinUser();

        if (!$user) {
            return Factory::response([
                'isActive' => false,
            ]);
        }

        /** @var Manager $manager */
        $manager = Di::_()->get('Pro\Manager');
        $manager
            ->setUser($user);

        return Factory::response([
            'isActive' => $manager->isActive(),
        ]);
    }

    /**
{'fraction_non_alphanumeric': 0.14886934673366833, 'fraction_numerical': 0.001256281407035176, 'mean_word_length': 2.1669980119284293, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, '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': '6243055', 'n_tokens_mistral': 490, 'n_tokens_neox': 486, 'n_words': 109}