for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Claudsonm\Pedi\Standards\PagSeguro\Records;
use Claudsonm\Pedi\Standards\PagSeguro\Enums\TipoRegistro;
use Claudsonm\Pedi\Structure\Field;
use Claudsonm\Pedi\Structure\Record;
use Claudsonm\Pedi\Structure\Types\Numeric;
class Saldo extends Record
{
private array $definitions = [
[
'size' => 1,
'start' => 1,
'type' => Numeric::class,
'name' => 'TIPO_REGISTRO',
],
'size' => 10,
'start' => 2,
'name' => 'ESTABELECIMENTO',
'size' => 8,
'start' => 12,
'name' => 'DATA_MOVIMENTACAO',
'size' => 2,
'start' => 20,
'name' => 'TIPO_EVENTO',
'size' => 13,
'start' => 22,
'name' => 'VALOR_SALDO',
];
public function __construct()
foreach ($this->definitions as $definition) {
$field = (new Field())
->setSize($definition['size'])
->setStart($definition['start'])
->setType(new $definition['type']())
->setName($definition['name']);
$this->add($field);
}
public function matches(string $line): bool
return TipoRegistro::SALDO === substr($line, 0, 1);