Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Juan Luis García Borrego JuanLuisGarciaBorrego

🏠
Working from home
View GitHub Profile
@JuanLuisGarciaBorrego
JuanLuisGarciaBorrego / UserRepository.php
Created Jul 5, 2015
UserRepository DeleteInterface
View UserRepository.php
class UserRepository implements CRUInterface
{
public function insert($data)
{
//acción insert en BD
}
public function update($data)
{
//acción update en BD
}
View ArticleRepository.php
class ArticleRepository implements CRUInterface, DeleteInterface
{
public function insert($data)
{
//acción insert en BD
}
public function update($data)
{
//acción update en BD
}
View DeleteInterfaz.php
interfaz DeleteInterface
{
public function delete($data);
}
View CRUInterface.php
interfaz CRUInterface
{
public function insert($data);
public function update($data);
public function findAll($data);
public function findById($data);
}
View UserRepository.php
class UserRepository implements RepositoryInterface
{
public function insert($data)
{
//acción insert en BD
}
public function update($data)
{
//acción update en BD
}
View ArticleRepository.php
class ArticleRepository implements RepositoryInterface
{
public function insert($data)
{
//acción insert en BD
}
public function update($data)
{
//acción update en BD
}
View RepositoryInterface.php
interfaz RepositoryInterface
{
public function insert($data);
public function update($data);
public function delete($data);
public function findAll($data);
public function findById($data);
}
View InstanceApplicationLSP.php
$welcomeUser = new Application("Juan Luis");
//Bienvenid@ Juan Luis
echo $welcomeUser->getWelcome(new SpanishHello());
//Wellcome Juan Luis
echo $welcomeUser->getWelcome(new EnglishHello());
View ApplicationLSP.php
class Application
{
protected $name;
public function __construct($name)
{
$this->name = $name;
}
public function welcome(WelcomeInterface $wellcome)
{
View WelcomeInterface.php
interface WelcomeInterface
{
public function getWelcome();
}
class SpanishWellcome implements WelcomeInterface
{
public function getWelcome()
{
return "Bienvenid@";