Example #1
0
 /**
  * @param mixed $car
  */
 public function buyCar(Cars $car)
 {
     $price = $car->getPrice();
     if ($this->money >= $price) {
         $this->car = $car;
         $this->money -= $price;
         $car->setOwner($this);
         echo 'You heve a new car', PHP_EOL;
         return true;
     } else {
         echo 'You don\'t have enough money';
         return false;
     }
 }