Some checks failed
abc-api/abcParser/pipeline/head There was a failure building this commit
41 lines
901 B
PHP
Executable File
41 lines
901 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 Tempo 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 === 'Q') {
|
|
$this->builder->addTempo(new StringAtom($data));
|
|
}
|
|
|
|
return $next($context);
|
|
}
|
|
}
|