<commit_before><?php

namespace Bolt\Extension;

use Silex\Application;

/**
 * Management class for extensions.
 *
 * @author <NAME> <<EMAIL>>
 */
class Manager
{
    /** @var \Bolt\Composer\ExtensionLoader */
    protected $loader;

    /** @var Application */
    private $app;

    /**
     * Constructor.
     *
     * @param Application $app
     */
    public function __construct(Application $app)
    {
        $this->app = $app;
        $this->loader = $app['extensions.loader'];
    }
}
<commit_msg>Getter for an extension's composer.json<commit_after><?php

namespace Bolt\Extension;

use Bolt\Filesystem\FilesystemInterface;
use Bolt\Filesystem\Handler\JsonFile;
use Silex\Application;

/**
 * Management class for extensions.
 *
 * @author <NAME> <<EMAIL>>
 */
class Manager
{
    /** @var \Bolt\Composer\ExtensionLoader */
    protected $loader;

    /** @var FilesystemInterface */
    private $filesystem;
    /** @var Application */
    private $app;

    /**
     * Constructor.
     *
     * @param Application $app
     */
    public function __construct(Application $app)
    {
        $this->app = $app;
        $this->loader = $app['extensions.loader'];
        $this->filesystem = $app['filesystem']->getFilesystem('extensions');
    }

    /**
     * Get an extension's composer.json data.
     *
     * @param $name
     *
     * @return array
     */
    public function getComposerJson($name)
    {
        if ($extension = $this->loader->get($name)) {
            $jsonFile = file_get_contents($extension->getPath() . '/composer.json');
            return json_decode($jsonFile, true);

            /** @var JsonFile $jsonFile */
            //$jsonFile = $this->filesystem->get($extension->getPath() . '/composer.json');
            //
            //return $jsonFile->parse();
        }
    }
}

{'fraction_non_alphanumeric': 0.156078860898138, 'fraction_numerical': 0.0, 'mean_word_length': 2.3157894736842106, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 22, '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': '1650575', 'n_tokens_mistral': 552, 'n_tokens_neox': 546, 'n_words': 111}