Skip to content

Instantly share code, notes, and snippets.

View ger86's full-sized avatar
๐Ÿ 
Working from home

Gerardo Fernรกndez Moreno ger86

๐Ÿ 
Working from home
View GitHub Profile
<?php
namespace App\Doctrine\EntityListener;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\OnFlushEventArgs;
use App\Entity\Post;
class PostEntityListener {
<?php
namespace App\Doctrine\EntityListener;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\OnFlushEventArgs;
use App\Entity\Post;
class PostEntityListener {
/**
* @inheritDoc
* @param OnFlushEventArgs $event
<?php
namespace App\Doctrine\EntityListener;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\OnFlushEventArgs;
use App\Entity\Post;
class PostEntityListener {
/**
* @inheritDoc
* @param OnFlushEventArgs $event
<?php
namespace App\Repository;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
use App\Repository\EntityStatsRepositoryInterface;
class EntityStatsRepositoryDecorator extends ServiceEntityRepository {
<?php
namespace App\Service;
final class ShortcodeService {
private $shortcodes = [];
public function isShortcode($name) {
return isset($this->shortcodes[$name]);
}
<?php
namespace App\Shortcode;
interface ShortcodeInterface {
function getName(): string;
function getArgs(): array;
public function apply(array $attrs, string $content): string;
}
<?php
namespace App\Shortcode;
final class ButtonShortcode implements ShortcodeInterface {
public function getName(): string {
return 'well';
}
public function getArgs(): array {
return [];
<?php
namespace App\Shortcode;
interface ShortcodeInterface {
const SHORTCODE_TAG = 'lac.shortcode';
function getName(): string;
function getArgs(): array;
public function apply(array $attrs, string $content): string;
}
<?php
namespace App;
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
class ShortcodesPass extends BaseKernel implements CompilerPassInterface {
<?php
namespace App\Service;
use Stripe\Stripe;
use Stripe\Product;
final class StripeCreateProduct {
/**