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

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