Skip to content

Commit

Permalink
[#12295] - Added Container object, PSR-11 compliant
Browse files Browse the repository at this point in the history
  • Loading branch information
niden committed Dec 23, 2018
1 parent 87eb4f7 commit 479364a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions phalcon/container.zep
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/

namespace Phalcon;

use Psr\Container\ContainerInterface;
use Phalcon\DiInterface;

final class Container implements ContainerInterface
{
/**
* @var <DiInterface>
*/
protected container;

/**
* Phalcon\Di constructor
*/
public function __construct(<DiInterface> container)
{
let this->container = container;
}

/**
* Return the service
*/
public function get(var name) -> var
{
return this->container->getService(name);
}

/**
* Whether a service exists or not in the container
*/
public function has(var name) -> bool
{
return this->container->has(name);
}
}

0 comments on commit 479364a

Please sign in to comment.