-
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.
- Loading branch information
heartsentwined
committed
Sep 17, 2012
1 parent
db6983e
commit 1680c23
Showing
2 changed files
with
78 additions
and
0 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
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,64 @@ | ||
<?php | ||
require_once __DIR__ . '/../../../../autoload.php'; | ||
|
||
use Zend\File\ClassFileLocator; | ||
|
||
class ClassmapClearTask extends Task | ||
{ | ||
protected $file; | ||
protected $failonerror = false; | ||
|
||
/** | ||
* classmap file | ||
* | ||
* @param string $file | ||
* @return void | ||
*/ | ||
public function setFile($file) | ||
{ | ||
touch($file); | ||
$this->file = realpath($file); | ||
} | ||
|
||
/** | ||
* if error occured, whether build should fail | ||
* | ||
* @param bool $value | ||
* @return void | ||
*/ | ||
public function setFailonerror($value) | ||
{ | ||
$this->failonerror = $value; | ||
} | ||
|
||
/** | ||
* init | ||
* | ||
* @return void | ||
*/ | ||
public function init() | ||
{ | ||
} | ||
|
||
/** | ||
* main method | ||
* | ||
* @return void | ||
*/ | ||
public function main() | ||
{ | ||
$this->log(sprintf('Clearing classmap file %s', $this->file)); | ||
|
||
// Create a file with the class/file map. | ||
// Stupid syntax highlighters make separating < from PHP declaration necessary | ||
$content = '<' . "?php\n" | ||
. "// Auto-generated by Phing, using ZF2's classmap generator\n" | ||
. '// Generation time: ' . date(DATE_RFC2822) . "\n" | ||
. 'return array();'; | ||
|
||
// Write the contents to disk | ||
file_put_contents($this->file, $content); | ||
|
||
$this->log(sprintf('Cleared classmap file at %s', $this->file)); | ||
} | ||
} |