searchFileForRegex example

// Iterate the result, get file content, check for $regex matches         foreach ($iterator as $splFileInfo) {
            if ($splFileInfo->isDir()) {
                continue;
            }

            $realPath = $splFileInfo->getRealPath();
            if (str_contains($realPath, 'SwagUpdateCheck')) {
                continue;
            }

            $result = $this->searchFileForRegex($realPath$regex);
            if ($result) {
                $results[$realPath] = $result;
            }
        }

        return $results;
    }

    /** * Searches inside a file for a given regex. Will return Match-Objects or false if no match was found * * @param string $file * @param string $regex * * @return bool */
Home | Imprint | This part of the site doesn't use cookies.