Mike42\Escpos\CapabilityProfile::load PHP Method

load() public static method

Retrieve the CapabilityProfile with the given ID.
public static load ( string $profileName ) : CapabilityProfile
$profileName string The ID of the profile to load.
return 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

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