Skip to content

Commit

Permalink
Refatoração do template base
Browse files Browse the repository at this point in the history
  • Loading branch information
jefersondaniel committed Mar 15, 2015
1 parent 2f97d46 commit 7ad25d2
Show file tree
Hide file tree
Showing 5 changed files with 653 additions and 527 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
<?php
namespace NovoBoletoPHP\BancoDoBrasil;

use \NovoBoletoPHP\Base\Boleto;
use \NovoBoletoPHP\Base\Boleto as BoletoBase;
use \NovoBoletoPHP\FormatterHelper;

class BoletoBB extends Boleto {
class Boleto extends BoletoBase {
public function getTemplate()
{
return 'bancos/layout_bb.html';
}

public function getLogoBanco() {
return 'logobb.jpg';
}

protected function filterData(array $dadosboleto)
{
$dadosboleto = parent::filterData($dadosboleto);

$tamanhoNumeroConvenio = strlen($dadosboleto['convenio']);
$tamanhoNossoNumero = strlen($dadosboleto['nosso_numero']);

Expand Down
7 changes: 6 additions & 1 deletion src/NovoBoletoPHP/Base/Boleto.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ protected function configure()

}

protected function filterData(array $dadosboleto)
protected function filterData(array $data)
{
$data['logo_banco'] = $this->getLogoBanco();
return $data;
}

Expand All @@ -27,6 +28,10 @@ public function getTemplate()
return 'layout_base.html';
}

public function getLogoBanco() {
return 'logobb.jpg';
}

public function asHTML()
{
return $this->twig->render($this->getTemplate(), $this->data);
Expand Down
4 changes: 2 additions & 2 deletions src/NovoBoletoPHP/BoletoFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ public function __construct(array $config = array())
));

$this->layouts = array(
self::BANCO_DO_BRASIL => '\NovoBoletoPHP\BancoDoBrasil\BoletoBB'
self::BANCO_DO_BRASIL => '\NovoBoletoPHP\BancoDoBrasil\Boleto',
);

$this->configure();
}

public function configure()
{
$this->twig->addFunction(new \Twig_SimpleFunction('imageUrl', array($this, 'makeImageUrl'), array(
$this->twig->addFilter(new \Twig_SimpleFilter('imageUrl', array($this, 'makeImageUrl'), array(
'is_safe' => array('html')
)));
$this->twig->addFilter(new \Twig_SimpleFilter('barcode', array($this, 'barcode'), array(
Expand Down
Loading

0 comments on commit 7ad25d2

Please sign in to comment.