Tip.php 1.16 KB
<?php

namespace FootyRoom\Queries\Tip;

use FootyRoom\Queries\Match\Match;

class Tip
{
    /**
     * @var string
     */
    protected $id;

    /**
     * @var \FootyRoom\Queries\Match\Match
     */
    protected $match;

    /**
     * @var string
     */
    protected $prediction;

    /**
     * @var float
     */
    protected $odds;

    /**
     * @var string
     */
    protected $status;

    /**
     * @var string
     */
    protected $result;

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

    public function getMatch(): Match
    {
        return $this->match;
    }

    public function getPrediction(): string
    {
        return $this->prediction;
    }

    public function getOdds(): float
    {
        return $this->odds;
    }

    public function getStatus(): string
    {
        return $this->status;
    }

    public function getResult(): ?string
    {
        if (!empty($this->result)) {
            return $this->result;
        }

        if ($this->getMatch()->statusType === 'finished') {
            return $this->getMatch()->homeScore.' : '.$this->getMatch()->awayScore;
        }

        return null;
    }
}