<commit_before><?php

namespace App\Entity\Framework;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use JMS\Serializer\Annotation as Serializer;
use Ramsey\Uuid\Uuid;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\MappedSuperclass()
 *
 * @Serializer\ExclusionPolicy("all")
 * @Serializer\VirtualProperty(
 *     "uri",
 *     exp="service('App\\Service\\Api1Uris').getUri(object)",
 *     options={
 *         @Serializer\SerializedName("uri"),
 *         @Serializer\Expose()
 *     }
 * )
 */
class AbstractLsBase implements IdentifiableInterface
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     *
     * @Serializer\Exclude()
     */
    protected $id;

    /**
     * @var string
     *
     * @ORM\Column(name="identifier", type="string", length=300, nullable=false, unique=true)
     *
     * @Assert\NotBlank()
     * @Assert\Uuid(strict=false)
     * @Assert\Length(max=300)
     *
     * @Serializer\Expose()
     */
    protected $identifier;

    /**
     * @var string
     *
     * @ORM\Column(name="uri", type="string", length=300, nullable=true, unique=true)
     *
     * @Assert\NotBlank()
     * @Assert\Length(max=300)
     *
     * @Serializer\Exclude()
     */
    protected $uri;

    /**
     * @var array
     *
     * @ORM\Column(name="extra", type="json", nullable=true)
     *
     * @Serializer\Exclude()
     */
    protected $extra = [];

    /**
     * @var \DateTimeInterface
     *
     * @ORM\Column(name="updated_at", type="datetime", precision=6)
     * @Gedmo\Timestampable(on="update")
     *
     * @Serializer\Expose()
     * @Serializer\SerializedName("lastChangeDateTime")
     */
    protected $updatedAt;

    /**
     * @param string|Uuid|null $identifier
     *
     * @throws \Exception
     */
    public function __construct($identifier = null)
    {
        if ($identifier instanceof Uuid) {
            $identifier = strtolower($identifier->toString());
        } elseif (is_string($identifier) && Uuid::isValid($identifier)) {
            $identifier = strtolower(Uuid::fromString($identifier)->toString());
        } else {
            $identifier = Uuid::uuid1()->toString();
        }

        $this->identifier = $identifier;
        $this->uri = 'local:'.$this->identifier;

        $this->updatedAt = new \DateTimeImmutable();
    }

    /**
     * Clone the object.
     */
    public function __clone()
    {
        // Clear values for new item
        $this->id = null;

        // Generate a new identifier
        $identifier = Uuid::uuid1()->toString();
        $this->identifier = $identifier;
        $this->uri = 'local:'.$this->identifier;

        // Set last change/update to now
        $this->updatedAt = new \DateTimeImmutable();
    }

    /**
     * Get the internal id of the object (or null if not persisted).
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * Set identifier.
     *
     * @param Uuid|string $identifier
     *
     * @return static
     *
     * @throws \InvalidArgumentException<commit_msg>Removing local: URI types. Use the current host and protocol instead.<commit_after><?php

namespace App\Entity\Framework;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use JMS\Serializer\Annotation as Serializer;
use Ramsey\Uuid\Uuid;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * @ORM\MappedSuperclass()
 *
 * @Serializer\ExclusionPolicy("all")
 * @Serializer\VirtualProperty(
 *     "uri",
 *     exp="service('App\\Service\\Api1Uris').getUri(object)",
 *     options={
 *         @Serializer\SerializedName("uri"),
 *         @Serializer\Expose()
 *     }
 * )
 */
class AbstractLsBase implements IdentifiableInterface
{
    /**
     * @var int
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     *
     * @Serializer\Exclude()
     */
    protected $id;

    /**
     * @var string
     *
     * @ORM\Column(name="identifier", type="string", length=300, nullable=false, unique=true)
     *
     * @Assert\NotBlank()
     * @Assert\Uuid(strict=false)
     * @Assert\Length(max=300)
     *
     * @Serializer\Expose()
     */
    protected $identifier;

    /**
     * @var string
     *
     * @ORM\Column(name="uri", type="string", length=300, nullable=true, unique=true)
     *
     * @Assert\NotBlank()
     * @Assert\Length(max=300)
     *
     * @Serializer\Exclude()
     */
    protected $uri;

    /**
     * @var array
     *
     * @ORM\Column(name="extra", type="json", nullable=true)
     *
     * @Serializer\Exclude()
     */
    protected $extra = [];

    /**
     * @var \DateTimeInterface
     *
     * @ORM\Column(name="updated_at", type="datetime", precision=6)
     * @Gedmo\Timestampable(on="update")
     *
     * @Serializer\Expose()
     * @Serializer\SerializedName("lastChangeDateTime")
     */
    protected $updatedAt;

    /**
     * @param string|Uuid|null $identifier
     *
     * @throws \Exception
     */
    public function __construct($identifier = null)
    {
        if ($identifier instanceof Uuid) {
            $identifier = strtolower($identifier->toString());
        } elseif (is_string($identifier) && Uuid::isValid($identifier)) {
            $identifier = strtolower(Uuid::fromString($identifier)->toString());
        } else {
            $identifier = Uuid::uuid1()->toString();
        }

        $this->identifier = $identifier;
        $this->uri = $this->siteURL().$this->identifier;

        $this->updatedAt = new \DateTimeImmutable();
    }

    /**
     * Clone the object.
     */
    public function __clone()
    {
        // Clear values for new item
        $this->id = null;

        // Generate a new identifier
        $identifier = Uuid::uuid1()->toString();
        $this->identifier = $identifier;
        $this->uri = $this->siteURL().$this->identifier;

        // Set last change/update to now
        $this->updatedAt = new \DateTimeImmutable();
    }

	public function siteURL()
	{
		$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
		$domainName = $_SERVER['HTTP_HOST'].'/';
		return $protocol.$domainName;
	}

    /**
     * Get the internal id of the object (or null if not persisted).
     */
    public function getId(): ?int
    {
        return $this->id;
    }

    /**
     * Set identifier.
     *
     * @param Uuid|string $identifier
     *
     * @return static
     *
     * @throws \InvalidArgumentException
{'fraction_non_alphanumeric': 0.16121775644871025, 'fraction_numerical': 0.005248950209958008, 'mean_word_length': 2.339509263895844, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 1, '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': '5311235', 'n_tokens_mistral': 2070, 'n_tokens_neox': 2025, 'n_words': 370}