<?php
    namespace Model;
    use Entity\Quote;
    use Gateway\QuoteGateway;

    class QuoteModel
    {
        private QuoteGateway $gateway;

        public function __construct(QuoteGateway $gate){
            $this->gateway = $gate;
        }

        public function searchId(int $id): Quote{
            $res = $this->gateway->searchId($id);
            if( count($res) == 0)
                return new Quote(-1,"NULL","NULL","NULL","NULL","NULL",0,"Default");
            else 
                return new Quote($res[0]["id_quote"],$res[0]["content"],$res[0]["caracter"],$res[0]["imgpath"],$res[0]["title"],$res[0]["dates"],$res[0]["likes"],$res[0]["langue"]);
        }
    }

?>
