Skip to content

Instantly share code, notes, and snippets.

@amacgregor
Last active January 2, 2016 08:09
Show Gist options
  • Save amacgregor/8275059 to your computer and use it in GitHub Desktop.
Save amacgregor/8275059 to your computer and use it in GitHub Desktop.
Example Product class for without dependency injection
<?php
class Product {
private $stockItem;
private $sku;
public function __construct($sku, $stockQuantity, $stockStatus){
$this->stockItem = new StockItem($stockQuantity, $stockStatus);
$this->sku = $sku;
}
public function getStockItem(){
return $this->stockItem;
}
public function getSku(){
return $this->sku;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment