Null object pattern: Difference between revisions

Content deleted Content added
Bluelinking 1 books for verifiability.) #IABot (v2.1alpha3
PHP: PHP-FIG PSR
Line 377:
=== PHP ===
<source lang="php">
interface Animal
{
public function makeSound();
}
 
class Dog implements Animal
{
public function makeSound() {
{
echo "Woof..";
}
}
 
class Cat implements Animal
{
public function makeSound() {
{
echo "Meowww..";
}
}
 
class NullAnimal implements Animal
{
public function makeSound() {
{
// silence...
}