WhichBrowser\Model\Os::toString PHP Method

toString() public method

Get the name and version in a human readable format
public toString ( ) : string
return string
    public function toString()
    {
        if ($this->hidden) {
            return '';
        }
        return trim($this->getName() . (!empty($this->version) && !$this->version->hidden ? ' ' . $this->getVersion() : '')) . (!empty($this->edition) ? ' ' . $this->edition : '');
    }

Usage Example

Exemplo n.º 1
0
 public function testToString()
 {
     $os = new Os();
     $this->assertEquals('', $os->toString());
     $os->reset(['name' => 'iOS', 'version' => new Version(['value' => '8.0'])]);
     $this->assertEquals('iOS 8.0', $os->toString());
     $os->reset(['name' => 'iOS', 'alias' => 'iPhone OS', 'version' => new Version(['value' => '3.0'])]);
     $this->assertEquals('iPhone OS 3.0', $os->toString());
     $os->reset(['name' => 'OS X', 'version' => new Version(['value' => '10.11', 'nickname' => 'El Capitan'])]);
     $this->assertEquals('OS X El Capitan 10.11', $os->toString());
     $os->reset(['name' => 'Windows', 'version' => new Version(['value' => '5.1', 'alias' => 'XP'])]);
     $this->assertEquals('Windows XP', $os->toString());
 }
All Usage Examples Of WhichBrowser\Model\Os::toString