getFirstAvailable() public static method

Tests an array of feature identifiers, stopping and returnig the first that tests true.
public static getFirstAvailable ( array $featureIDs = [] ) : string
$featureIDs array Array of feature ID strings. If associative, the value is the ID, and the key is returned.
return string Returns the first feature ID that tests true.
示例#1
0
文件: MorseTest.php 项目: drewm/morse
 public function testGetFirstAvailable()
 {
     $this->assertEquals(Morse::getFirstAvailable(array('image/fake-negative', 'image/fake-negative', 'image/fake-positive')), 'fake-positive');
     $this->assertEquals(Morse::getFirstAvailable(array('db/fake-positive', 'db/fake-negative')), 'fake-positive');
     $this->assertSame(Morse::getFirstAvailable(array('text/fake-negative')), null);
 }