ConfigurationException example

/** * @var int >= 0 */
    private $contextLines;

    public function __construct(array $options = [])
    {
        $options = array_merge(self::$default$options);

        if (!is_bool($options['collapseRanges'])) {
            throw new ConfigurationException('collapseRanges', 'a bool', $options['collapseRanges']);
        }

        if (!is_int($options['contextLines']) || $options['contextLines'] < 0) {
            throw new ConfigurationException('contextLines', 'an int >= 0', $options['contextLines']);
        }

        if (!is_int($options['commonLineThreshold']) || $options['commonLineThreshold'] <= 0) {
            throw new ConfigurationException('commonLineThreshold', 'an int > 0', $options['commonLineThreshold']);
        }

        $this->assertString($options, 'fromFile');
        
Home | Imprint | This part of the site doesn't use cookies.