<commit_before><?php
/**
 * A service providing some core util functions.
 */

namespace Graviton\CoreBundle\Service;

use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://swisscom.com
 */
class CoreUtils
{
    /**
     * @var ContainerInterface service_container
     */
    private $container;

    /**
     * sets the container
     *
     * @param \Symfony\Component\DependencyInjection\ContainerInterface $container service_container
     *
     * @return void
     */
    public function setContainer($container = null)
    {
        $this->container = $container;
    }

    /**
     * Gets the current version we're running on..
     *
     * @return string version
     */
    public function getVersion($composerFile = '')
    {
        //@todo if we're in a wrapper context, use the version of the wrapper, not graviton
        $composerFile = !empty($composerFile) ? $composerFile :__DIR__ . '/../../../../composer.json';

        if (file_exists($composerFile)) {

            $composer = json_decode(file_get_contents($composerFile), true);

            if (JSON_ERROR_NONE === json_last_error() && !empty($composer['version'])) {
                return $composer['version'];
            } else {
                $message = sprintf(
                    'Unable to extract version from composer.json file (Error code: %s)',
                    json_last_error()
                );

                throw new \RuntimeException($message);
            }
        }
    }
}<commit_msg>Refactored GRV-1347: removed unused code<commit_after><?php
/**
 * A service providing some core util functions.
 */

namespace Graviton\CoreBundle\Service;

use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * @author   List of contributors <https://github.com/libgraviton/graviton/graphs/contributors>
 * @license  http://opensource.org/licenses/gpl-license.php GNU Public License
 * @link     http://swisscom.ch
 */
class CoreUtils
{
    /**
     * Gets the current version we're running on..
     *
     * @return string version
     */
    public function getVersion($composerFile = '')
    {
        //@todo if we're in a wrapper context, use the version of the wrapper, not graviton
        $composerFile = !empty($composerFile) ? $composerFile : __DIR__ . '/../../../../composer.json';

        if (file_exists($composerFile)) {

            $composer = json_decode(file_get_contents($composerFile), true);

            if (JSON_ERROR_NONE === json_last_error() && !empty($composer['version'])) {

                return $composer['version'];
            } else {
                $message = sprintf(
                    'Unable to extract version from composer.json file (Error code: %s)',
                    json_last_error()
                );

                throw new \RuntimeException($message);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.12414243711205489, 'fraction_numerical': 0.0013067624959163672, 'mean_word_length': 2.247083775185578, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 6, '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': '2641862', 'n_tokens_mistral': 858, 'n_tokens_neox': 817, 'n_words': 198}