Skip to content

Instantly share code, notes, and snippets.

<?php
interface Reporter {
/** @return string */
public function getSupportedContext();
/** @return array */
public function getHandlers();
}
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
@fesor
fesor / example.js
Last active September 29, 2015 18:17
Example NG
import angular from 'angular';
import dxMediaFeed from './media/media_feed.component.js';
export default angular
.module('app', [])
.config(statesConfig)
.name;
function statesConfig($stateProvider) {
$stateProvider.state('media', {
@fesor
fesor / Freezable.php
Last active September 24, 2015 19:50
<?php
abstract class Freezable
{
private $attributes;
private $isFreezed;
public function __get($name) {
return $this->attributes[$name];
@fesor
fesor / AbstractRequest.php
Last active August 2, 2022 11:32
DTO example
<?php
namespace SomeApp\Application\DTO;
use Symfony\Component\OptionsResolver\OptionsResolver;
abstract class AbstractRequest
{
public function __construct(array $data)
<?php
class Photo
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
function postStartNegotiations1(Property $property, Offer $offer)
{
return $this->get('app.command.add_offer')->execute((object) [
'suggestedPrice' => $offer->getSuggestedPrice(),
'buyer' => $this->getUser(),
'advert' => $advert
]);
}
function postStartNegotiations2(Property $property, Offer $offer)
<?php
class AddAdvertPhotoCommand implements CommandInterface
{
private $repository;
private $fileUploader;
public function __construct(
AdvertPhotoRepositoryInterface $repository,
FileUploaderInterface $fileUploader
class Translation {
public static function fromDTO($dto) {
$translation = new static($dto->locale);
$translation->address = $dto->address;
// ...
return $translation;
}
<?php
class KernelEventsSubscriber {
public function flushChanges()
{
$this->em->flush();
}
public function prepareResponse(GetResponseForControllerResultEvent $event)