Filter function to access internal integer font values

@return int
177330
private function getInternalFont()
    {
        $internalfont = $this->file ?? 1;
        $internalfont = (int) $internalfont;

        if (!in_array($internalfont, [1, 2, 3, 4, 5], true)) {
            throw new \Hail\Image\Exception\NotSupportedException(
                sprintf('Internal GD font (%s) not available. Use only 1-5.', $internalfont)
            );
        }

        return $internalfont;
    }
811589
private function readFont()
    {
        $length = self::getInt2d($this->data, $this->pos + 2);
        $recordData = $this->readRecordData($this->data, $this->pos + 4, $length);

        // move stream pointer to next record
        $this->pos += 4 + $length;

        if (!$this->readDataOnly) {
            $objFont = new PHPExcel_Style_Font();

            // offset: 0; size: 2; height of the font (in twips = 1/20 of a point)
            $size = self::getInt2d($recordData, 0);
            $objFont->setSize($size / 20);

            // offset: 2; size: 2; option flags
            // bit: 0; mask 0x0001; bold (redundant in BIFF5-BIFF8)
            // bit: 1; mask 0x0002; italic
            $isItalic = (0x0002 & self::getInt2d($recordData, 2)) >> 1;
            if ($isItalic) {
                $objFont->setItalic(true);
            }

            // bit: 2; mask 0x0004; underlined (redundant in BIFF5-BIFF8)
            // bit: 3; mask 0x0008; strike
            $isStrike = (0x0008 & self::getInt2d($recordData, 2)) >> 3;
            if ($isStrike) {
                $objFont->setStrikethrough(true);
            }

            // offset: 4; size: 2; colour index
            $colorIndex = self::getInt2d($recordData, 4);
            $objFont->colorIndex = $colorIndex;

            // offset: 6; size: 2; font weight
            $weight = self::getInt2d($recordData, 6);
            switch ($weight) {
                case 0x02BC:
                    $objFont->setBold(true);
                    break;
            }

            // offset: 8; size: 2; escapement type
            $escapement = self::getInt2d($recordData, 8);
            switch ($escapement) {
                case 0x0001:
                    $objFont->setSuperScript(true);
                    break;
                case 0x0002:
                    $objFont->setSubScript(true);
                    break;
            }

            // offset: 10; size: 1; underline type
            $underlineType = ord($recordData{10});
            switch ($underlineType) {
                case 0x00:
                    break; // no underline
                case 0x01:
                    $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
                    break;
                case 0x02:
                    $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
                    break;
                case 0x21:
                    $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING);
                    break;
                case 0x22:
                    $objFont->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING);
                    break;
            }

            // offset: 11; size: 1; font family
            // offset: 12; size: 1; character set
            // offset: 13; size: 1; not used
            // offset: 14; size: var; font name
            if ($this->version == self::XLS_BIFF8) {
                $string = self::readUnicodeStringShort(substr($recordData, 14));
            } else {
                $string = $this->readByteStringShort(substr($recordData, 14));
            }
            $objFont->setName($string['value']);

            $this->objFonts[] = $objFont;
        }
    }
154335
public function writeFont()
	{
		$font_outline = 0;
		$font_shadow = 0;

		$icv = $this->_colorIndex; // Index to color palette
		if ($this->_font->getSuperScript()) {
			$sss = 1;
		} else if ($this->_font->getSubScript()) {
			$sss = 2;
		} else {
			$sss = 0;
		}
		$bFamily = 0; // Font family
		$bCharSet = PHPExcel_Shared_Font::getCharsetFromFontName($this->_font->getName()); // Character set

		$record = 0x31;		// Record identifier
		$reserved = 0x00;	// Reserved
		$grbit = 0x00;		// Font attributes
		if ($this->_font->getItalic()) {
			$grbit |= 0x02;
		}
		if ($this->_font->getStrikethrough()) {
			$grbit |= 0x08;
		}
		if ($font_outline) {
			$grbit |= 0x10;
		}
		if ($font_shadow) {
			$grbit |= 0x20;
		}

		$data = pack("vvvvvCCCC",
			$this->_font->getSize() * 20,						//	Fontsize (in twips)
			$grbit,
			$icv,												//	Colour
			self::_mapBold($this->_font->getBold()),			//	Font weight
			$sss,												//	Superscript/Subscript
			self::_mapUnderline($this->_font->getUnderline()),
			$bFamily,
			$bCharSet,
			$reserved
		);
		$data .= PHPExcel_Shared_String::UTF8toBIFF8UnicodeShort($this->_font->getName());

		$length = strlen($data);
		$header = pack("vv", $record, $length);

		return($header . $data);
	}
972416
private function number()
    {
        // If next token is a float match and return it
        if ($this->lexer->isNextToken(Lexer::T_FLOAT)) {
            return $this->match(Lexer::T_FLOAT);
        }

        // If next token is an integer match and return it
        if ($this->lexer->isNextToken(Lexer::T_INTEGER)) {
            return $this->match(Lexer::T_INTEGER);
        }

        // Throw exception since no match
        throw $this->syntaxError('CrEOF\Geo\String\Lexer::T_INTEGER or CrEOF\Geo\String\Lexer::T_FLOAT');
    }
1250653
protected function getNumberType()
    {
        $scale = $this->getScale();
        if ($scale === 0) {
            return PHP_INT_SIZE > 4
                ? NumberFormatter::TYPE_INT64
                : NumberFormatter::TYPE_INT32;
        }
        return NumberFormatter::TYPE_DOUBLE;
    }
135632
public function getFldTypeForPhp()
    {
        $type = 'mixed';
        switch ($this->getFldType()) {
            case FFCST::TYPE_INTEGER:
            case FFCST::TYPE_BIGINT:
                $type = 'int';
                break;
            case FFCST::TYPE_DATETIME:
            case FFCST::TYPE_MD5:
            case FFCST::TYPE_STRING:
                $type = 'string';
                break;
            case FFCST::TYPE_BOOLEAN:
                $type = 'bool';
                break;
        }
        return $type;
    }
1189816
public function filter(int $value) : string
    {
        if ($value < 0) {
            throw new Exception(sprintf('Invalid integer: %d', $value), Exception::INVALID_INTEGER);
        }

        $tokens = $this->getGrammar()->getTokens();
        $values = array_reverse($this->getGrammar()->getValuesWithModifiers(), true /* preserve keys */);
        $result = '';

        if ($value === 0) {
            $dataset = $values[0];

            foreach ($dataset as $token) {
                $result = $result . $tokens[$token];
            }

            return $result;
        }

        foreach ($values as $current => $dataset) {
            while ($current > 0 && $value >= $current) {
                $value = $value - $current;
                foreach ($dataset as $token) {
                    $result = $result . $tokens[$token];
                }
            }
        }

        return $result;
    }
467217
public static function filter($attrValue)
	{
		if (preg_match('/^(?=\\d)(?:(\\d+)h)?(?:(\\d+)m)?(?:(\\d+)s)?$/D', $attrValue, $m))
		{
			$m += [0, 0, 0, 0];

			return intval($m[1]) * 3600 + intval($m[2]) * 60 + intval($m[3]);
		}

		return NumericFilter::filterUint($attrValue);
	}
407307
public function filter($value)
    {
        $chars = ' ';
        if ($this->getExtras()) {
            $chars .= $this->getExtras();
        }
        return trim($value, $chars);
    }
746907
public function readIntLen()
    {
        $f = $this->readInt1();
        if ($f <= 250) {
            return $f;
        }
        if ($f === 251) {
            return null;
        }
        if ($f === 252) {
            return $this->readInt2();
        }
        if ($f === 253) {
            return $this->readInt3();
        }

        return $this->readInt8();
    }
169446
public function getCheckDigits()
    {
        $checkDigits = '';
        $iban = $this->getIban();
        if (!empty($iban)) {
            $checkDigits = substr($iban, 2, 2);
        }
        return $checkDigits;
    }
1202835
function getInteger(): \Closure {
    return function($value, \Mustache_LambdaHelper $helper) {
      $args = $this->parseArguments($helper->render($value), 'value', [
        'options' => [],
        'textOptions' => []
      ]);

      return HtmlHelper::encode(\Yii::$app->formatter->asInteger(
        $args['value'],
        $args['options'],
        $args['textOptions']
      ));
    };
  }
500792
public function getIntegerPart()
	{
		if ( ! $this->getIsDecimal() ) return $this->_value;
		return substr( $this->_value, 0, strpos( $this->_value, "." ) );
	}
777857
public function getInputFilterSpecification()
    {
        $spec = array();
        foreach ($this->getElements() as $element) {
            $name = (string) $element->getName();
            $spec[$name] = array(
                'name' => $name,
            );
        }
        return $spec;
    }
29062
public function getFilters() {
            return array( // Numbers
                'num_format'  => new \Twig_Filter_Function('num::format'),
                // Text
                'limit_words' => new \Twig_Filter_Function('Text::limit_words'),
                'limit_chars' => new \Twig_Filter_Function('Text::limit_chars'),
                'auto_link'   => new \Twig_Filter_Function('Text::auto_link'),
                'auto_p'      => new \Twig_Filter_Function('Text::auto_p'),
                'bytes'       => new \Twig_Filter_Function('Text::bytes'),
                'lower'       => new \Twig_Filter_Function('mb_strtolower'),
                'upper'       => new \Twig_Filter_Function('mb_strtoupper'),
                'ucfirst'     => new \Twig_Filter_Function('ucfirst'),
                'ucwords'     => new \Twig_Filter_Function('ucwords'),
                'strip_tags'  => new \Twig_Filter_Function('strip_tags'),
                'trim'        => new \Twig_Filter_Function('trim'),
                'int'         => new \Twig_Filter_Function('intval'),
                'xss_clean'   => new \Twig_Filter_Function('Security::xss_clean'),
                'urlencode'   => new \Twig_Filter_Function('urlencode'),
                'highlight'   => new \Twig_Filter_Function('\Meerkat\Twig\Twig_Extension::f_highlight'),
            );
        }
451049
public function filter($value) {

        $testvalue = $this->options["insensitive"] ? strtolower($value): $value;

        // Value is not in enumeration
        if (!in_array($testvalue, $this->enumeration, $this->options["strict"]))
            return Filter::ERR_INVALID;

        $found = array_search($value, $this->enumeration, $this->options["strict"]);

        return $this->options["values"][$found];
    }
952971
def int_filter(text):
    
    res = list()
    for char in text:
        if char.isdigit():
            res.append(char)
    return int("".join(res))