vendor/shopware/core/System/Tax/Aggregate/TaxRule/TaxRuleCollection.php line 16

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\System\Tax\Aggregate\TaxRule;
  3. use Shopware\Core\Framework\DataAbstractionLayer\EntityCollection;
  4. /**
  5.  * @method void               add(TaxRuleEntity $entity)
  6.  * @method void               set(string $key, TaxRuleEntity $entity)
  7.  * @method TaxRuleEntity[]    getIterator()
  8.  * @method TaxRuleEntity[]    getElements()
  9.  * @method TaxRuleEntity|null get(string $key)
  10.  * @method TaxRuleEntity|null first()
  11.  * @method TaxRuleEntity|null last()
  12.  */
  13. class TaxRuleCollection extends EntityCollection
  14. {
  15.     public function sortByTypePosition(): void
  16.     {
  17.         $this->sort(function (TaxRuleEntity $entityATaxRuleEntity $entityB) {
  18.             return $entityA->getType()->getPosition() <=> $entityB->getType()->getPosition();
  19.         });
  20.     }
  21.     public function getApiAlias(): string
  22.     {
  23.         return 'tax_rule_collection';
  24.     }
  25.     protected function getExpectedClass(): string
  26.     {
  27.         return TaxRuleEntity::class;
  28.     }
  29. }