Skip to content

Commit

Permalink
Wip...
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Pollastri committed Nov 9, 2023
1 parent 200963d commit 3b85898
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/FatturaElettronica.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
namespace Axiostudio\FatturaElettronica;

use Axiostudio\FatturaElettronica\Handlers\Xml as XmlHandler;
use Axiostudio\FatturaElettronica\Handlers\DataDatiBeniServizi;
use Axiostudio\FatturaElettronica\Handlers\XmlDatiBeniServizi as DatiBeniServiziHandler;
use Axiostudio\FatturaElettronica\Handlers\Model as ModelHandler;
use Axiostudio\FatturaElettronica\Models\FatturaElettronica as Fattura;

class FatturaElettronica
{
use ModelHandler;
use XmlHandler;
use DataDatiBeniServizi;
use DatiBeniServiziHandler;

protected function fileName($header): string
{
Expand All @@ -22,7 +22,7 @@ protected function fileName($header): string
return $idPaese . $idCodice . '_' . $progressivoInvio . '.xml';
}

protected function file($header, $body): string
protected function fileContent($header, $body): string
{
$fattura = $this->createModel(new Fattura($header, $body), true);

Expand All @@ -36,11 +36,11 @@ public function create(
array $DatiRiepilogo
): array {

$xml = $this->file($FatturaElettronicaHeader, $FatturaElettronicaBody);
$xml = $this->addDatiBeniServiziToXml($xml, $DettaglioLinee, $DatiRiepilogo);
$xmlContent = $this->fileContent($FatturaElettronicaHeader, $FatturaElettronicaBody);
$xmlContent = $this->addDatiBeniServiziToXml($xmlContent, $DettaglioLinee, $DatiRiepilogo);

return [
'file' => $xml,
'fileContent' => $xmlContent,
'fileName' => $this->fileName($FatturaElettronicaHeader)
];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Axiostudio\FatturaElettronica\Models\DatiRiepilogo;
use Axiostudio\FatturaElettronica\Models\DettaglioLinee;

trait DataDatiBeniServizi
trait XmlDatiBeniServizi
{
use Xml;
use Model;
Expand All @@ -29,7 +29,7 @@ public function addDatiBeniServiziToXml(string $Xml, array $DettaglioLinee = [],
$DatiRiepilogoBlock .= '<DatiRiepilogo>' . $this->createXmlBlock($data) . '</DatiRiepilogo>';
}

$xml = str_replace('<DataDatiBeniServizi></DataDatiBeniServizi>', $DettaglioLineeBlock . $DatiRiepilogoBlock, $Xml);
$xml = str_replace('<XmlDatiBeniServizi></XmlDatiBeniServizi>', $DettaglioLineeBlock . $DatiRiepilogoBlock, $Xml);

return $xml;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Models/DatiBeniServizi.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

class DatiBeniServizi extends Model
{
public $DataDatiBeniServizi;
public $XmlDatiBeniServizi;

public function __construct(...$args)
{
// Data will be managed into DataDatiBeniServizi Handler
$this->DataDatiBeniServizi = null;
// Data will be managed into XmlDatiBeniServizi Handler
$this->XmlDatiBeniServizi = null;
}

public static function loadValidatorMetadata(ClassMetadata $metadata): void
Expand Down

0 comments on commit 3b85898

Please sign in to comment.