This repository has been archived on 2019-03-01. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
paper-pi/app/Decorators/TraficarDecorator.php
2019-03-01 07:58:22 +01:00

27 lines
518 B
PHP

<?php
/**
* Created by PhpStorm.
* User: k
* Date: 28.02.2019
* Time: 22:20
*/
namespace App\Decorators;
use App\Paper\Traficar;
class TraficarDecorator extends TextConverterDecorator
{
public function getText(): string
{
$text = $this->text->getText();
if (strstr($text, '[traficar]')) {
$traficar = new Traficar();
$nearest = $traficar->nearestCarText();
$text = str_replace('[traficar]', $nearest, $text);
}
return $text;
}
}