Webmozart\Console\Api\Config\OptionCommandConfig::isLongNamePreferred PHP Method

isLongNamePreferred() public method

If no preference was set, the short name is preferred by default if one is set. If no short name is set, the long name is preferred by default.
public isLongNamePreferred ( ) : boolean
return boolean Returns `true` if the long name should be preferred over the short name.
    public function isLongNamePreferred()
    {
        if (null === $this->longNamePreferred) {
            // If no preference is set, prefer the short name (if one is set)
            return null === $this->shortName;
        }
        return $this->longNamePreferred;
    }

Usage Example

 public function testSetShortNameToNullSetsLongNameToBePreferred()
 {
     $this->config->setShortName('d');
     $this->config->setPreferShortName();
     $this->config->setShortName(null);
     $this->assertTrue($this->config->isLongNamePreferred());
     $this->assertFalse($this->config->isShortNamePreferred());
 }