Skip to content

Instantly share code, notes, and snippets.

View pchelk1n's full-sized avatar

Dmitriy pchelk1n

View GitHub Profile
@pchelk1n
pchelk1n / Test.php
Last active February 9, 2021 08:40
Kohana, inject services in controller action with Symfony DependencyInjection Component
<?php
namespace App;
class Test
{
private $test2;
public function __construct(Test2 $test2)
{
@pchelk1n
pchelk1n / Handler.php
Last active November 23, 2022 08:54
PHP Strategy Pattern
<?php
namespace App\YourStrategyResolver\Handlers;
interface Handler
{
public function can(): bool;
public function do(): array;
}
@pchelk1n
pchelk1n / AbstractRequestData.php
Last active October 30, 2019 07:21
Symfony Request argument resolver
<?php
namespace App\ArgumentResolver;
use Symfony\Component\Validator\ConstraintViolationListInterface;
class AbstractRequestData
{
/**
* @var ConstraintViolationListInterface
@pchelk1n
pchelk1n / Encrypter.php
Last active September 21, 2020 12:51
Simple encrypt
<?php
namespace App\Service;
class Encrypter
{
private const METHOD = 'aes-256-cbc';
private const DELIMITER = '::';
private const WRONG_ENCRYPT_SYMBOLS = ['+','/','='];
private const CORRECT_ENCRYPT_SYMBOLS = ['-','_',''];
<?php
namespace AppBundle\Entity\Spec;
use Doctrine\ORM\QueryBuilder;
use Happyr\DoctrineSpecification\Query\QueryModifier;
/**
* Class Select
*/