/**
  * Tests getMinimumLength() and setMinimumLength().
  */
 public function testMinimumLength()
 {
     $min = $this->adapter->getMinimumLength();
     $this->assertInternalType('integer', $min);
     $this->assertGreaterThanOrEqual(0, $min);
     $newValue = $min + 2;
     $this->adapter->setMinimumLength($newValue);
     $this->assertEquals($newValue, $this->adapter->getMinimumLength());
 }
 /**
  * Accepts plugin configuration.
  *
  * Supported keys:
  *
  * service - classname of the adapter to use
  *   (either relative to PSchwisow\Phergie\Plugin\UrlShorten\Adapter or FQCN)
  *
  * minimumLength - minimum length of URL to attempt to shorten (overrides what is set in the adapter)
  *
  * skipHosts - array of hostname to not attempt to shorten
  *
  * disableDefaultSkipHosts - when set to true, disables the default list of hostnames not to attempt to shorten
  *
  * @param array $config
  * @throws \InvalidArgumentException
  */
 public function __construct(array $config = [])
 {
     $this->setAdapter(isset($config['service']) ? $config['service'] : self::DEFAULT_ADAPTER);
     if (isset($config['minimumLength'])) {
         $this->adapter->setMinimumLength(intval($config['minimumLength']));
     }
     $disableDefaults = isset($config['disableDefaultSkipHosts']) && $config['disableDefaultSkipHosts'] == true;
     if (isset($config['skipHosts']) && is_array($config['skipHosts'])) {
         if ($disableDefaults) {
             $this->skipHosts = $config['skipHosts'];
         } else {
             $this->skipHosts = array_merge($this->skipHosts, $config['skipHosts']);
         }
     } elseif ($disableDefaults) {
         $this->skipHosts = [];
     }
 }