Skip to content

Commit

Permalink
Added new 'resolvable' and 'isAlias' methods to the container.
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Oct 31, 2013
1 parent 9974593 commit 8f240f8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 22 additions & 0 deletions src/Illuminate/Container/Container.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,17 @@ class Container implements ArrayAccess {
*/
protected $globalResolvingCallbacks = array();

/**
* Determine if a given string is resolvable.
*
* @param string $abstract
* @return bool
*/
protected function resolvable($abstract)
{
return $this->bound($abstract) || $this->isAlias($abstract);
}

/**
* Determine if the given abstract type has been bound.
*
Expand All @@ -69,6 +80,17 @@ public function bound($abstract)
return isset($this[$abstract]) || isset($this->instances[$abstract]);
}

/**
* Determine if a given string is an alias.
*
* @param string $name
* @return bool
*/
public function isAlias($name)
{
return isset($this->aliases[$name]);
}

/**
* Register a binding with the container.
*
Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Foundation/changes.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
{"message": "Cloned Eloquent query builders now clone the underlying query builder.", "backport": null},
{"message": "Allow for passing of custom attributes into Validator::make as fourth parameter.", "backport": null},
{"message": "Allow comma delimited list of queues to be passed to queue:listen / queue:work to implement queue priority.", "backport": null},
{"message": "When new bindings are added to container, old aliases bound to that key will now be dropped.", "backport": null}
{"message": "When new bindings are added to container, old aliases bound to that key will now be dropped.", "backport": null},
{"message": "Added new 'resolvable' and 'isAlias' methods to the container.", "backport": null}
],
"4.0.x": [
{"message": "Added implode method to query builder and Collection class.", "backport": null},
Expand Down

0 comments on commit 8f240f8

Please sign in to comment.