Skip to content

Commit

Permalink
refactored import statements for clarity and consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
limenet committed Jan 22, 2024
1 parent 9c17c5a commit f2f1055
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/Document/AbstractDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
namespace Valantic\ElasticaBridgeBundle\Document;

use Pimcore\Model\Asset;
use Pimcore\Model\Asset\Listing as AssetListing;
use Pimcore\Model\DataObject;
use Pimcore\Model\DataObject\Listing as DataObjectListing;
use Pimcore\Model\Document as PimcoreDocument;
use Pimcore\Model\Document\Listing as DocumentListing;
use Pimcore\Model\Element\AbstractElement;
use Pimcore\Model\Listing\AbstractListing;
use Valantic\ElasticaBridgeBundle\Enum\DocumentType;
Expand Down Expand Up @@ -42,12 +39,12 @@ public function getListingInstance(IndexInterface $index): AbstractListing
}

if (in_array($this->getType(), DocumentType::casesPublishedState(), true)) {
/** @var DocumentListing|DataObjectListing $listingInstance */
/** @var PimcoreDocument\Listing|DataObject\Listing $listingInstance */
$listingInstance->setUnpublished($this->includeUnpublishedElementsInListing());
}

if ($this->getType() === DocumentType::DATA_OBJECT && $this->treatObjectVariantsAsDocuments()) {
/** @var DataObjectListing $listingInstance */
/** @var DataObject\Listing $listingInstance */
$listingInstance->setObjectTypes([
DataObject\AbstractObject::OBJECT_TYPE_OBJECT,
DataObject\AbstractObject::OBJECT_TYPE_VARIANT,
Expand Down Expand Up @@ -129,8 +126,8 @@ protected function getListingClass(): string
{
try {
return match ($this->getType()) {
DocumentType::ASSET => AssetListing::class,
DocumentType::DOCUMENT => DocumentListing::class,
DocumentType::ASSET => Asset\Listing::class,
DocumentType::DOCUMENT => PimcoreDocument\Listing::class,
DocumentType::DATA_OBJECT, DocumentType::VARIANT => $this->getDataObjectListingClass(),
};
} catch (\UnhandledMatchError) {
Expand Down Expand Up @@ -206,7 +203,7 @@ private function getDataObjectListingClass(): string
$subType = $this->getSubType();

if ($subType === null) {
return DataObjectListing::class;
return DataObject\Listing::class;
}

$className = $subType . '\Listing';
Expand Down

0 comments on commit f2f1055

Please sign in to comment.