Skip to content

Commit f8a534f

Browse files
committed
remove defines in favour of constants
1 parent f0ad909 commit f8a534f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+673
-673
lines changed

.DS_Store

6 KB
Binary file not shown.

lib/vendor/phing/BuildEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class BuildEvent extends EventObject {
7373
* @see $message
7474
* @access private
7575
*/
76-
protected $priority = PROJECT_MSG_VERBOSE;
76+
protected $priority = Project::PROJECT_MSG_VERBOSE;
7777

7878
/**
7979
* The execption that caused the event, if any

lib/vendor/phing/IntrospectionHelper.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ function setAttribute(Project $project, $element, $attributeName, &$value) {
365365
} // if is slot-listener
366366

367367
try {
368-
$project->log(" -calling setter ".$method->getDeclaringClass()->getName()."::".$method->getName()."()", PROJECT_MSG_DEBUG);
368+
$project->log(" -calling setter ".$method->getDeclaringClass()->getName()."::".$method->getName()."()", Project::PROJECT_MSG_DEBUG);
369369
$method->invoke($element, $value);
370370
} catch(Exception $exc) {
371371
throw new BuildException($exc);
@@ -404,7 +404,7 @@ function createElement(Project $project, $element, $elementName) {
404404

405405
$method = $this->nestedCreators[$createMethod];
406406
try { // try to invoke the creator method on object
407-
$project->log(" -calling creator ".$method->getDeclaringClass()->getName()."::".$method->getName()."()", PROJECT_MSG_DEBUG);
407+
$project->log(" -calling creator ".$method->getDeclaringClass()->getName()."::".$method->getName()."()", Project::PROJECT_MSG_DEBUG);
408408
$nestedElement = $method->invoke($element);
409409
} catch (Exception $exc) {
410410
throw new BuildException($exc);
@@ -418,7 +418,7 @@ function createElement(Project $project, $element, $elementName) {
418418

419419
try { // try to invoke the adder method on object
420420

421-
$project->log(" -calling adder ".$method->getDeclaringClass()->getName()."::".$method->getName()."()", PROJECT_MSG_DEBUG);
421+
$project->log(" -calling adder ".$method->getDeclaringClass()->getName()."::".$method->getName()."()", Project::PROJECT_MSG_DEBUG);
422422
// we've already assured that correct num of params
423423
// exist and that method is using class hints
424424
$params = $method->getParameters();
@@ -471,7 +471,7 @@ function storeElement($project, $element, $child, $elementName = null) {
471471
$method = $this->nestedStorers[$storer];
472472

473473
try {
474-
$project->log(" -calling storer ".$method->getDeclaringClass()->getName()."::".$method->getName()."()", PROJECT_MSG_DEBUG);
474+
$project->log(" -calling storer ".$method->getDeclaringClass()->getName()."::".$method->getName()."()", Project::PROJECT_MSG_DEBUG);
475475
$method->invoke($element, $child);
476476
} catch (Exception $exc) {
477477
throw new BuildException($exc);
@@ -551,7 +551,7 @@ function getPropertyName($methodName, $prefix) {
551551
* Prints warning message to screen if -debug was used.
552552
*/
553553
function warn($msg) {
554-
if (Phing::getMsgOutputLevel() === PROJECT_MSG_DEBUG) {
554+
if (Phing::getMsgOutputLevel() === Project::PROJECT_MSG_DEBUG) {
555555
print("[IntrospectionHelper] " . $msg . "\n");
556556
}
557557
}

lib/vendor/phing/Phing.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Phing {
3939
const DEFAULT_BUILD_FILENAME = "build.xml";
4040

4141
/** Our current message output status. Follows PROJECT_MSG_XXX */
42-
private static $msgOutputLevel = PROJECT_MSG_INFO;
42+
private static $msgOutputLevel = Project::PROJECT_MSG_INFO;
4343

4444
/** PhingFile that we are using for configuration */
4545
private $buildFile = null;
@@ -90,7 +90,7 @@ class Phing {
9090
*/
9191
function printMessage(Exception $t) {
9292
print($t->getMessage() . "\n");
93-
if (self::getMsgOutputLevel() === PROJECT_MSG_DEBUG) {
93+
if (self::getMsgOutputLevel() === Project::PROJECT_MSG_DEBUG) {
9494
print($t->getTraceAsString()."\n");
9595
if ($t instanceof Exception) {
9696
$c = $t->getCause();
@@ -188,13 +188,13 @@ public function execute($args) {
188188
$this->printVersion();
189189
return;
190190
} elseif ($arg == "-quiet" || $arg == "-q") {
191-
self::$msgOutputLevel = PROJECT_MSG_WARN;
191+
self::$msgOutputLevel = Project::PROJECT_MSG_WARN;
192192
} elseif ($arg == "-verbose") {
193193
$this->printVersion();
194-
self::$msgOutputLevel = PROJECT_MSG_VERBOSE;
194+
self::$msgOutputLevel = Project::PROJECT_MSG_VERBOSE;
195195
} elseif ($arg == "-debug") {
196196
$this->printVersion();
197-
self::$msgOutputLevel = PROJECT_MSG_DEBUG;
197+
self::$msgOutputLevel = Project::PROJECT_MSG_DEBUG;
198198
} elseif ($arg == "-logfile") {
199199
try { // try to set logfile
200200
if (!isset($args[$i+1])) {
@@ -306,7 +306,7 @@ function _getParentFile(PhingFile $file) {
306306
$file = new PhingFile($filename);
307307
$filename = $file->getParent();
308308

309-
if ($filename !== null && self::$msgOutputLevel >= PROJECT_MSG_VERBOSE) {
309+
if ($filename !== null && self::$msgOutputLevel >= Project::PROJECT_MSG_VERBOSE) {
310310
print("Searching in $filename\n");
311311
}
312312

@@ -328,7 +328,7 @@ function _getParentFile(PhingFile $file) {
328328
* @throws BuildException Failed to locate a build file
329329
*/
330330
function _findBuildFile($start, $suffix) {
331-
if (self::$msgOutputLevel >= PROJECT_MSG_INFO) {
331+
if (self::$msgOutputLevel >= Project::PROJECT_MSG_INFO) {
332332
print("Searching for $suffix ...\n");
333333
}
334334
$startf = new PhingFile($start);
@@ -530,7 +530,7 @@ public static function getCurrentProject() {
530530
* @param string $message
531531
* @param int $priority PROJECT_MSG_INFO, etc.
532532
*/
533-
public static function log($message, $priority = PROJECT_MSG_INFO) {
533+
public static function log($message, $priority = Project::PROJECT_MSG_INFO) {
534534
$p = self::getCurrentProject();
535535
if ($p) {
536536
$p->log($message, $priority);
@@ -560,16 +560,16 @@ public static function handlePhpError($level, $message, $file, $line) {
560560
case E_STRICT:
561561
case E_NOTICE:
562562
case E_USER_NOTICE:
563-
self::log($message, PROJECT_MSG_VERBOSE);
563+
self::log($message, Project::PROJECT_MSG_VERBOSE);
564564
break;
565565
case E_WARNING:
566566
case E_USER_WARNING:
567-
self::log($message, PROJECT_MSG_WARN);
567+
self::log($message, Project::PROJECT_MSG_WARN);
568568
break;
569569
case E_ERROR:
570570
case E_USER_ERROR:
571571
default:
572-
self::log($message, PROJECT_MSG_ERR);
572+
self::log($message, Project::PROJECT_MSG_ERR);
573573

574574
} // switch
575575

@@ -827,7 +827,7 @@ public static function __import($path, $classpath = null) {
827827
$add_parts = explode(PATH_SEPARATOR, $classpath);
828828
$new_parts = array_diff($add_parts, $curr_parts);
829829
if ($new_parts) {
830-
if (self::getMsgOutputLevel() === PROJECT_MSG_DEBUG) {
830+
if (self::getMsgOutputLevel() === Project::PROJECT_MSG_DEBUG) {
831831
print("Phing::import() prepending new include_path components: " . implode(PATH_SEPARATOR, $new_parts) . "\n");
832832
}
833833
ini_set('include_path', implode(PATH_SEPARATOR, array_merge($new_parts, $curr_parts)));
@@ -838,7 +838,7 @@ public static function __import($path, $classpath = null) {
838838

839839
if ($ret === false) {
840840
$e = new BuildException("Error importing $path");
841-
if (self::getMsgOutputLevel() === PROJECT_MSG_DEBUG) {
841+
if (self::getMsgOutputLevel() === Project::PROJECT_MSG_DEBUG) {
842842
// We can't log this because listeners belong
843843
// to projects. We'll just print it -- of course
844844
// that isn't very compatible w/ other frontends (but

lib/vendor/phing/Project.php

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,6 @@
1919
* <http://phing.info>.
2020
*/
2121

22-
define('PROJECT_MSG_DEBUG', 4);
23-
define('PROJECT_MSG_VERBOSE', 3);
24-
define('PROJECT_MSG_INFO', 2);
25-
define('PROJECT_MSG_WARN', 1);
26-
define('PROJECT_MSG_ERR', 0);
27-
2822
include_once 'phing/system/io/PhingFile.php';
2923
include_once 'phing/util/FileUtils.php';
3024
include_once 'phing/TaskAdapter.php';
@@ -45,6 +39,12 @@
4539
*/
4640
class Project {
4741

42+
public const PROJECT_MSG_DEBUG = 4;
43+
public const PROJECT_MSG_VERBOSE = 3;
44+
public const PROJECT_MSG_INFO = 2;
45+
public const PROJECT_MSG_WARN = 1;
46+
public const PROJECT_MSG_ERR = 0;
47+
4848
/** contains the targets */
4949
private $targets = array();
5050
/** global filterset (future use) */
@@ -194,15 +194,15 @@ public function setProperty($name, $value) {
194194

195195
// command line properties take precedence
196196
if (isset($this->userProperties[$name])) {
197-
$this->log("Override ignored for user property " . $name, PROJECT_MSG_VERBOSE);
197+
$this->log("Override ignored for user property " . $name, Project::PROJECT_MSG_VERBOSE);
198198
return;
199199
}
200200

201201
if (isset($this->properties[$name])) {
202-
$this->log("Overriding previous definition of property " . $name, PROJECT_MSG_VERBOSE);
202+
$this->log("Overriding previous definition of property " . $name, Project::PROJECT_MSG_VERBOSE);
203203
}
204204

205-
$this->log("Setting project property: " . $name . " -> " . $value, PROJECT_MSG_DEBUG);
205+
$this->log("Setting project property: " . $name . " -> " . $value, Project::PROJECT_MSG_DEBUG);
206206
$this->properties[$name] = $value;
207207
}
208208

@@ -219,10 +219,10 @@ public function setProperty($name, $value) {
219219
*/
220220
public function setNewProperty($name, $value) {
221221
if (isset($this->properties[$name])) {
222-
$this->log("Override ignored for property " . $name, PROJECT_MSG_DEBUG);
222+
$this->log("Override ignored for property " . $name, Project::PROJECT_MSG_DEBUG);
223223
return;
224224
}
225-
$this->log("Setting project property: " . $name . " -> " . $value, PROJECT_MSG_DEBUG);
225+
$this->log("Setting project property: " . $name . " -> " . $value, Project::PROJECT_MSG_DEBUG);
226226
$this->properties[$name] = $value;
227227
}
228228

@@ -236,7 +236,7 @@ public function setNewProperty($name, $value) {
236236
* @see #setProperty()
237237
*/
238238
public function setUserProperty($name, $value) {
239-
$this->log("Setting ro project property: " . $name . " -> " . $value, PROJECT_MSG_DEBUG);
239+
$this->log("Setting ro project property: " . $name . " -> " . $value, Project::PROJECT_MSG_DEBUG);
240240
$this->userProperties[$name] = $value;
241241
$this->properties[$name] = $value;
242242
}
@@ -268,7 +268,7 @@ public function setInheritedProperty($name, $value) {
268268
*/
269269
private function setPropertyInternal($name, $value) {
270270
if (isset($this->userProperties[$name])) {
271-
$this->log("Override ignored for user property " . $name, PROJECT_MSG_VERBOSE);
271+
$this->log("Override ignored for user property " . $name, Project::PROJECT_MSG_VERBOSE);
272272
return;
273273
}
274274
$this->properties[$name] = $value;
@@ -448,7 +448,7 @@ function setBasedir($dir) {
448448
}
449449
$this->basedir = $dir;
450450
$this->setPropertyInternal("project.basedir", $this->basedir->getAbsolutePath());
451-
$this->log("Project base dir set to: " . $this->basedir->getPath(), PROJECT_MSG_VERBOSE);
451+
$this->log("Project base dir set to: " . $this->basedir->getPath(), Project::PROJECT_MSG_VERBOSE);
452452

453453
// [HL] added this so that ./ files resolve correctly. This may be a mistake ... or may be in wrong place.
454454
chdir($dir->getAbsolutePath());
@@ -506,13 +506,13 @@ function setSystemProperties() {
506506
*/
507507
function addTaskDefinition($name, $class, $classpath = null) {
508508
if ($class === "") {
509-
$this->log("Task $name has no class defined.", PROJECT_MSG_ERR);
509+
$this->log("Task $name has no class defined.", Project::PROJECT_MSG_ERR);
510510
} elseif (!isset($this->taskdefs[$name])) {
511511
Phing::import($class, $classpath);
512512
$this->taskdefs[$name] = $class;
513-
$this->log(" +Task definiton: $name ($class)", PROJECT_MSG_DEBUG);
513+
$this->log(" +Task definiton: $name ($class)", Project::PROJECT_MSG_DEBUG);
514514
} else {
515-
$this->log("Task $name ($class) already registerd, skipping", PROJECT_MSG_VERBOSE);
515+
$this->log("Task $name ($class) already registerd, skipping", Project::PROJECT_MSG_VERBOSE);
516516
}
517517
}
518518

@@ -530,9 +530,9 @@ function addDataTypeDefinition($typeName, $typeClass, $classpath = null) {
530530
if (!isset($this->typedefs[$typeName])) {
531531
Phing::import($typeClass, $classpath);
532532
$this->typedefs[$typeName] = $typeClass;
533-
$this->log(" +User datatype: $typeName ($typeClass)", PROJECT_MSG_DEBUG);
533+
$this->log(" +User datatype: $typeName ($typeClass)", Project::PROJECT_MSG_DEBUG);
534534
} else {
535-
$this->log("Type $name ($class) already registerd, skipping", PROJECT_MSG_VERBOSE);
535+
$this->log("Type $name ($class) already registerd, skipping", Project::PROJECT_MSG_VERBOSE);
536536
}
537537
}
538538

@@ -549,7 +549,7 @@ function addTarget($targetName, &$target) {
549549
}
550550

551551
function addOrReplaceTarget($targetName, &$target) {
552-
$this->log(" +Target: $targetName", PROJECT_MSG_DEBUG);
552+
$this->log(" +Target: $targetName", Project::PROJECT_MSG_DEBUG);
553553
$target->setProject($this);
554554
$this->targets[$targetName] = $target;
555555
}
@@ -600,7 +600,7 @@ function createTask($taskType) {
600600
if ($o instanceof Task) {
601601
$task = $o;
602602
} else {
603-
$this->log (" (Using TaskAdapter for: $taskType)", PROJECT_MSG_DEBUG);
603+
$this->log (" (Using TaskAdapter for: $taskType)", Project::PROJECT_MSG_DEBUG);
604604
// not a real task, try adapter
605605
$taskA = new TaskAdapter();
606606
$taskA->setProxy($o);
@@ -610,7 +610,7 @@ function createTask($taskType) {
610610
$task->setTaskType($taskType);
611611
// set default value, can be changed by the user
612612
$task->setTaskName($taskType);
613-
$this->log (" +Task: " . $taskType, PROJECT_MSG_DEBUG);
613+
$this->log (" +Task: " . $taskType, Project::PROJECT_MSG_DEBUG);
614614
} catch (Exception $t) {
615615
throw new BuildException("Could not create task of type: " . $taskType, $t);
616616
}
@@ -648,7 +648,7 @@ function createDataType($typeName) {
648648
}
649649

650650
$type = new $cls();
651-
$this->log(" +Type: $typeName", PROJECT_MSG_DEBUG);
651+
$this->log(" +Type: $typeName", Project::PROJECT_MSG_DEBUG);
652652
if (!($type instanceof DataType)) {
653653
throw new Exception("$class is not an instance of phing.types.DataType");
654654
}
@@ -700,7 +700,7 @@ function executeTarget($targetName) {
700700
$curTarget = $sortedTargets[$curIndex++];
701701
$curTarget->performTasks();
702702
} catch (BuildException $exc) {
703-
$this->log("Execution of target \"".$curTarget->getName()."\" failed for the following reason: ".$exc->getMessage(), PROJECT_MSG_ERR);
703+
$this->log("Execution of target \"".$curTarget->getName()."\" failed for the following reason: ".$exc->getMessage(), Project::PROJECT_MSG_ERR);
704704
throw $exc;
705705
}
706706
} while ($curTarget->getName() !== $targetName);
@@ -745,7 +745,7 @@ function _topoSort($root, &$targets) {
745745
for ($i=0, $_i=count($ret); $i < $_i; $i++) {
746746
$retHuman .= $ret[$i]->toString()." ";
747747
}
748-
$this->log("Build sequence for target '$root' is: $retHuman", PROJECT_MSG_VERBOSE);
748+
$this->log("Build sequence for target '$root' is: $retHuman", Project::PROJECT_MSG_VERBOSE);
749749

750750
$keys = array_keys($targets);
751751
while($keys) {
@@ -767,7 +767,7 @@ function _topoSort($root, &$targets) {
767767
for ($i=0,$_i=count($ret); $i < $_i; $i++) {
768768
$retHuman .= $ret[$i]->toString()." ";
769769
}
770-
$this->log("Complete build sequence is: $retHuman", PROJECT_MSG_VERBOSE);
770+
$this->log("Complete build sequence is: $retHuman", Project::PROJECT_MSG_VERBOSE);
771771

772772
return $ret;
773773
}
@@ -852,9 +852,9 @@ function _makeCircularException($end, $stk) {
852852
*/
853853
function addReference($name, $object) {
854854
if (isset($this->references[$name])) {
855-
$this->log("Overriding previous definition of reference to $name", PROJECT_MSG_WARN);
855+
$this->log("Overriding previous definition of reference to $name", Project::PROJECT_MSG_WARN);
856856
}
857-
$this->log("Adding reference: $name -> ".get_class($object), PROJECT_MSG_DEBUG);
857+
$this->log("Adding reference: $name -> ".get_class($object), Project::PROJECT_MSG_DEBUG);
858858
$this->references[$name] = $object;
859859
}
860860

@@ -882,7 +882,7 @@ function getReference($key)
882882
/**
883883
* Abstracting and simplifyling Logger calls for project messages
884884
*/
885-
function log($msg, $level = PROJECT_MSG_INFO) {
885+
function log($msg, $level = Project::PROJECT_MSG_INFO) {
886886
$this->logObject($this, $msg, $level);
887887
}
888888

lib/vendor/phing/ProjectComponent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
* the project components
2525
*
2626
* @author Andreas Aderhold <[email protected]>
27-
* @author Hans Lellelid <[email protected]>
27+
* @author Hans Lellelid <[email protected]>
2828
* @version $Revision: 1.5 $
2929
* @package phing
3030
*/
@@ -64,7 +64,7 @@ function getProject() {
6464
* @param string The message to be logged.
6565
* @param integer The message's priority at this message should have
6666
*/
67-
public function log($msg, $level = PROJECT_MSG_INFO) {
67+
public function log($msg, $level = Project::PROJECT_MSG_INFO) {
6868
if ($this->project !== null) {
6969
$this->project->log($msg, $level);
7070
}

0 commit comments

Comments
 (0)