Skip to content

Instantly share code, notes, and snippets.

@stivni
Last active August 29, 2015 13:57
Show Gist options
  • Save stivni/9455054 to your computer and use it in GitHub Desktop.
Save stivni/9455054 to your computer and use it in GitHub Desktop.
Sensible Interfaces
<?php
namespace SrcFolder\LibraryNamespace
interface LibraryInterface
{
public addItemMethod(ItemInterface $itemArgument)
public rentMethod(ItemInterface $itemArgument, ClientInterface $clientArgument);
}
interface ItemInterface
{
public getIdentifierMethod();
}
interface ClientInterface
{
public getIdentifierMethod();
}
class LibraryClass implements LibraryInterface
{
private $inventoryProperty = [];
private $rentsProperty = [];
public function addItemMethod(ItemInterface $itemArgument)
{
//...
}
public function rentItemMethod(ItemInterface $itemArgument, ClientInterface $clientArgument)
{
//...
}
}
class BookClass implements ItemInterface
{
private $isbnProperty;
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment