<commit_before><?php

namespace ZENben\GitBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use ZENben\GitBundle\Service\GitHub\Commit;

/**
 * Webhook
 */
class Webhook
{

    const STATUS_NEW = 0;
    const STATUS_IN_PROGRESS = 1;
    const STATUS_DONE = 2;

    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $type;

    /**
     * @var \DateTime
     */
    private $dateCreated;

    /**
     * @var string
     */
    private $payload;

    /**
     * @var integer
     */
    private $status;

    /**
     * @var \DateTime
     */
    private $dateFinished;

    /**
     * @var Collection
     */
    private $buildResults;

    /**
    * @var  \stdClass */
    private $data;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->buildResults = new ArrayCollection();
    }

    public function getHeadCommit()
    {
        $data = $this->getData();
        return new Commit(
            $data->repository->owner->login,
            $data->repository->name,
            $data->pull_request->head->sha
        );
    }

    public function getPullRequestNumber()
    {
        return $this->getData()->number;
    }

    public function getData()
    {
        if ($this->data === null) {
            $this->data = json_decode($this->getPayload());
        }
        return $this->data;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {<commit_msg>proper head commit info<commit_after><?php

namespace ZENben\GitBundle\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use ZENben\GitBundle\Service\GitHub\Commit;

/**
 * Webhook
 */
class Webhook
{

    const STATUS_NEW = 0;
    const STATUS_IN_PROGRESS = 1;
    const STATUS_DONE = 2;

    /**
     * @var integer
     */
    private $id;

    /**
     * @var string
     */
    private $type;

    /**
     * @var \DateTime
     */
    private $dateCreated;

    /**
     * @var string
     */
    private $payload;

    /**
     * @var integer
     */
    private $status;

    /**
     * @var \DateTime
     */
    private $dateFinished;

    /**
     * @var Collection
     */
    private $buildResults;

    /**
    * @var  \stdClass */
    private $data;

    /**
     * Constructor
     */
    public function __construct()
    {
        $this->buildResults = new ArrayCollection();
    }

    public function getHeadCommit()
    {
        $data = $this->getData();
        return new Commit(
            $data->pull_request->head->repo->owner->login,
            $data->pull_request->head->repo->name,
            $data->pull_request->head->sha
        );
    }

    public function getPullRequestNumber()
    {
        return $this->getData()->number;
    }

    public function getData()
    {
        if ($this->data === null) {
            $this->data = json_decode($this->getPayload());
        }
        return $this->data;
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
{'fraction_non_alphanumeric': 0.138681592039801, 'fraction_numerical': 0.0018656716417910447, 'mean_word_length': 1.7448805460750854, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 39, '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': '7575423', 'n_tokens_mistral': 1021, 'n_tokens_neox': 987, 'n_words': 197}