Webmozart\Console\Api\Formatter\StyleSet::get PHP Method

get() public method

Returns the style with the given tag.
public get ( string $tag ) : Style
$tag string The tag of the style.
return Style The style.
    public function get($tag)
    {
        if (!isset($this->styles[$tag])) {
            throw new OutOfBoundsException(sprintf('The style tag "%s" does not exist.', $tag));
        }
        return $this->styles[$tag];
    }

Usage Example

Example #1
0
 /**
  * @expectedException \OutOfBoundsException
  * @expectedExceptionMessage foobar
  */
 public function testGetFailsIfNotFound()
 {
     $styleSet = new StyleSet();
     $styleSet->get('foobar');
 }