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); |
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 MySQLConnection | |
{ | |
/** | |
* db connection | |
*/ | |
public function connect() | |
{ | |
var_dump('MYSQL Connection'); | |
} |
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 | |
namespace Demo; | |
use DB; | |
class OrdersReport | |
{ | |
public function getOrdersInfo($startDate, $endDate) | |
{ | |
$orders = $this->queryDBForOrders($startDate, $endDate); | |
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 WorkAbleInterface | |
{ | |
public function work(); | |
} | |
interface SleepAbleInterface | |
{ | |
public function sleep(); | |
} |
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 workerInterface | |
{ | |
public function work(); | |
public function sleep(); | |
} | |
class HumanWorker implements workerInterface | |
{ | |
public function work() |
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 LessonRepositoryInterface | |
{ | |
/** | |
* Fetch all records. | |
* | |
* @return array | |
*/ | |
public function getAll(); | |
} |
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 AreaInterface | |
{ | |
public function calculateArea(); | |
} | |
class Rectangle implements AreaInterface | |
{ | |
public $width; | |
public $height; |
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 Rectangle | |
{ | |
public $width; | |
public $height; | |
public function __construct($width, $height) | |
{ | |
$this->width = $width; | |
$this->height = $height; | |
} |
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 | |
{ | |
/** |
OlderNewer