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 A\Parser; | |
use A\Parser\ParserDriver; | |
use Mews\Purifier\Purifier; | |
use Parsedown; | |
class ParsedownPurifierParserDriver implements ParserDriver | |
{ | |
protected $trusted_settings = [ |
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 ArticleRepository { | |
/** | |
* Because of how Eloquent works, an instance of a model is also a starting point to | |
* execute queries on it. This class should be instantiated by Laravel's IoC (e.g. | |
* constructor injection on a higher class, or App::make) so you never actually should | |
* need to do "new ArticleRepository(new Article)". | |
* |
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 | |
/** | |
* @test | |
*/ | |
public function users_can_post_links_in_their_profile() | |
{ | |
$mario = $this->registerAndLoginAsMario(); | |
$set = $this->callJson('PUT', "/api/users/{$mario->hash}/profile", ['bio' => "A URL: http://www.google.com"]); | |
$fetch = $this->callJson('GET', "/api/users/{$mario->hash}/profile"); |
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 | |
// you can do this from any code, anywhere in your codebase | |
$service = new CakeService; | |
$service->makeOrder("Bob", "Chocolate"); |
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 CakeController { | |
public function __construct (CakeService $cakeService) { | |
$this->cakeService = $cakeService; | |
} | |
public function createOrder() { | |
$customer = Input::get('customer'); | |
$flavor = Input::get('flavor'); | |
return $this->cakeService->makeOrder($customer, $flavor); |
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 CakeService { | |
public function makeOrder($customer, $flavor) { | |
$cake = new Cake(); | |
$cake->isFor($customer); | |
$cake->addFlavor($flavor); | |
$cake->bake(); | |
$cake->save(); | |
return $cake; |
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 CakeController { | |
public function createOrder() { | |
$cake = new Cake(); | |
$cake->isFor(Input::get('customer')); | |
$cake->addFlavor(Input::get('flavor')); | |
$cake->bake(); | |
$cake->save(); | |
return $cake; |