KonstantinNP/php-project-lvl2

View on GitHub
src/Formatters.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace Differ\Formatters;

use function Differ\Formatters\Json\getJsonFormat;
use function Differ\Formatters\Stylish\getStylishFormat;
use function Differ\Formatters\Plain\getPlainFormat;

function getFormat($diff, $format)
{
    if ($format === "stylish") {
        return getStylishFormat($diff);
    }
    if ($format === "plain") {
        return getPlainFormat($diff);
    }
    if ($format === "json") {
        return getJsonFormat($diff);
    }
}