本文整理汇总了PHP中Car::start方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::start方法的具体用法?PHP Car::start怎么用?PHP Car::start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Car
的用法示例。
在下文中一共展示了Car::start方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCarPartsFactoryCreateEngineCalled
public function testCarPartsFactoryCreateEngineCalled()
{
$hybridEngine = new HybridEngine();
$factoryStub = $this->getMock('HybridCarPartsFactory');
$factoryStub->expects($this->once())->method('createEngine')->will($this->returnValue($hybridEngine));
$car = new Car($factoryStub);
$car->start();
}
示例2: Car
<?php
require 'taxiClass.php';
$yellow_taxi = new Car();
if (isset($_REQUEST['action'])) {
$action = $_REQUEST['action'];
switch ($action) {
case 'engine':
$yellow_taxi->start();
break;
case 'run':
$yellow_taxi->run();
break;
case 'stop':
$yellow_taxi->stop();
break;
default:
# code...
break;
}
}
?>
<html>
<body>
<form method="post" action="taxi_demo.php?action=engine">
<input type="submit" value="エンジンを掛ける" />
</form>
<form method="post" action="taxi_demo.php?action=run">
<input type="submit" value="走る" />
示例3: Car
<?php
include 'classes/car.php';
//using public properties
$car1 = new Car();
// $car1 -> make = 'Toyota';
// echo $car1 -> make.'<br />';
//
// $car1 -> make = 'Toyota';
// $car1 -> make = 'Honda';
// echo $car1 -> make.'<br />';
//using a public method
$car1->start();
$car1->setMake('Chevy');
echo $car1->getMake() . '<br />';
//constructors
// $car2 = new Car;
$car2 = new Car('Honda', 'Accord', 'Red');
echo $car2->getColor() . '<br />';
$car3 = new Car('Honda', 'Civic', 'Blue');
echo $car3->getColor() . '<br />';