Answer the question
In order to leave comments, you need to log in
Phing and source code pre-processing
Interested in the issue of preprocessing the source code of the project using phing.
What does it mean
There is a source code of the form:
protected function _doImportant() {
#ifdef DEBUG
$this->log("doing important stuff now");
#endif
foreach ($this->import as $moreimportant) {
#ifdef DEBUG
$this->log("as I said, important or $moreimportant");
#endif
}
#ifdef DEBUG
$this->log("finished doing ach so important thing");
#endif
}
protected function _doImportant() {
$this->log("doing important stuff now");
foreach ($this->import as $moreimportant) {
$this->log("as I said, important or $moreimportant");
}
$this->log("finished doing ach so important thing");
}
protected function _doImportant() {
foreach ($this->import as $moreimportant) {
}
}
Answer the question
In order to leave comments, you need to log in
Try using Replace Regexp for this. The task allows you to implement search/replace using regular expressions. Or switch to Ant, there is a preprocessing class for it.
1) What is your question? Habr is not Google :)
2) Isn't it easier to use something like this instead of preprocessing:
const DEBUG = TRUE;
protected function _doImportant() {
if (self::DEBUG) {
$this->log("doing important stuff now");
}
foreach ($this->import as $moreimportant) {
if (self::DEBUG) {
$this->log("as I said, important or $moreimportant");
}
}
if (self::DEBUG) {
$this->log("finished doing ach so important thing");
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question