<?php
namespace App\Core;
/**
* Class LoopSwitch
*/
class LoopSwitch
{
protected const FIRST_STEP = 'first_step';
protected const SECOND_STEP = 'second_step';
/**
* @var string[]
*/
protected array $steps = [
self::FIRST_STEP,
self::SECOND_STEP,
];
/**
* Executes All the steps.
*/
public function executeAllSteps()
{
foreach($this->steps as $step) {
$this->executeStep($step) ;
}
}
/**
* @param string $step
*/
public function executeStep(string $step)
{
switch ($step) {
case self::FIRST_STEP:
echo self::FIRST_STEP;
break;
case self::SECOND_STEP:
echo self::SECOND_STEP;
break;
}
}
}