Skip to content

Instantly share code, notes, and snippets.

View omarkdev's full-sized avatar

Marcos Felipe omarkdev

View GitHub Profile
<?php
class Order
{
public function notifyBuyer($email)
{
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
throw new InvalidEmailException;
}
return $this->repository->sendEmail($email);
<?php
class Email {
public $email;
public function __construct($email)
{
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
throw new InvalidEmailException;
}
<?php
class Buyer {
protected $name;
protected $purchases;
public function getName() {/**/}
public function setName($name) {/**/}
public function getPurchases() {/**/}
<?php
class Buyer {
protected $name;
protected $purchases;
public function addNewPurchase()
{
$this->purchases++;
}
<?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);
<?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];
<?php
$search = isset($_GET['search']) ? trim($_GET['search']) : null;
if ($search) {
$posts = new WP_Query([
's' = $search,
'post_type' => 'downloads'
]);
}
<?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);
}
<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" />
# v2 syntax
version: '2'
volumes:
# MySQL Data
subnet-mysql-data:
driver: local
# Redis Data
subnet-redis-data: