<commit_before><?php

namespace Coral\SiteBundle\Service;

use Coral\CoreBundle\Exception\CoralConnectException;
use Coral\CoreBundle\Utility\JsonParser;

class CoralConnectServiceMockup
{
    protected $container;

    public function __construct(\Symfony\Component\DependencyInjection\Container $container)
    {
        $this->container = $container;
    }

    public function readFile($uri)
    {
        $controller = $this->container->get('request')->attributes->get('_controller');
        $controller = substr($controller, 0, strpos($controller, 'Bundle') + 6);
        $controller = str_replace('\\', '/', $controller);
        $filePath   = $this->container->get('kernel')->getRootDir() . '/../src/' . $controller . '/Tests/coral_connect' . $uri;

        if(!file_exists($filePath))
        {
            throw new CoralConnectException('Unable to find file: ' . $filePath);
        }

        $content = file_get_contents($filePath);

        if(false === $content)
        {
            throw new CoralConnectException('Unable to load file: ' . $filePath);
        }

        return new JsonParser($content, true);
    }

    /**
     * Create POST request to CORAL backend
     *
     * @param  string $uri  Service URI
     * @param  array  $data Datat to be sent
     * @return JsonResponse Response
     */
    public function doPostRequest($uri, $data = null)
    {
        return $this->readFile($uri);
    }

    /**
     * Create GET request to CORAL backend
     *
     * @param  string $uri  Service URI
     * @return JsonResponse Response
     */
    public function doGetRequest($uri)
    {
        return $this->readFile($uri);
    }

    /**
     * Create DELETE request to CORAL backend
     *
     * @param  string $uri  Service URI
     * @return JsonResponse Response
     */
    public function doDeleteRequest($uri)
    {
        return $this->readFile($uri);
    }
}
<commit_msg>Fixed file path that was prepared for project like testing. Now it's for CoralBundle testing (only for now)<commit_after><?php

namespace Coral\SiteBundle\Service;

use Coral\CoreBundle\Exception\CoralConnectException;
use Coral\CoreBundle\Utility\JsonParser;

class CoralConnectServiceMockup
{
    protected $container;

    public function __construct(\Symfony\Component\DependencyInjection\Container $container)
    {
        $this->container = $container;
    }

    public function readFile($uri)
    {
        $controller = $this->container->get('request')->attributes->get('_controller');
        $controller = substr($controller, 0, strpos($controller, 'Bundle') + 6);
        $controller = str_replace('\\', '/', $controller);
        //@TODO Fix: This will work only for tests running in CoralBundles file structure
        $filePath   = $this->container->get('kernel')->getRootDir() . '/../coral_connect' . $uri;

        if(!file_exists($filePath))
        {
            throw new CoralConnectException('Unable to find file: ' . $filePath);
        }

        $content = file_get_contents($filePath);

        if(false === $content)
        {
            throw new CoralConnectException('Unable to load file: ' . $filePath);
        }

        return new JsonParser($content, true);
    }

    /**
     * Create POST request to CORAL backend
     *
     * @param  string $uri  Service URI
     * @param  array  $data Datat to be sent
     * @return JsonResponse Response
     */
    public function doPostRequest($uri, $data = null)
    {
        return $this->readFile($uri);
    }

    /**
     * Create GET request to CORAL backend
     *
     * @param  string $uri  Service URI
     * @return JsonResponse Response
     */
    public function doGetRequest($uri)
    {
        return $this->readFile($uri);
    }

    /**
     * Create DELETE request to CORAL backend
     *
     * @param  string $uri  Service URI
     * @return JsonResponse Response
     */
    public function doDeleteRequest($uri)
    {
        return $this->readFile($uri);
    }
}

{'fraction_non_alphanumeric': 0.12248995983935743, 'fraction_numerical': 0.001004016064257028, 'mean_word_length': 2.4925503943908853, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 25, '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': '2475732', 'n_tokens_mistral': 1141, 'n_tokens_neox': 1112, 'n_words': 280}