Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

Commit

Permalink
Created new Locator interface
Browse files Browse the repository at this point in the history
- Defines get($name, array $params = null)
- ServiceLocation and DependencyInjection now extend this
  • Loading branch information
weierophinney committed Sep 14, 2011
15 parents c004297 + b38b581 + 9a9f950 + 47a731a + 0967316 + 37f548b + 0df2db0 + e43587e + 5784352 + 93b4f40 + 3208a48 + f5dfded + 8301af5 + d4a4329 + eaf7585 commit 64a533c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
19 changes: 2 additions & 17 deletions src/DependencyInjection.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,8 @@

namespace Zend\Di;

interface DependencyInjection
interface DependencyInjection extends Locator
{

/**
* Lazy-load a class
*
* Attempts to load the class (or service alias) provided. If it has been
* loaded before, the previous instance will be returned (unless the service
* definition indicates shared instances should not be used).
*
* @param string $name Class name or service alias
* @param null|array $params Parameters to pass to the constructor
* @return object|null
*/
public function get($name, array $params = null);

/**
* Retrieve a new instance of a class
*
Expand All @@ -29,5 +15,4 @@ public function get($name, array $params = null);
* @return object|null
*/
public function newInstance($name, array $params = null);

}
}
14 changes: 14 additions & 0 deletions src/Locator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
namespace Zend\Di;

interface Locator
{
/**
* Retrieve a class instance
*
* @param string $name Class name or service name
* @param null|array $params Parameters to be used when instantiating a new instance of $name
* @return object|null
*/
public function get($name, array $params = null);
}
3 changes: 1 addition & 2 deletions src/ServiceLocation.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?php
namespace Zend\Di;

interface ServiceLocation
interface ServiceLocation extends Locator
{
public function set($name, $service);
public function get($name, array $params = null);
}

0 comments on commit 64a533c

Please sign in to comment.