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-
2822include_once 'phing/system/io/PhingFile.php ' ;
2923include_once 'phing/util/FileUtils.php ' ;
3024include_once 'phing/TaskAdapter.php ' ;
4539 */
4640class 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
0 commit comments