src/Filter/SimpleFilter.php
public function run(t\TokenRegistry $tokens)
    {
        foreach ($tokens as $token) {
            if (! $token instanceof t\WordToken) {
                continue;
            }
            $string = $token->getFilteredContent();
            $pattern = $token->getMergedPattern($this->options->getQuality());
            $length  = $token->length();
            $lastOne = 0;
            $result = array();

            for ($i = 1; $i <= $length; $i++) {
                $currPattern = mb_substr($pattern, $i, 1);
                if ($i < $this->options->getLeftMin()) {
                    continue;
                }
                if ($i > ($length - $this->options->getRightMin())) {
                    continue;
                }
                if (0 == $currPattern) {
                    continue;
                }
                if (0 === (int) $currPattern % 2) {
                    continue;
                }
                $sylable = mb_substr($string, $lastOne, $i-$lastOne);
                $lastOne = $i;
                $result[] = $sylable;
            }
            $result [] = mb_substr($string, $lastOne);
            $token->setFilteredContent(implode($this->options->getHyphen(), $result));
        }

        return $tokens;
    }
public function run(t\TokenRegistry $tokens)
    {
        foreach ($tokens as $token) {
            if (! $token instanceof t\WordToken) {
                continue;
            }
            $string = $token->getFilteredContent();
            $pattern = $token->getMergedPattern($this->options->getQuality());
            $length  = $token->length();
            $lastOne = 0;
            $result = array();

            for ($i = 1; $i <= $length; $i++) {
                $currPattern = mb_substr($pattern, $i, 1);
                if ($i < $this->options->getLeftMin()) {
                    continue;
                }
                if ($i > ($length - $this->options->getRightMin())) {
                    continue;
                }
                if (0 == $currPattern) {
                    continue;
                }
                if (0 === (int) $currPattern % 2) {
                    continue;
                }
                $sylable = mb_substr($string, $lastOne, $i-$lastOne);
                $lastOne = $i;
                $result[] = $sylable;
            }
            $result [] = mb_substr($string, $lastOne);
            $token->setFilteredContent(implode($this->options->getHyphen(), $result));
        }

        return $tokens;
    }
Implements interface Filter

@param \Org\Heigl\Hyphenator\Tokenizer\TokenRegistry $tokens The registry
to act upon

@see Org\Heigl\Hyphenator\Filter\Filter::run()
@return \Org\Heigl\Hyphenator\Tokenizer\Token