Skip to content

Commit

Permalink
Moved trait usage
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanruzak committed Jan 4, 2024
1 parent 6de1868 commit 611b78c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 16 deletions.
2 changes: 0 additions & 2 deletions src/AdType.php
Expand Up @@ -5,7 +5,6 @@
use eiriksm\FinnTransfer\Traits\ContactTrait;
use eiriksm\FinnTransfer\Traits\EngineTrait;
use eiriksm\FinnTransfer\Traits\HeaderTrait;
use eiriksm\FinnTransfer\Traits\InteriorMeasurementsTrait;
use eiriksm\FinnTransfer\Traits\MoreInfoTrait;
use eiriksm\FinnTransfer\Traits\MotorPriceTrait;
use eiriksm\FinnTransfer\Traits\ObjectTrait;
Expand All @@ -14,7 +13,6 @@ abstract class AdType extends XmlBase implements AdTypeInterface
{
use MotorPriceTrait;
use EngineTrait;
use InteriorMeasurementsTrait;
use MoreInfoTrait;
use ContactTrait;
use HeaderTrait;
Expand Down
2 changes: 2 additions & 0 deletions src/AdTypes/BusXml.php
Expand Up @@ -3,12 +3,14 @@
namespace eiriksm\FinnTransfer\AdTypes;

use eiriksm\FinnTransfer\AdType;
use eiriksm\FinnTransfer\Traits\InteriorMeasurementsTrait;
use eiriksm\FinnTransfer\Traits\ModelPropertyTrait;

class BusXml extends AdType
{

use ModelPropertyTrait;
use InteriorMeasurementsTrait;

protected $dtd = 'http://www.iad.no/dtd/IADIF-bus1.dtd';

Expand Down
2 changes: 2 additions & 0 deletions src/AdTypes/VanTruckXml.php
Expand Up @@ -3,12 +3,14 @@
namespace eiriksm\FinnTransfer\AdTypes;

use eiriksm\FinnTransfer\AdType;
use eiriksm\FinnTransfer\Traits\InteriorMeasurementsTrait;
use eiriksm\FinnTransfer\Traits\ModelPropertyTrait;

class VanTruckXml extends AdType
{

use ModelPropertyTrait;
use InteriorMeasurementsTrait;

protected $dtd = 'http://www.iad.no/dtd/IADIF-van-truck-10.dtd';

Expand Down
27 changes: 13 additions & 14 deletions src/Traits/InteriorMeasurementsTrait.php
Expand Up @@ -25,23 +25,22 @@ trait InteriorMeasurementsTrait
*/
protected $interiorMeasurementsHeightBody;

public function setInteriorMeasurements()
protected function createInteriorMeasurementsElements()
{
if (!isset($this->interiorMeasurementsBody)) {
$this->createInteriorMeasurementsElements();
}
}
$this->interiorMeasurementsBody = $this->dom->createElement('INTERIOR_MEASUREMENTS');

protected function createInteriorMeasurementsElements()
{
$this->interiorMeasurementsBody = $this->dom->createElement('INTERIOR_MEASUREMENTS');
$this->interiorMeasurementsLengthBody = $this->dom->createElement('LENGTH');
$this->interiorMeasurementsWidthBody = $this->dom->createElement('WIDTH');
$this->interiorMeasurementsHeightBody = $this->dom->createElement('HEIGHT');
$this->interiorMeasurementsBody->appendChild($this->interiorMeasurementsHeightBody);
$this->interiorMeasurementsBody->appendChild($this->interiorMeasurementsWidthBody);
$this->interiorMeasurementsBody->appendChild($this->interiorMeasurementsLengthBody);
$this->adBody->appendChild($this->interiorMeasurementsBody);
$this->interiorMeasurementsLengthBody = $this->dom->createElement('LENGTH');
$this->interiorMeasurementsBody->appendChild($this->interiorMeasurementsLengthBody);

$this->interiorMeasurementsWidthBody = $this->dom->createElement('WIDTH');
$this->interiorMeasurementsBody->appendChild($this->interiorMeasurementsWidthBody);

$this->interiorMeasurementsHeightBody = $this->dom->createElement('HEIGHT');
$this->interiorMeasurementsBody->appendChild($this->interiorMeasurementsHeightBody);

$this->adBody->appendChild($this->interiorMeasurementsBody);
}
}

public function setInteriorMeasurementsLength($length)
Expand Down

0 comments on commit 611b78c

Please sign in to comment.