Skip to content

Instantly share code, notes, and snippets.

View ismail1432's full-sized avatar
🏠
Looking for remote job

Smaine Milianni ismail1432

🏠
Looking for remote job
View GitHub Profile
<?php
namespace App\Infrastucture\InMemory;
use App\Domain\User;
use App\Domain\UserRepositoryInterface;
class InMemoryUserRepository implements UserRepositoryInterface
{
private User[] $users;
<?php
namespace App\Domain;
interface UserRepositoryInterface
{
public function save(User $user): void;
}
<?php
namespace App\Domain;
final class CreateAUserHandler
{
private UserRepositoryInterface $userRepository;
public function __construct(UserRepositoryInterface $userRepository)
{
@ismail1432
ismail1432 / User.php
Last active September 10, 2023 23:11
<?php
namespace App\Domain;
use Symfony\Component\Uid\Uuid;
final class User
{
private UserId $userId;
<?php
namespace App\Domain;
final class UserId
{
private string $id;
public function __construct(string $id)
{
<?php
namespace App\Application;
use Symfony\Component\Validator\Constraints as Assert;
final class CreateAUserPayload
{
/**
* @Assert\Type(type="string")
<?php
namespace App\UserlandTransport;
use Symfony\Component\Notifier\Transport\AbstractTransportFactory;
use Symfony\Component\Notifier\Transport\Dsn;
use Symfony\Component\Notifier\Transport\TransportInterface;
class UserlandTransportFactory extends AbstractTransportFactory
{
<?php
namespace App\UserlandTransport;
use Symfony\Component\Notifier\Message\MessageInterface;
use Symfony\Component\Notifier\Message\SentMessage;
use Symfony\Component\Notifier\Transport\AbstractTransport;
final class UserlandTransport extends AbstractTransport
{
<?php
class SandboxController
{
/**
* @Route("/onboarding", name="onboarding")
*/
public function onboarding(NotifierInterface $notifier): Response
{
$notification = new Notification('Welcome Aboard', ['chat/slack']);
<?php
if (isset([$_GET['id']) && isset([$_GET['limit'])) {
// stuff
}
// can be
if (isset($_GET['id'], $_GET['limit']) {
// stuff
}