-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplay.php
More file actions
44 lines (36 loc) · 901 Bytes
/
play.php
File metadata and controls
44 lines (36 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
require __DIR__.'/lib/Ship.php';
$myShip = new Ship();
$myShip->name = "TIE Figher";
$myShip->weaponPower = 10;
/**
* Get a Ship object and prints some summary about it
*
* @param Ship $someShip
*/
function printShipSummary(Ship $someShip)
{
echo 'Ship Name: '.$someShip->getName();
echo '<hr/>';
$someShip->sayHello();
echo '<hr/>';
echo $someShip->getNameAndSpecs(false);
echo '<hr/>';
echo $someShip->getNameAndSpecs(true);
}
printShipSummary($myShip);
$otherShip = new Ship();
$otherShip->name = 'Imperial Shuttle';
$otherShip->weaponPower = 5;
$otherShip->strength = 50;
echo '<hr/>';
echo '<hr/>';
printShipSummary($otherShip);
echo '<hr/>';
echo '<hr/>';
echo '<hr/>';
if ($myShip->doesGivenShipHaveMoreStrength($otherShip)) {
echo $otherShip->name.' has more strength';
} else {
echo $myShip->name.' has more strength';
}