vendor/shopware/core/Framework/Struct/AssignArrayTrait.php line 12

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace Shopware\Core\Framework\Struct;
  3. trait AssignArrayTrait
  4. {
  5.     /**
  6.      * @param array<mixed> $options
  7.      *
  8.      * @return $this
  9.      */
  10.     public function assign(array $options)
  11.     {
  12.         foreach ($options as $key => $value) {
  13.             if ($key === 'id' && method_exists($this'setId')) {
  14.                 $this->setId($value);
  15.                 continue;
  16.             }
  17.             try {
  18.                 $this->$key $value;
  19.             } catch (\Error | \Exception $error) {
  20.                 // nth
  21.             }
  22.         }
  23.         return $this;
  24.     }
  25. }