Added drafts for entity interfaces

This commit is contained in:
Kevin Frantz 2018-07-14 00:15:00 +02:00
parent 4845deddc6
commit 6fcef40e10
8 changed files with 297 additions and 0 deletions

View File

@ -0,0 +1,16 @@
<?php
namespace entity\color;
/**
* In a real Application color would be saved in the database
* Otherwise it's agains "Normalisierung" ;)
* @author kevinfrantz
*
*/
interface ColorInterface
{
public function setColor(string $color):void;
public function getColor():string;
}

View File

@ -0,0 +1,41 @@
<?php
namespace entity\currency;
/**
*
* @author kevinfrantz
*
*/
interface CurrencyInterface
{
/**
* Sets the value of the currency
* @param int $cents
*/
public function setCents(int $cents):void;
/**
* Returns the currency value in cents
* @return int
*/
public function getCents():int;
/**
* Returns the currency value as float (rounded on two decimal behind the )
* @return float
*/
public function getFloat():float;
/**
* Returns the name of the currency
* @return string
*/
public function getName():string;
/**
* Returns the symbol of the currency
* @return string
*/
public function getSymbol():string;
}

View File

@ -0,0 +1,26 @@
<?php
namespace entity\image;
/**
*
* @author kevinfrantz
*
*/
interface ImageInterface
{
/**
* @param string $path
*/
public function setImage(string $path):void;
/**
* @return string
*/
public function getImage():string;
/**
* @return string
*/
public function getImageThumbnail():string;
}

View File

@ -0,0 +1,59 @@
<?php
namespace entity\order;
use entity\product\ProductInterface;
use Doctrine\Common\Collections\ArrayCollection;
use entity\user\UserInterface;
/**
* Status in this class is bool
* True when order is finished
* Fales when order is open
*
* In a real application an entity status would be helpfull ;)
*
* @author kevinfrantz
*
*/
interface OrderInterface
{
/**
* @param ProductInterface $product
*/
public function addProduct(ProductInterface $product):void;
/**
* @param ProductInterface $product
*/
public function removeProduct(ProductInterface $product):void;
/**
* @return ArrayCollection
*/
public function getProducts():ArrayCollection;
/**
* @return int
*/
public function getId():int;
/**
* @return UserInterface
*/
public function getCustomer():UserInterface;
/**
* @param UserInterface $customer
*/
public function setCutomer(UserInterface $customer);
/**
* @param bool $status
*/
public function setStatus(bool $status):void;
/**
* @return bool
*/
public function getStatus():bool;
}

View File

@ -0,0 +1,12 @@
<?php
namespace entity\payment;
/**
*
* @author kevinfrantz
*
*/
interface PaymentInterface
{
}

View File

@ -0,0 +1,31 @@
<?php
namespace entity\price;
use entity\currency\CurrencyInterface;
/**
*
* @author kevinfrantz
*
*/
interface PriceInterface
{
/**
* Sets the price
* @param CurrencyInterface $price
*/
public function setPrice(CurrencyInterface $price):void;
/**
* Returns the netto price
* @return int
*/
public function getNetto():CurrencyInterface;
/**
* Returns the gross price
* @return int
*/
public function getGross():CurrencyInterface;
}

View File

@ -0,0 +1,63 @@
<?php
namespace entity\product;
use entity\price\PriceInterface;
use entity\image\ImageInterface;
use entity\color\ColorInterface;
/**
* Attention:
* This interface containes the accercors for color.
* In a real application I wouldn't hardcode acceccors for a special attribute into the product.
* Instead I would make an ArrayCollection $attributes which containes all of the product attributes.
* @author kevinfrantz
*
*/
interface ProductInterface
{
/**
* @return PriceInterface
*/
public function getPrice():PriceInterface;
/**
* @param PriceInterface $price
*/
public function setPrice(PriceInterface $price):void;
/**
* @param ImageInterface $image
*/
public function setImage(ImageInterface $image):void;
/**
* @return ImageInterface
*/
public function getImage():ImageInterface;
/**
* @return string
*/
public function getName():string;
/**
* @param string $name
*/
public function setName(string $name):void;
/**
* @return ColorInterface
*/
public function getColor():ColorInterface;
/**
* @param ColorInterface $color
*/
public function setColor(ColorInterface $color):void;
/**
* @return int
*/
public function getId():int;
}

View File

@ -0,0 +1,49 @@
<?php
namespace entity\user;
/**
* Theoreticly you could make an own entity for name
* (Depends on the use case.)
* In this case I just assume that the user just has an username, which is just a string
* The same counts for email ;) -> In a real application: Entity Email ;)
* @author kevinfrantz
*
*/
interface UserInterface
{
/**
* @param string $hash
*/
public function setPasswordHash(string $hash):void;
/**
* @return string
*/
public function getPasswordHash():string;
/**
* @param string $name
*/
public function setName(string $name):void;
/**
* @return string
*/
public function getName():string;
/**
* @param string $email
*/
public function setEmail(string $email):void;
/**
* @return string
*/
public function getEmail():string;
/**
* @return int
*/
public function getId():int;
}