This file contains hidden or 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 Order | |
{ | |
public function notifyBuyer($email) | |
{ | |
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) { | |
throw new InvalidEmailException; | |
} | |
return $this->repository->sendEmail($email); |
This file contains hidden or 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 Email { | |
public $email; | |
public function __construct($email) | |
{ | |
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) { | |
throw new InvalidEmailException; | |
} |
This file contains hidden or 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 Buyer { | |
protected $name; | |
protected $purchases; | |
public function getName() {/**/} | |
public function setName($name) {/**/} | |
public function getPurchases() {/**/} |
This file contains hidden or 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 Buyer { | |
protected $name; | |
protected $purchases; | |
public function addNewPurchase() | |
{ | |
$this->purchases++; | |
} |
This file contains hidden or 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 | |
public function store(Request $request) | |
{ | |
// Create a new comment | |
$comment = Comment::create($request->all()); | |
// Find the author and highlight the comment on your profile | |
$user = User::find( $request->get('user_id') ); | |
$user->profile->highlightNewComment($comment); |
This file contains hidden or 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 | |
public function store(Request $request) | |
{ | |
$comment = $this->createComment($request->all()); | |
$this->highlightCommentOnUser( $request->get('user_id'), $comment); | |
$this->notifyUsersInteractedWithPost($comment->post); | |
return ['success' => true]; |
This file contains hidden or 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 | |
$search = isset($_GET['search']) ? trim($_GET['search']) : null; | |
if ($search) { | |
$posts = new WP_Query([ | |
's' = $search, | |
'post_type' => 'downloads' | |
]); | |
} |
This file contains hidden or 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 | |
protected function debug($data) | |
{ | |
$fileName = "/home/mfurtado/mark.txt"; | |
$content = file_get_contents($fileName); | |
$newContent = $content . "------------\n".json_encode($data)."\n------------\n"; | |
file_put_contents($fileName, $newContent); | |
} |
This file contains hidden or 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
<scheme name="Mark Material Theme Dark" version="142" parent_scheme="Default"> | |
<option name="FONT_SCALE" value="1.0" /> | |
<metaInfo> | |
<property name="created">2017-04-07T02:25:41</property> | |
<property name="ide">PhpStorm</property> | |
<property name="ideVersion">2017.1.1.0.0</property> | |
<property name="modified">2017-09-19T22:34:18</property> | |
<property name="originalScheme">Material Theme - Darker</property> | |
</metaInfo> | |
<option name="LINE_SPACING" value="1.6" /> |
This file contains hidden or 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
# v2 syntax | |
version: '2' | |
volumes: | |
# MySQL Data | |
subnet-mysql-data: | |
driver: local | |
# Redis Data | |
subnet-redis-data: |