CommerceGuys\Addressing\Formatter\DefaultFormatter::getOption PHP Method

getOption() public method

public getOption ( $key )
    public function getOption($key)
    {
        return array_key_exists($key, $this->options) ? $this->options[$key] : null;
    }

Usage Example

 /**
  * @covers ::getOptions
  * @covers ::setOptions
  * @covers ::getOption
  * @covers ::setOption
  * @covers ::getDefaultOptions
  *
  * @uses \CommerceGuys\Addressing\Formatter\DefaultFormatter::__construct
  * @uses \CommerceGuys\Addressing\Formatter\DefaultFormatter::setOptions
  * @uses \CommerceGuys\Addressing\Formatter\DefaultFormatter::getDefaultOptions
  * @uses \CommerceGuys\Addressing\Repository\AddressFormatRepository
  * @uses \CommerceGuys\Addressing\Repository\CountryRepository
  * @uses \CommerceGuys\Addressing\Repository\SubdivisionRepository
  */
 public function testOptions()
 {
     $formatter = new DefaultFormatter($this->addressFormatRepository, $this->countryRepository, $this->subdivisionRepository, 'en', ['html' => false]);
     $expectedOptions = ['html' => false, 'html_tag' => 'p', 'html_attributes' => ['translate' => 'no']];
     $this->assertEquals($expectedOptions, $formatter->getOptions());
     $this->assertEquals('p', $formatter->getOption('html_tag'));
     $formatter->setOption('html_tag', 'div');
     $this->assertEquals('div', $formatter->getOption('html_tag'));
 }