Skip to content

Instantly share code, notes, and snippets.

View immutef's full-sized avatar

immutef

  • SCAYLE GmbH
  • Hamburg, Germany
View GitHub Profile
<?php
$entity = new stdClass();
$form->setData($entity);
$form->bind($entity);
var_dump($form->isValid());
<?php
class Inception extends Exception
{
static private $timesThrown = 0;
public function __construct($message = null, $code = 0)
{
if (++static::$timesThrown <= 3) {
throw new Inception($message, $code);
<?php
namespace Acme\DemoBundle\Model;
use Symfony\Component\Validator\ExecutionContextInterface;
class MyModel
{
public $myProperty;
<?php
abstract class AbstractService
{
public function __construct($required1, $required2)
{
// ...
}
}
(function($, window, document, undefined) {
$(document).ready(function() {
// hier der code ...
});
})(jQuery, window, document);
@immutef
immutef / mockery.php
Last active August 29, 2015 14:05
Mock
<?php
$mock = \Mockery::mock('FQCN');
$mock
->shouldReceive('foo')
->with(\Mockery::mustBe('bar'))
->andReturn('bar')
->once();
@immutef
immutef / ValidationFailedExceptionListener.php
Created October 4, 2014 13:55
Validation Exception Listener
<?php
namespace App\Listener\Exception;
use App\Exception\ValidationFailedException;
use JMS\DiExtraBundle\Annotation as DI;
use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Output\ConsoleOutputInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
@immutef
immutef / ValidatingCommandBus.php
Created November 29, 2014 09:46
ValidatingCommandBus for Broadway
<?php
namespace App\Bundle\Broadway\CommandHandling;
use App\Bundle\Exception\ValidationFailedException;
use Broadway\CommandHandling\CommandBusInterface;
use Broadway\CommandHandling\CommandHandlerInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;
class ValidatingCommandBus implements CommandBusInterface
@immutef
immutef / keybase.md
Created March 1, 2015 14:23
keybase.md

Keybase proof

I hereby claim:

  • I am pminnieur on github.
  • I am pminnieur (https://keybase.io/pminnieur) on keybase.
  • I have a public key whose fingerprint is 874D 6895 FCE7 B4C4 C9A8 8094 8F3E 7097 4B59 67F6

To claim this, I am signing this object:

@immutef
immutef / services.xml
Created May 5, 2010 13:54
Symfony2 DI container for Zend Framework
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://www.symfony-project.org/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="views_dir">%root_dir%/views/default</parameter>
<parameter key="view.suffix">php</parameter>
</parameters>