thuecat/Classes/Domain/Import/Entity/Place.php
Daniel Siepmann cc216429a5 Add parking_facility_near_by
- Removed individual converters for TYPO3.
  Conversion is now handled in a single converter.
- The new converter will import necessary dependencies upfront, e.g.
  town or organisation.
- Move import state into extra class.

Relates: #34
2021-09-06 13:47:12 +02:00

266 lines
6.5 KiB
PHP

<?php
declare(strict_types=1);
/*
* Copyright (C) 2021 Daniel Siepmann <coding@daniel-siepmann.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
namespace WerkraumMedia\ThueCat\Domain\Import\Entity;
use WerkraumMedia\ThueCat\Domain\Import\EntityMapper\PropertyValues;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\Address;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\ForeignReference;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\Geo;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Properties\OpeningHour;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\ContainedInPlace;
use WerkraumMedia\ThueCat\Domain\Import\Entity\Shared\Organization;
class Place extends Base
{
use Organization;
use ContainedInPlace;
/**
* @var Address
*/
protected $address;
/**
* @var Geo
*/
protected $geo;
/**
* @var OpeningHour[]
*/
protected $openingHours = [];
/**
* @var ForeignReference[]
*/
protected $parkingFacilitiesNearBy = [];
/**
* @var string[]
*/
protected $sanitations = [];
/**
* @var string[]
*/
protected $otherServices = [];
/**
* @var string[]
*/
protected $trafficInfrastructures = [];
/**
* @var string[]
*/
protected $paymentsAccepted = [];
/**
* @var string
*/
protected $distanceToPublicTransport = '';
public function getAddress(): ?Address
{
return $this->address;
}
public function getGeo(): ?Geo
{
return $this->geo;
}
/**
* @return ForeignReference[]
*/
public function getParkingFacilitiesNearBy(): array
{
return $this->parkingFacilitiesNearBy;
}
/**
* @return string[]
*/
public function getSanitations(): array
{
return $this->sanitations;
}
/**
* @return string[]
*/
public function getOtherServices(): array
{
return $this->otherServices;
}
/**
* @return string[]
*/
public function getTrafficInfrastructures(): array
{
return $this->trafficInfrastructures;
}
/**
* @return string[]
*/
public function getPaymentsAccepted(): array
{
return $this->paymentsAccepted;
}
public function getDistanceToPublicTransport(): string
{
return $this->distanceToPublicTransport;
}
/**
* @internal for mapping via Symfony component.
*/
public function setAddress(Address $address): void
{
$this->address = $address;
}
/**
* @internal for mapping via Symfony component.
*/
public function setGeo(Geo $geo): void
{
$this->geo = $geo;
}
/**
* @return OpeningHour[]
* @internal for mapping via Symfony component.
*/
public function getOpeningHoursSpecification(): array
{
return $this->openingHours;
}
/**
* @internal for mapping via Symfony component.
*/
public function addOpeningHoursSpecification(OpeningHour $openingHour): void
{
$this->openingHours[] = $openingHour;
}
/**
* @internal for mapping via Symfony component.
*/
public function removeOpeningHoursSpecification(OpeningHour $openingHour): void
{
}
/**
* @internal for mapping via Symfony component.
* @return ForeignReference[]
*/
public function getParkingFacilityNearBy(): array
{
return $this->parkingFacilitiesNearBy;
}
/**
* @internal for mapping via Symfony component.
*/
public function addParkingFacilityNearBy(ForeignReference $parkingFacilityNearBy): void
{
$this->parkingFacilitiesNearBy[] = $parkingFacilityNearBy;
}
/**
* @internal for mapping via Symfony component.
*/
public function removeParkingFacilityNearBy(ForeignReference $parkingFacilityNearBy): void
{
}
/**
* @internal for mapping via Symfony component.
* @param string|array $sanitation
*/
public function setSanitation($sanitation): void
{
if (is_string($sanitation)) {
$sanitation = [$sanitation];
}
$this->sanitations = PropertyValues::removePrefixFromEntries($sanitation);
}
/**
* @internal for mapping via Symfony component.
* @param string|array $otherService
*/
public function setOtherService($otherService): void
{
if (is_string($otherService)) {
$otherService = [$otherService];
}
$this->otherServices = PropertyValues::removePrefixFromEntries($otherService);
}
/**
* @internal for mapping via Symfony component.
* @param string|array $trafficInfrastructure
*/
public function setTrafficInfrastructure($trafficInfrastructure): void
{
if (is_string($trafficInfrastructure)) {
$trafficInfrastructure = [$trafficInfrastructure];
}
$this->trafficInfrastructures = PropertyValues::removePrefixFromEntries($trafficInfrastructure);
}
/**
* @internal for mapping via Symfony component.
* @param string|array $paymentAccepted
*/
public function setPaymentAccepted($paymentAccepted): void
{
if (is_string($paymentAccepted)) {
$paymentAccepted = [$paymentAccepted];
}
$this->paymentsAccepted = PropertyValues::removePrefixFromEntries($paymentAccepted);
}
/**
* @internal for mapping via Symfony component.
*/
public function setDistanceToPublicTransport(array $distanceToPublicTransport): void
{
$unit = $distanceToPublicTransport['unitCode'] ?? '';
$value = $distanceToPublicTransport['value'] ?? '';
if ($unit && $value) {
$this->distanceToPublicTransport = $value . ':' . PropertyValues::removePrefixFromEntry($unit);
}
}
}