@param int $default

@return BoolOperator
553982
protected function getBoolOperator(int $default = BoolOperator::OPTIONAL): BoolOperator
    {
        if ($this->stream->nextIf(Token::T_REQUIRED)
            || $this->stream->lookaheadTypeIs(Token::T_AND)
            || $this->stream->prevTypeIs(Token::T_AND)
        ) {
            return BoolOperator::REQUIRED();
        }

        if ($this->stream->nextIf(Token::T_PROHIBITED)) {
            return BoolOperator::PROHIBITED();
        }

        return BoolOperator::create($default);
    }
325754
public static function from($default) : IType
    {
        switch (gettype($default)) {
            case 'NULL':
                return self::null();
            case 'string':
                return self::string();
            case 'integer':
                return self::int();
            case 'double':
                return self::float();
            case 'boolean':
                return self::bool();
            case 'array':
                if (count($default) < 20) {
                    $types = [];
                    foreach ($default as $value) {
                        $types[] = self::from($value);
                    }
                } else {
                    $types = null;
                }

                return self::arrayOf($types ? UnionType::create($types) : self::mixed());
            case 'object':
                if ($default instanceof ITypedCollection) {
                    return self::collectionOf($default->getElementType(), get_class($default));
                } else {
                    return self::object(get_class($default));
                }
        }

        throw InvalidArgumentException::format(
                'Unknown type: %s', Debug::getType($default)
        );
    }
1145524
public function getAsBool($key, $default = 0)
    {
        $value = $this->get($key, $default);
        if ($value === 'false') return false;

        return (bool) $value;
    }
1008315
public function getInt(string $key, int $default = null) : int
    {
        return (int) $this->get($key, $default);
    }
1089581
public function value($feature, $default = null)
    {
        foreach ($this->subscription->plan->features as $key => $value) {
            if ($feature === $value->code) {
                return $value->value;
            }
        }

        return $default;
    }
1058813
public function first($default = NULL)
    {
        $first = $this->shift();
        if (! $first) {
            $first = $default;
        } else {
            $this->unshift($first);
        }
        return $first;
    }
144545
public function setting($setting, $default = null)
    {
        $value = parent::setting($setting);
        if (null === $value) {
            $value = isset(static::$globalSettings[$setting]) ? static::$globalSettings[$setting] : $default;
        }

        return $value;
    }
903830
public function get($index, $default = null)
	{
		if ($this->hasByIndex($index))
		{
			return $this->store[$index];
		}

		if ($default instanceof \Closure)
		{
			return $default($this);
		}

		return $default;
	}
1169378
public function default($key, $default = null)
	{
		if($this->has($key))
			return $this->get($key);

		$this->put($key, $default);

		return $default;
	}
533056
public function reset($default = true)
    {
        foreach($this->_data as $state) {
            $this->set($state->name, $default ? $state->default : null);
        }

        return $this;
    }
169358
public function getOrDefault(string $id, $default = null)
    {
        $this->freeze();

        if (!$this->has($id)) {
            return $default;
        }

        return $this->get($id);
    }
1369989
public function ltiParameter($varname, $default=false) {
        $row = $this->session_get('lti', false);
        if ( ! $row ) return $default;
        if ( ! array_key_exists($varname, $row) ) return $default;
        return $row[$varname];
    }
726267
public function createSearch($default = false)
	{
		if( $default === true )
		{
			$object = $this->_createSearch( 'media' );
			$langid = $this->_getContext()->getLocale()->getLanguageId();

			if( $langid !== null )
			{
				$temp = array(
					$object->compare( '==', 'media.languageid', $langid ),
					$object->compare( '==', 'media.languageid', null ),
				);

				$expr = array(
					$object->getConditions(),
					$object->combine( '||', $temp ),
				);

				$object->setConditions( $object->combine( '&&', $expr ) );
			}

			return $object;
		}

		return parent::createSearch();
	}
882162
public function createSearch( $default = false )
	{
		if( $default === true )
		{
			$object = $this->_createSearch( 'price' );
			$currencyid = $this->_getContext()->getLocale()->getCurrencyId();

			if( $currencyid !== null )
			{
				$expr = array(
					$object->compare( '==', 'price.currencyid', $currencyid ),
					$object->getConditions(),
				);

				$object->setConditions( $object->combine( '&&', $expr ) );
			}

			return $object;
		}

		return parent::createSearch();
	}
1231194
protected function createProviderNode($default = null)
    {
        $builder = new TreeBuilder();
        $node = $builder->root('provider', 'scalar');

        if ($default) {
            $node->defaultValue($default);
        }

        $node
            ->cannotBeEmpty()
            ->info('Name of model provider')
            ->end()
        ;

        return $node;
    }
576759
public function createSearch( $default = false )
	{
		if( $default === true )
		{
			$curDate = date( 'Y-m-d H:i:00', time() );
			$object = $this->_createSearch( 'product' );

			$expr = array( $object->getConditions() );

			$temp = array(
				$object->compare( '==', 'product.datestart', null ),
				$object->compare( '<=', 'product.datestart', $curDate ),
			);
			$expr[] = $object->combine( '||', $temp );

			$temp = array(
				$object->compare( '==', 'product.dateend', null ),
				$object->compare( '>=', 'product.dateend', $curDate ),
			);
			$expr[] = $object->combine( '||', $temp );

			$object->setConditions( $object->combine( '&&', $expr ) );

			return $object;
		}

		return parent::createSearch();
	}
1024682
public function autoVar($default = null)
    {
        $backtrace = debug_backtrace();
        $name = '';
        if (isset($backtrace[1]['class'])) {
            $name = $backtrace[1]['class'] . '::';
        }
        $name .= $backtrace[1]['function'];
        $name .= '(' . $backtrace[1]['line'] . ')';
        $var = new DocumentVar($this, $name);
        if (isset($default)) {
            $var->setDefault($default);
        }
        return $var;
    }