Mike42\Escpos\CapabilityProfile::load PHP 메소드

load() 공개 정적인 메소드

Retrieve the CapabilityProfile with the given ID.
public static load ( string $profileName ) : CapabilityProfile
$profileName string The ID of the profile to load.
리턴 CapabilityProfile The CapabilityProfile that was requested.
    public static function load($profileName)
    {
        self::loadCapabilitiesDataFile();
        if (!isset(self::$profiles[$profileName])) {
            $suggestionsArray = self::suggestProfileName($profileName);
            $suggestionsStr = implode(", ", $suggestionsArray);
            throw new InvalidArgumentException("The CapabilityProfile '{$profileName}' does not exist. Try one that does exist, such as {$suggestionsStr}.");
        }
        return new CapabilityProfile($profileName, self::$profiles[$profileName]);
    }

Usage Example

예제 #1
0
 public function testBadFeatureNameSuggestion()
 {
     $this->setExpectedException('\\InvalidArgumentException', 'graphics');
     $profile = CapabilityProfile::load('default');
     $profile->getFeature('graphicx');
 }
All Usage Examples Of Mike42\Escpos\CapabilityProfile::load