public static function lineMatch(
        array $lines,
        string $prefix,
        string $suffix,
        bool $doTrim,
        bool $removePrefixSuffix = false
    ): array {
        $result = [];
        foreach ($lines as $line) {
            $isHit = true;
            if ($prefix !== '' && $prefix !== null && Str::startsWith(trim($line), $prefix)) {
                if ($removePrefixSuffix) {
                    $line = substr(trim($line), strlen($prefix));
                }
            } else {
                $isHit = false;
            }
            if ($suffix !== '' && $suffix !== null && Str::endsWith(trim($line), $suffix)) {
                if ($removePrefixSuffix) {
                    $line = substr(trim($line), 0, -strlen($suffix));
                }
            } else {
                $isHit = false;
            }
            if ($isHit) {
                if ($doTrim) {
                    $line = trim($line);
                }
                $result[] = $line;
            }
        }
        return $result;
    }
public static function lineMatch(
        array $lines,
        string $prefix,
        string $suffix,
        bool $doTrim,
        bool $removePrefixSuffix = false
    ): array {
        $result = [];
        foreach ($lines as $line) {
            $isHit = true;
            if ($prefix !== '' && $prefix !== null && Str::startsWith(trim($line), $prefix)) {
                if ($removePrefixSuffix) {
                    $line = substr(trim($line), strlen($prefix));
                }
            } else {
                $isHit = false;
            }
            if ($suffix !== '' && $suffix !== null && Str::endsWith(trim($line), $suffix)) {
                if ($removePrefixSuffix) {
                    $line = substr(trim($line), 0, -strlen($suffix));
                }
            } else {
                $isHit = false;
            }
            if ($isHit) {
                if ($doTrim) {
                    $line = trim($line);
                }
                $result[] = $line;
            }
        }
        return $result;
    }
public static function lineMatch ( array $ lines , string $ prefix , string $ suffix , bool $ doTrim , bool $ removePrefixSuffix = false ) : array { $ result = [ ] ; foreach ( $ lines as $ line ) { $ isHit = true ; if ( $ prefix !== '' && $ prefix !== null && Str :: startsWith ( trim ( $ line ) , $ prefix ) ) { if ( $ removePrefixSuffix ) { $ line = substr ( trim ( $ line ) , strlen ( $ prefix ) ) ; } } else { $ isHit = false ; } if ( $ suffix !== '' && $ suffix !== null && Str :: endsWith ( trim ( $ line ) , $ suffix ) ) { if ( $ removePrefixSuffix ) { $ line = substr ( trim ( $ line ) , 0 , - strlen ( $ suffix ) ) ; } } else { $ isHit = false ; } if ( $ isHit ) { if ( $ doTrim ) { $ line = trim ( $ line ) ; } $ result [ ] = $ line ; } } return $ result ; }
Get line match.

@param string[] $lines
@param string $prefix
@param string $suffix
@param bool $doTrim
@param bool $removePrefixSuffix Default false.
@return string[]
Get line match .