2016-08-04 14:55:37 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Ion
|
|
|
|
*
|
|
|
|
* Building blocks for web development
|
|
|
|
*
|
2016-08-26 23:10:20 -04:00
|
|
|
* PHP version 5.6
|
|
|
|
*
|
2016-08-04 14:55:37 -04:00
|
|
|
* @package Ion
|
2016-08-26 23:10:20 -04:00
|
|
|
* @author Timothy J. Warren <tim@timshomepage.net>
|
|
|
|
* @copyright 2015 - 2016 Timothy J. Warren
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.html MIT License
|
|
|
|
* @version 1.0.0
|
|
|
|
* @link https://git.timshomepage.net/timw4mail/ion
|
2016-08-04 14:55:37 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Aviat\Ion\Di;
|
|
|
|
|
2016-08-29 12:51:40 -04:00
|
|
|
use Interop\Container\ContainerInterface as InteropInterface;
|
2016-08-04 14:55:37 -04:00
|
|
|
use Psr\Log\LoggerInterface;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Interface for the Dependency Injection Container
|
|
|
|
*/
|
2016-08-29 12:51:40 -04:00
|
|
|
interface ContainerInterface extends InteropInterface {
|
2016-08-04 14:55:37 -04:00
|
|
|
|
|
|
|
/**
|
2016-08-29 12:51:40 -04:00
|
|
|
* Add a factory to the container
|
2016-08-04 14:55:37 -04:00
|
|
|
*
|
2016-08-29 12:51:40 -04:00
|
|
|
* @param string $id
|
|
|
|
* @param Callable $value - a factory callable for the item
|
2016-08-04 14:55:37 -04:00
|
|
|
* @return ContainerInterface
|
|
|
|
*/
|
2016-08-29 12:51:40 -04:00
|
|
|
public function set($id, Callable $value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a specific instance in the container for an existing factory
|
|
|
|
*
|
|
|
|
* @param string $id
|
|
|
|
* @param mixed $value
|
|
|
|
* @return ContainerInterface
|
|
|
|
*/
|
|
|
|
public function setInstance($id, $value);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get a new instance of the specified item
|
|
|
|
*
|
|
|
|
* @param string $id
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function getNew($id);
|
2016-08-04 14:55:37 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determine whether a logger channel is registered
|
2016-08-29 12:51:40 -04:00
|
|
|
* @param string $id The logger channel
|
2016-08-04 14:55:37 -04:00
|
|
|
* @return boolean
|
|
|
|
*/
|
2016-08-29 12:51:40 -04:00
|
|
|
public function hasLogger($id = 'default');
|
2016-08-04 14:55:37 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a logger to the Container
|
|
|
|
*
|
|
|
|
* @param LoggerInterface $logger
|
2016-08-29 14:32:28 -04:00
|
|
|
* @param string $id The logger 'channel'
|
2016-08-04 14:55:37 -04:00
|
|
|
* @return Container
|
|
|
|
*/
|
2016-08-29 12:51:40 -04:00
|
|
|
public function setLogger(LoggerInterface $logger, $id = 'default');
|
2016-08-04 14:55:37 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve a logger for the selected channel
|
|
|
|
*
|
2016-08-29 12:51:40 -04:00
|
|
|
* @param string $id The logger to retreive
|
2016-08-04 14:55:37 -04:00
|
|
|
* @return LoggerInterface|null
|
|
|
|
*/
|
2016-08-29 12:51:40 -04:00
|
|
|
public function getLogger($id = 'default');
|
2016-08-04 14:55:37 -04:00
|
|
|
}
|