Skip to content

Implementation of problem and solution using the strategy pattern

Notifications You must be signed in to change notification settings

sethingham/strategy-pattern

 
 

Repository files navigation

Strategy pattern

Implementation of the strategy pattern given a problem. There is also some added pieces to the solution to drill in the point more. I also implemented the factory pattern to handle the creation of Ducks called DuckFactory. There are also tests that only test against the solution directory and that is why the code coverage is so low.

Build Status

codecov

StyleCI

Usage

use AMacSmith\StrategyPattern\Solution\DuckFactory;
use AMacSmith\StrategyPattern\Solution\Ducks\RubberDuck;

$rubberDuck = DuckFactory::make(new RubberDuck);

$rubberDuck->performQuack(); // I don't quack
$rubberDuck->performFly(); // I am flight Less
$rubberDuck->performEat(); // I eat Nothing
$rubberDuck->performType(); // Duck type of Rubber Duck
$rubberDuck->performDisplay(); // I look like a Rubber Duck

About

Implementation of problem and solution using the strategy pattern

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%