for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PHPKitchen\CodeSpecsCore\Expectation\Internal;
/**
* Represents a list of steps performed during a specification.
*
* @package PHPKitchen\CodeSpecsCore\Expectation\Internal
* @author Dmitry Kolodko <[email protected]>
*/
class StepsList {
* @var Step[] steps storage.
private $steps = [];
private static $instance;
public static function getInstance(): self {
if (null === static::$instance) {
$instance
static
self
static::$instance = new static();
}
return static::$instance;
public function add(string $step) {
$lastStep = end($this->steps);
if ($lastStep) {
$lastStep->check();
$this->steps[] = new Step($step);
public function convertToString(): string {
$message = implode(PHP_EOL, $this->steps);
$message = $message ? $message . PHP_EOL : $message;
return (string)$message;
public function clear() {
$this->steps = [];