Skip to content

Instantly share code, notes, and snippets.

View gskema's full-sized avatar

Gytis Šk. gskema

  • Kaunas, Lithuania
View GitHub Profile
@gskema
gskema / ContainerServiceId.php
Created April 22, 2020 07:09
Get service ID from Symfony container by object service
<?php
namespace Vrt\UtilsBundle\Service;
use RuntimeException;
use Symfony\Component\DependencyInjection\Container;
// AppKernel::initializeContainer()
// if ('dev' === $this->environment) {
// ContainerServiceId::setContainer($this->container);
@gskema
gskema / NestedIterator.php
Last active May 3, 2021 14:32
PHP Nested Iterator
<?php
namespace Iterator;
use ArrayIterator;
use Iterator;
/**
* Takes a set of iterators [iterator1, iterator2, iterator3, ...]
* and iterates in an equivalent way to: