3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Project\Model\Entity; /** * Class EntityFactory * * A factory to DI around to build entities * * @package Project\Model\Entity */ class EntityFactory { /** * Create your entity * * @param string $entityName This should be the concrete name of the entity, like 'User' or 'Test' * @param array $args Single dimensional array of required entity arguments * * @return object The entity - you will have to typehint the object in your code for IDE auto-completion */ public function buildEntity($entityName, array $args = []) { if (!class_exists($className = sprintf('%s\%s', __NAMESPACE__, $entityName))) { throw new \InvalidArgumentException(sprintf( 'Invalid entity name provided, got: %s', $entityName )); } $reflector = new \ReflectionClass($className); return $reflector->newInstanceArgs($args); } }
Output for git.master, git.master_jit, rfc.property-hooks

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
59.23 ms | 401 KiB | 8 Q