visionp/plains

此包最新版本(v0.1.0)没有可用的许可证信息。

测试任务

维护者

详细信息

github.com/visionp/plains

来源

问题

安装: 3

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:项目

v0.1.0 2021-10-06 19:43 UTC

This package is auto-updated.

Last update: 2024-09-05 20:16:40 UTC


README

任务是构建以下飞机的类和方法结构:

  1. 1) 飞机 Aeroprakt A-24 2) 飞机 Curtiss NC-4 3) 飞机 Boeing 747 考虑事项
  2. 它们都可以起飞、飞行和降落。
  3. Aeroprakt A-24 和 Boeing 747 有轮子,这意味着它们可以在跑道上起飞和降落。
  4. Curtiss NC-4 和 Aeroprakt A-24 可以在水中起飞和降落。
  5. 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);