PHP code example of timoschinkel / codeowners
1. Go to this page and download the library: Download timoschinkel/codeowners library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
timoschinkel / codeowners example snippets
use CodeOwners\Parser;
use CodeOwners\PatternMatcher;
try {
$patterns = (new Parser())->parseFile($filename);
$pattern = (new PatternMatcher(...$patterns))->match($filename);
} catch (\CodeOwners\Exception\UnableToParseException $exception) {
// unable to read or parse file
} catch (\CodeOwners\Exception\NoMatchFoundException $exception) {
// no match found
}
use CodeOwners\Parser;
use CodeOwners\PatternMatcher;
try {
$patterns = (new Parser())->parseString($contents);
$pattern = (new PatternMatcher(...$patterns))->match($filename);
} catch (\CodeOwners\Exception\UnableToParseException $exception) {
// unable to read or parse file
} catch (\CodeOwners\Exception\NoMatchFoundException $exception) {
// no match found
}