for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Loevgaard\SyliusBrandPlugin\Assigner;
use Loevgaard\SyliusBrandPlugin\Model\BrandInterface;
use Loevgaard\SyliusBrandPlugin\Model\ProductInterface;
final class ProductsAssigner implements ProductsAssignerInterface
{
/**
* {@inheritdoc}
*/
public function assign(BrandInterface $brand, array $products): void
foreach ($products as $product) {
if (!$product instanceof ProductInterface) {
throw new \RuntimeException(sprintf(
"Some product was not found to assign to brand '%s'",
$brand->getCode()
));
}
$brand->addProduct($product);