Files
abcParser/src/Domain/Modules/Interpreter/Lexicon/Transcriber.php
richard 2cdf7dd1cf
Some checks failed
abc-api/abcParser/pipeline/head There was a failure building this commit
update webpatser/laravel-uuid to version 3
2020-06-20 12:36:34 -04:00

41 lines
913 B
PHP
Executable File

<?php
namespace XaiCorp\AbcParser\Domain\Modules\Interpreter\Lexicon;
use Closure;
use Enzyme\Axiom\Atoms\StringAtom;
use XaiCorp\AbcParser\Domain\Core\TuneBuilder;
use XaiCorp\AbcParser\Domain\Modules\Interpreter\Context;
class Transcriber implements Lex
{
use LineKeyDataTrait;
/**
* @var TuneBuilder
*/
protected $builder;
public function __construct(TuneBuilder $builder)
{
$this->builder = $builder;
}
/**
* @param Context $context
* @param \Closure $next
* @return mixed
* @throws \Enzyme\Axiom\Exceptions\AtomException
*/
public function handle(Context $context, Closure $next)
{
$line = $context->current();
[$key, $data] = $this->getKeyDataFromLine($line);
if ($key === 'Z') {
$this->builder->addTranscriber(new StringAtom($data));
}
return $next($context);
}
}