<?php
namespace Symfony\Component\DependencyInjection\Loader;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* ClosureLoader loads service definitions from a PHP closure.
* The Closure has access to the container as its first argument.
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
class ClosureLoader extends Loader
{
* Loads a Closure.
* @param \Closure $resource The resource
public function load($closure)
call_user_func($closure, $this->container);
}
* Returns true if this class supports the given resource.
* @param mixed $resource A resource
* @return Boolean true if this class supports the given resource, false otherwise
public function supports($resource)
return $resource instanceof \Closure;