Skip to content

Commit

Permalink
ServiceDefinition: added getTag()
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Aug 27, 2014
1 parent e92f739 commit 680c7da
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/DI/ServiceDefinition.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ public function addTag($tag, $attrs = TRUE)
}


public function getTag($tag)
{
return isset($this->tags[$tag]) ? $this->tags[$tag] : NULL;
}


/** @deprecated */
public function setShared($on)
{
Expand Down
4 changes: 4 additions & 0 deletions tests/DI/ServiceDefinition.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,8 @@ test(function(){
'tag1' => TRUE,
'tag2' => array(1, 2),
), $def->getTags() );

Assert::equal( TRUE, $def->getTag('tag1') );
Assert::equal( array(1, 2), $def->getTag('tag2') );
Assert::equal( NULL, $def->getTag('tag3') );
});

0 comments on commit 680c7da

Please sign in to comment.