-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathformat.php
More file actions
25 lines (21 loc) · 746 Bytes
/
format.php
File metadata and controls
25 lines (21 loc) · 746 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
function rglob($pattern, $flags = 0) {
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern).'/*', GLOB_ONLYDIR|GLOB_NOSORT) as $dir) {
$files = array_merge($files, rglob($dir.'/'.basename($pattern), $flags));
}
return $files;
}
function startsWith($haystack, $needle) {
return $needle === "" || strrpos($haystack, $needle, -strlen($haystack)) !== false;
}
function endsWith($haystack, $needle) {
return $needle === "" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !== false);
}
exec('git status', $status);
foreach($status as $line){
$e = explode(': ', $line);
if(isset($e[1]) && startsWith($e[1], "src/")){
system("tsfmt -r ".$e[1]);
}
}