コード例 #1
0
ファイル: Gun.php プロジェクト: Vincebml/PHPatterns
 /**
  * Perform an attack to the opponent
  * @param Bridge\AbstractFighter $opponent
  * @return string
  */
 public function attack(Bridge\AbstractFighter $opponent)
 {
     return sprintf("Attacking %s with a gun!", $opponent->getName());
 }
コード例 #2
0
ファイル: God.php プロジェクト: Vincebml/PHPatterns
 /**
  * @param string $name
  * @param Bridge\WeaponInterface $weapon
  */
 public function __construct($name, Bridge\WeaponInterface $weapon)
 {
     parent::__construct($name, $weapon);
     $this->force = 150.0;
     $this->life = 200.0;
 }
コード例 #3
0
ファイル: BridgeTest.php プロジェクト: Vincebml/PHPatterns
 public function testGodMove()
 {
     $this->assertSame('Moving by teleportation...', $this->god->move());
 }