Dumplie\Inventory\Domain\Exception\ProductNotFound::bySku PHP Method

bySku() public static method

public static bySku ( SKU $sku ) : ProductNotFound
$sku Dumplie\SharedKernel\Domain\Product\SKU
return ProductNotFound
    public static function bySku(SKU $sku) : ProductNotFound
    {
        return new self(sprintf('Product with SKU "%s" does not found in inventory', $sku));
    }

Usage Example

Exemplo n.º 1
0
 /**
  * @param SKU $SKU
  *
  * @return Product
  *
  * @throws ProductNotFound - when product with given SKU were not found
  */
 public function getBySku(SKU $SKU) : Product
 {
     if (isset($this->products[(string) $SKU])) {
         return $this->products[(string) $SKU];
     }
     throw ProductNotFound::bySku($SKU);
 }
All Usage Examples Of Dumplie\Inventory\Domain\Exception\ProductNotFound::bySku
ProductNotFound