This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface ConnectionInterface | |
{ | |
public function connect(); | |
} | |
class DbConnection implements ConnectionInterface | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Report; | |
use Report\Repositories\OrdersRepository; | |
class OrdersReport | |
{ | |
protected $repo; | |
protected $formatter; | |
public function __construct(OrdersRepository $repo, OrdersOutPutInterface $formatter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class AbstractClass | |
{ | |
// Force Extending class to define this method | |
abstract protected function getValue(); | |
public function printOut() | |
{ | |
print $this->getValue() . "\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class Template | |
{ | |
public function make() | |
{ | |
return $this | |
->addHotWater() | |
->addSugar() | |
->addPrimaryToppings() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Logger | |
{ | |
public function execute($message); | |
} | |
class LogToDatabase implements Logger | |
{ | |
public function execute($message){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface Logger | |
{ | |
public function execute(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Coffee | |
{ | |
public function addCoffee() | |
{ | |
var_dump('Add proper amount of coffee'); | |
return $this; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Tea | |
{ | |
public function addTea() | |
{ | |
var_dump('Add proper amount of tea'); | |
return $this; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LogToDatabase | |
{ | |
public function execute($message) | |
{ | |
var_dump('log the message to a database :'.$message); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Defines a one-to-many dependency between objects so that | |
* when one object changes state, all its dependents are notified and updated automatically. | |
*/ | |
interface Subject{ | |
public function attach($observable); | |
public function detach($index); |
NewerOlder