-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug #3, PHP script to modify
phpcs.xml
[iet:3791672]
* Dynamically modify PHP_CodeSniffer configuration XML
- Loading branch information
Showing
3 changed files
with
41 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env php | ||
<?php | ||
/** | ||
* Dynamically modify 'phpcs.xml' CodeSniffer configurations, based on conditional comments. | ||
* | ||
* Usage: dyn-phpcs-xml --no-ns vendor/iet-ou/open-media-player-core/phpcs.xml > phpcs-1.xml | ||
* | ||
* @copyright Copyright 2015 The Open University. | ||
* @author N.D.Freear, 22 July 2015. | ||
*/ | ||
|
||
fprintf(STDERR, "dyn-php-xml\n"); | ||
|
||
if ($argc < 3) { | ||
fprintf(STDERR, "Error, insufficient arguments.\n"); | ||
exit(1); | ||
} | ||
|
||
$filename = $argv[ $argc - 1 ]; | ||
|
||
$xml = file_get_contents($filename); | ||
|
||
$xml = preg_replace('@<!--\[if DYN:NO-NS\]>(?P<dyn>[^\[]+)<!\[endif\]-->@msi', '$1', $xml); | ||
//$xml = preg_replace('@<!--\{DYN:NO-NS\}(?P<dyn>[^\{]+)\{\/DYN:NO-NS\}-->@i', '$1', $xml); | ||
|
||
echo $xml; | ||
|
||
|
||
//End. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters