protected function getSearchAndReplace(array $matches, array $data)
    {
        $count = count($matches);
        $alreadySetted = [];
        $search = [];
        $replace = [];

        for ($i = 0, $m = 0; $i < $count; ++$i) {
            if (isset($alreadySetted[$matches[$i]])) {
                continue;
            }

            $value = $this->extractValue($matches[$i], $data);

            if ($value === null) {
                continue;
            }

            $search[$m] = $matches[$i];
            $replace[$m] = $value;
            $alreadySetted[$matches[$i]] = true;
            ++$m;
        }

        return [$search, $replace];
    }
protected function getSearchAndReplace(array $matches, array $data)
    {
        $count = count($matches);
        $alreadySetted = [];
        $search = [];
        $replace = [];

        for ($i = 0, $m = 0; $i < $count; ++$i) {
            if (isset($alreadySetted[$matches[$i]])) {
                continue;
            }

            $value = $this->extractValue($matches[$i], $data);

            if ($value === null) {
                continue;
            }

            $search[$m] = $matches[$i];
            $replace[$m] = $value;
            $alreadySetted[$matches[$i]] = true;
            ++$m;
        }

        return [$search, $replace];
    }
protected function getSearchAndReplace ( array $ matches , array $ data ) { $ count = count ( $ matches ) ; $ alreadySetted = [ ] ; $ search = [ ] ; $ replace = [ ] ; for ( $ i = 0 , $ m = 0 ; $ i < $ count ; ++ $ i ) { if ( isset ( $ alreadySetted [ $ matches [ $ i ] ] ) ) { continue ; } $ value = $ this -> extractValue ( $ matches [ $ i ] , $ data ) ; if ( $ value === null ) { continue ; } $ search [ $ m ] = $ matches [ $ i ] ; $ replace [ $ m ] = $ value ; $ alreadySetted [ $ matches [ $ i ] ] = true ; ++ $ m ; } return [ $ search , $ replace ] ; }
Get two arrays suitable for str_replace to replace all variables.

@param array $matches
@param array $data

@return array
Get two arrays suitable for str_replace to replace all variables .