Eloquent\Phony\Difference\DifferenceSequenceMatcher::chainB PHP Method

chainB() private method

Generate the internal arrays containing the list of junk and non-junk characters for the second ($b) sequence.
private chainB ( )
    private function chainB()
    {
        $length = count($this->b);
        $this->b2j = array();
        $popularDict = array();
        for ($i = 0; $i < $length; ++$i) {
            $char = $this->b[$i];
            if (isset($this->b2j[$char])) {
                if ($length >= 200 && count($this->b2j[$char]) * 100 > $length) {
                    $popularDict[$char] = 1;
                    unset($this->b2j[$char]);
                } else {
                    $this->b2j[$char][] = $i;
                }
            } else {
                $this->b2j[$char] = array($i);
            }
        }
        // Remove leftovers
        foreach (array_keys($popularDict) as $char) {
            unset($this->b2j[$char]);
        }
    }