Craft\MinimeeTwigExtension::pregMatchAssetsByType PHP Method

pregMatchAssetsByType() protected method

Returns array of links found.
protected pregMatchAssetsByType ( $type, $haystack ) : boolean | array
return boolean | array Array of found matches, or false if none
    protected function pregMatchAssetsByType($type, $haystack)
    {
        switch (strtolower($type)) {
            case MinimeeType::Css:
                $pat = "/<link{1}.*?href=['|\"]{1}(.*?)['|\"]{1}[^>]*>/is";
                break;
            case MinimeeType::Js:
                $pat = "/<script{1}.*?src=['|\"]{1}(.*?)['|\"]{1}[^>]*>(.*?)<\\/script>/is";
                break;
            default:
                return FALSE;
        }
        if (!preg_match_all($pat, $haystack, $matches, PREG_PATTERN_ORDER)) {
            return FALSE;
        }
        return $matches[1];
    }