52 lines
935 B
PHP
52 lines
935 B
PHP
<?php
|
|
/**
|
|
* Created by Pensare Software.
|
|
* User: Theo Weijmer
|
|
* Date: 10/06/2018
|
|
* Time: 16:28
|
|
*/
|
|
|
|
class RemoveOffer {
|
|
|
|
private $offerID;
|
|
private $project;
|
|
private $removeAllowed;
|
|
|
|
public function __construct($offerID)
|
|
{
|
|
$this->setOfferID($offerID);
|
|
|
|
$this->handle();
|
|
}
|
|
|
|
public function getRemoveAllowed()
|
|
{
|
|
return $this->removeAllowed;
|
|
}
|
|
|
|
private function setOfferID( $offerID )
|
|
{
|
|
$this->offerID = $offerID;
|
|
}
|
|
|
|
private function handle()
|
|
{
|
|
$this->setProject();
|
|
|
|
$this->setRemoveAllowed();
|
|
}
|
|
|
|
private function setProject()
|
|
{
|
|
$offer = Offer::Find($this->offerID);
|
|
|
|
$this->project = is_null($offer->project_id) ? TRUE : FALSE;
|
|
}
|
|
|
|
private function setRemoveAllowed()
|
|
{
|
|
if( $this->project === FALSE ) return $this->removeAllowed = FALSE;
|
|
|
|
$this->removeAllowed = TRUE;
|
|
}
|
|
} |