visionp / plains
此包最新版本(v0.1.0)没有可用的许可证信息。
测试任务
v0.1.0
2021-10-06 19:43 UTC
Requires
- php: 8.*
Requires (Dev)
- phpunit/phpunit: 10.0.x-dev
README
任务是构建以下飞机的类和方法结构:
- 1) 飞机 Aeroprakt A-24 2) 飞机 Curtiss NC-4 3) 飞机 Boeing 747 考虑事项
- 它们都可以起飞、飞行和降落。
- Aeroprakt A-24 和 Boeing 747 有轮子,这意味着它们可以在跑道上起飞和降落。
- Curtiss NC-4 和 Aeroprakt A-24 可以在水中起飞和降落。
- Aeroprakt A-24 和 Curtiss NC-4 只能在白天和好天气下飞行。5) Boeing 747 可以在任何时间、任何天气下飞行。
示例
use Plains\ConditionsBag;
use Plains\Plain;
use Plains\Specifications\ActionSpecification;
use Plains\Specifications\AndSpecification;
use Plains\Specifications\DayTimeSpecification;
use Plains\Specifications\OrSpecification;
use Plains\Specifications\TypeRunwaySpecification;
use Plains\Specifications\WeatherSpecification;
$specificationCanTakeoffLandOnRunway = new AndSpecification(
new OrSpecification(
new ActionSpecification(ConditionsBag::LAND),
new ActionSpecification(ConditionsBag::TAKE_OFF)
),
new TypeRunwaySpecification(ConditionsBag::Runway)
);
$specificationCanTakeoffLandOnWater = new AndSpecification(
new OrSpecification(
new ActionSpecification(ConditionsBag::LAND),
new ActionSpecification(ConditionsBag::TAKE_OFF)
),
new TypeRunwaySpecification(ConditionsBag::WATER)
);
$specificationCanFlyDayTimeGoodWeather = new AndSpecification(
new ActionSpecification(ConditionsBag::FLY),
new DayTimeSpecification(ConditionsBag::DAY),
new WeatherSpecification(ConditionsBag::GOOD)
);
$specification = new OrSpecification(
$specificationCanTakeoffLandOnRunway,
$specificationCanTakeoffLandOnWater,
$specificationCanFlyDayTimeGoodWeather,
);
$plain = new Plain('AeropraktA24', $specification);
$conditions = new ConditionsBag();
$conditions->setAction(ConditionsBag::TAKE_OFF);
$conditions->setTypeRunway(ConditionsBag::Runway);
$plain->can($conditions);