示例#1
0
 public function addUnit(Unit $unit)
 {
     if ($unit instanceof Cavalry) {
         throw new Exception("can't get a horse on the vehicle");
     }
     parent::addUnit($unit);
 }
 function addUnit(Unit $unit)
 {
     if ($unit instanceof Cavalry) {
         throw new UnitException("Нельзя помещать лошадь на бронетранспортер");
     }
     parent::addUnit($unit);
 }
示例#3
0
 public function __construct(CompositeUnit $compositeUnit)
 {
     $this->units = $compositeUnit->units();
 }