<commit_before><?php
namespace Mw\Metamorph\Domain\Service;



use Mw\Metamorph\Domain\Model\MorphConfiguration;
use Mw\Metamorph\Domain\Model\MorphCreationData;
use Mw\Metamorph\Exception\HumanInterventionRequiredException;
use Mw\Metamorph\Exception\InvalidConfigurationException;
use Mw\Metamorph\Io\OutputInterface;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Mvc\ResponseInterface;
use TYPO3\Flow\Package\MetaData;
use TYPO3\Flow\Utility\Files;
use TYPO3\Flow\Utility\PositionalArraySorter;


/**
 * Class MorphService
 *
 * @package Mw\Metamorph\Domain\Service
 * @Flow\Scope("singleton")
 */
class MorphService
{


    /**
     * @var \TYPO3\Flow\Object\ObjectManagerInterface
     * @Flow\Inject
     */
    protected $objectManager;


    /**
     * @var \TYPO3\Flow\Package\PackageManagerInterface
     * @Flow\Inject
     */
    protected $packageManager;


    /** @var array */
    private $settings;



    public function injectSettings(array $settings)
    {
        $this->settings = $settings;
    }



    public function create($packageKey, MorphCreationData $data)
    {
        $metaData = new MetaData($packageKey);
        $package  = $this->packageManager->createPackage($packageKey, $metaData, NULL, 'typo3-flow-site');

        $morphData = [
            'sourceDirectory'   => $data->getSourceDirectory(),
            'doctrineMode'      => $data->isKeepingTableStructure() ? 'KEEP_SCHEMA' : 'MIGRATE',
            'pibaseRefactoring' => $data->isAggressivelyRefactoringPiBaseExtensions() ? 'AGGRESSIVE' : 'CAUTIOUS'
        ];

        if ($data->getExtensionPatterns())
        {
            $morphData['extensions'] = $data->getExtensionPatterns();
        }

        $configurationPath = $package->getConfigurationPath();
        $morphPath         = Files::concatenatePaths([$configurationPath, 'Metamorph', 'Morph.yml']);<commit_msg>Metamorph packages do not have to be Neos sites.<commit_after><?php
namespace Mw\Metamorph\Domain\Service;



use Mw\Metamorph\Domain\Model\MorphConfiguration;
use Mw\Metamorph\Domain\Model\MorphCreationData;
use Mw\Metamorph\Exception\HumanInterventionRequiredException;
use Mw\Metamorph\Exception\InvalidConfigurationException;
use Mw\Metamorph\Io\OutputInterface;
use TYPO3\Flow\Annotations as Flow;
use TYPO3\Flow\Mvc\ResponseInterface;
use TYPO3\Flow\Package\MetaData;
use TYPO3\Flow\Utility\Files;
use TYPO3\Flow\Utility\PositionalArraySorter;


/**
 * Class MorphService
 *
 * @package Mw\Metamorph\Domain\Service
 * @Flow\Scope("singleton")
 */
class MorphService
{


    /**
     * @var \TYPO3\Flow\Object\ObjectManagerInterface
     * @Flow\Inject
     */
    protected $objectManager;


    /**
     * @var \TYPO3\Flow\Package\PackageManagerInterface
     * @Flow\Inject
     */
    protected $packageManager;


    /** @var array */
    private $settings;



    public function injectSettings(array $settings)
    {
        $this->settings = $settings;
    }



    public function create($packageKey, MorphCreationData $data)
    {
        $metaData = new MetaData($packageKey);
        $package  = $this->packageManager->createPackage($packageKey, $metaData);

        $morphData = [
            'sourceDirectory'   => $data->getSourceDirectory(),
            'doctrineMode'      => $data->isKeepingTableStructure() ? 'KEEP_SCHEMA' : 'MIGRATE',
            'pibaseRefactoring' => $data->isAggressivelyRefactoringPiBaseExtensions() ? 'AGGRESSIVE' : 'CAUTIOUS'
        ];

        if ($data->getExtensionPatterns())
        {
            $morphData['extensions'] = $data->getExtensionPatterns();
        }

        $configurationPath = $package->getConfigurationPath();
        $morphPath         = Files::concatenatePaths([$configurationPath, 'Metamorph', 'Morph.yml']);
{'fraction_non_alphanumeric': 0.12852581160191592, 'fraction_numerical': 0.003991484832357637, 'mean_word_length': 3.30091533180778, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, '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': '4038075', 'n_tokens_mistral': 1191, 'n_tokens_neox': 1154, 'n_words': 177}