visionp/plains

There is no license information available for the latest version (v0.1.0) of this package.

Test task

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0

Type:project

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

This package is auto-updated.

Last update: 2024-05-05 19:39:36 UTC


README

The task is to build the structure of classes and methods for:

  1. Airplane Aeroprakt A-24 2) Airplane Curtiss NC-4 3) Airplane Boeing 747 Considerations
  2. They can all takeoff, fly, and land.
  3. Aeroprakt A-24 and Boeing 747 have wheels, meaning they can takeoff and land on a runway.
  4. Curtiss NC-4 and Aeroprakt A-24 can takeoff and land on water.
  5. Aeroprakt A-24 and Curtiss NC-4 can only fly in the daytime and in good weather. 5) Boeing 747 can fly at any time and in any weather.

Example:

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);