<commit_before><?php
namespace Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

/**
 * @Table(name="songs", indexes={
 *   @index(name="search_idx", columns={"text", "artist", "title"})
 * })
 * @Entity(repositoryClass="Entity\Repository\SongRepository")
 */
class Song
{
    const SYNC_THRESHOLD = 604800; // 604800 = 1 week

    /**
     * @Column(name="id", type="string", length=50)
     * @Id
     * @var string
     */
    protected $id;

    /**
     * @Column(name="text", type="string", length=150, nullable=true)
     * @var string
     */
    protected $text;

    /**
     * @Column(name="artist", type="string", length=150, nullable=true)
     * @var string
     */
    protected $artist;

    /**
     * @Column(name="title", type="string", length=150, nullable=true)
     * @var string
     */
    protected $title;

    /**
     * @Column(name="created", type="integer")
     * @var int
     */
    protected $created;

    /**
     * @Column(name="play_count", type="integer")
     * @var int
     */
    protected $play_count;

    /**
     * @Column(name="last_played", type="integer")
     * @var int
     */
    protected $last_played;

    /**
     * @OneToMany(targetEntity="SongHistory", mappedBy="song")
     * @OrderBy({"timestamp" = "DESC"})
     * @var Collection
     */
    protected $history;

    /**
     * Song constructor.
     * @param array $song_info
     */
    public function __construct(array $song_info)
    {
        if (empty($song_info['text'])) {
            $song_info['text'] = $song_info['artist'] . ' - ' . $song_info['title'];
        }

        $this->text = $song_info['text'];
        $this->title = $song_info['title'];
        $this->artist = $song_info['artist'];
        $this->id = self::getSongHash($song_info);

        $this->created = time();
        $this->play_count = 0;
        $this->last_played = 0;

        $this->history = new ArrayCollection;
    }

    /**
     * @return string
     */
    public function getId(): string
    {
        return $this->id;
    }

    /**
     * @return string
     */
    public function getText(): string
    {
        return $this->text;
    }

    /**
     * @return string
     */
    public function getArtist(): string
    {
        return $this->artist;
    }

    /**
     * @return string
     */
    public function getTitle(): string
    {
        return $this->title;
    }

    /**
     * @return int
     */<commit_msg>#226 -- Fix typing of Song entity [skip ci]<commit_after><?php
namespace Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;

/**
 * @Table(name="songs", indexes={
 *   @index(name="search_idx", columns={"text", "artist", "title"})
 * })
 * @Entity(repositoryClass="Entity\Repository\SongRepository")
 */
class Song
{
    const SYNC_THRESHOLD = 604800; // 604800 = 1 week

    /**
     * @Column(name="id", type="string", length=50)
     * @Id
     * @var string
     */
    protected $id;

    /**
     * @Column(name="text", type="string", length=150, nullable=true)
     * @var string|null
     */
    protected $text;

    /**
     * @Column(name="artist", type="string", length=150, nullable=true)
     * @var string|null
     */
    protected $artist;

    /**
     * @Column(name="title", type="string", length=150, nullable=true)
     * @var string|null
     */
    protected $title;

    /**
     * @Column(name="created", type="integer")
     * @var int
     */
    protected $created;

    /**
     * @Column(name="play_count", type="integer")
     * @var int
     */
    protected $play_count;

    /**
     * @Column(name="last_played", type="integer")
     * @var int
     */
    protected $last_played;

    /**
     * @OneToMany(targetEntity="SongHistory", mappedBy="song")
     * @OrderBy({"timestamp" = "DESC"})
     * @var Collection
     */
    protected $history;

    /**
     * Song constructor.
     * @param array $song_info
     */
    public function __construct(array $song_info)
    {
        if (empty($song_info['text'])) {
            $song_info['text'] = $song_info['artist'] . ' - ' . $song_info['title'];
        }

        $this->text = $song_info['text'];
        $this->title = $song_info['title'];
        $this->artist = $song_info['artist'];
        $this->id = self::getSongHash($song_info);

        $this->created = time();
        $this->play_count = 0;
        $this->last_played = 0;

        $this->history = new ArrayCollection;
    }

    /**
     * @return string
     */
    public function getId(): string
    {
        return $this->id;
    }

    /**
     * @return string|null
     */
    public function getText(): ?string
    {
        return $this->text;
    }

    /**
     * @return string|null
     */
    public function getArtist(): ?string
    {
        return $this->artist;
    }

    /**
     * @return string|null
     */
    public function getTitle(): ?string
    {
        return $this->title;
    }

    /**
     * @return int
     */
{'fraction_non_alphanumeric': 0.17422292615323698, 'fraction_numerical': 0.010888932884577311, 'mean_word_length': 2.183364839319471, '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': '7106663', 'n_tokens_mistral': 1706, 'n_tokens_neox': 1591, 'n_words': 297}