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 Bonus | |
{ | |
public function apply(Amount $amount): Amount; | |
} | |
class AbsoluteBonus implements Bonus | |
{ | |
public static function fromInt(int $value): self |
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 Command | |
{ | |
// Self-validating command | |
public static function loadValidatorMetadata(ClassMetadata $metadata): void | |
{ | |
$metadata->addConstraint( | |
new Callback(function(Command $command, ExecutionContextInterface $context) { | |
$reflClass = new \ReflectionClass($command); |
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 A | |
{ | |
} | |
class B | |
{ | |
} | |
class C | |
{ |
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 | |
require __DIR__.'/vendor/autoload.php'; | |
use Rx\Observable; | |
use Rx\Observer\CallbackObserver; | |
$events = Observable::fromArray([ | |
['name' => 'account_was_created', 'payload' => ['id' => 1, 'owner' => 'Gildas Quéméner']], | |
['name' => 'deposit_was_performed', 'payload' => ['id' => 1, 'amount' => 100]], |
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 | |
require __DIR__.'/vendor/autoload.php'; | |
use Rx\Observable; | |
use Rx\Observer\CallbackObserver; | |
$events = Observable::fromArray([ | |
['name' => 'account_was_created', 'payload' => ['id' => 1, 'owner' => 'Gildas Quéméner']], | |
['name' => 'deposit_was_performed', 'payload' => ['id' => 1, 'amount' => 100]], |
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 Repository | |
{ | |
public function findAll(): array | |
{ | |
return $this->connection->project( | |
sprintf('SELECT * FROM %s', self::TABLE_NAME), | |
[], | |
function(array $row): Domain\MyObject { | |
return Domain\MyObject::fromArray($row); |
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 | |
declare(strict_types=1); | |
namespace App\ServiceBus\Plugin; | |
use Prooph\Common\Event\ActionEvent; | |
use Prooph\Common\Messaging\Query; | |
use Prooph\ServiceBus\MessageBus; | |
use Prooph\ServiceBus\QueryBus; |
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 | |
declare (strict_types = 1); | |
namespace App\EventListener; | |
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | |
use Symfony\Component\HttpKernel\KernelEvents; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; | |
use Symfony\Component\HttpFoundation\Response; |
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 | |
$files = $argv; | |
unset($files[0]); | |
$packages = []; | |
foreach ($files as $file) { | |
$composer = json_decode(file_get_contents($file), true); | |
$requirements = $composer['require']; |
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
export default function(eventTracker) { | |
return store => next => action => { | |
eventTracker.trackEvent(action.type); | |
return next(action); | |
}; | |
} |
NewerOlder