vendor/shopware/platform/src/Core/Framework/Struct/AssignArrayTrait.php line 10

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