<commit_before><?php

namespace Rcm\ImmutableHistory;

use Doctrine\Common\Collections\Criteria;
use Rcm\ImmutableHistory\ResourceId\GenerateResourceIdInterface;

class VersionRepository implements VersionRepositoryInterface
{
    protected $entityClassName;
    protected $entityManger;
    protected $generateResourceId;

    /**
     * @TODO make an interface for this repo and make all callers use it
     *
     * VersionRepository constructor.
     * @param $entityClassName
     * @param \Doctrine\ORM\EntityManager $entityManger
     * @param GenerateResourceIdInterface $generateResourceId
     */
    public function __construct(
        $entityClassName,
        \Doctrine\ORM\EntityManager $entityManger,
        GenerateResourceIdInterface $generateResourceId
    ) {
        $this->entityClassName = $entityClassName;
        $this->entityManger = $entityManger;
        $this->generateResourceId = $generateResourceId;
    }

    public function createUnpublishedFromNothing(
        LocatorInterface $locator,
        ContentInterface $content,
        $userId,
        $programmaticReason
    ) {
        $previousPublishedVersion = $this->findPublishedVersionByLocator($locator);<commit_msg>work on immutable history proof of concept cleaning up code<commit_after><?php

namespace Rcm\ImmutableHistory;

use Doctrine\Common\Collections\Criteria;
use Rcm\ImmutableHistory\ResourceId\GenerateResourceIdInterface;

class VersionRepository implements VersionRepositoryInterface
{
    protected $entityClassName;
    protected $entityManger;
    protected $generateResourceId;

    /**
     * VersionRepository constructor.
     * @param $entityClassName
     * @param \Doctrine\ORM\EntityManager $entityManger
     * @param GenerateResourceIdInterface $generateResourceId
     */
    public function __construct(
        $entityClassName,
        \Doctrine\ORM\EntityManager $entityManger,
        GenerateResourceIdInterface $generateResourceId
    ) {
        $this->entityClassName = $entityClassName;
        $this->entityManger = $entityManger;
        $this->generateResourceId = $generateResourceId;
    }

    public function createUnpublishedFromNothing(
        LocatorInterface $locator,
        ContentInterface $content,
        $userId,
        $programmaticReason
    ) {
        $previousPublishedVersion = $this->findPublishedVersionByLocator($locator);
{'fraction_non_alphanumeric': 0.07676174496644295, 'fraction_numerical': 0.0, 'mean_word_length': 3.613152804642166, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '3214857', 'n_tokens_mistral': 599, 'n_tokens_neox': 594, 'n_words': 125}