sfCommandApplicationTask.class.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /*
  3. * This file is part of the symfony package.
  4. * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
  5. *
  6. * For the full copyright and license information, please view the LICENSE
  7. * file that was distributed with this source code.
  8. */
  9. /**
  10. * Base class for tasks that depends on a sfCommandApplication object.
  11. *
  12. * @package symfony
  13. * @subpackage task
  14. * @author Fabien Potencier <fabien.potencier@symfony-project.com>
  15. * @version SVN: $Id: sfCommandApplicationTask.class.php 9652 2008-06-18 21:38:48Z nicolas $
  16. */
  17. abstract class sfCommandApplicationTask extends sfTask
  18. {
  19. protected
  20. $commandApplication = null;
  21. public function setCommandApplication(sfCommandApplication $commandApplication = null)
  22. {
  23. $this->commandApplication = $commandApplication;
  24. }
  25. /**
  26. * @see sfTask
  27. */
  28. public function log($messages)
  29. {
  30. if (is_null($this->commandApplication) || $this->commandApplication->isVerbose())
  31. {
  32. parent::log($messages);
  33. }
  34. }
  35. /**
  36. * @see sfTask
  37. */
  38. public function logSection($section, $message, $size = null, $style = 'INFO')
  39. {
  40. if (is_null($this->commandApplication) || $this->commandApplication->isVerbose())
  41. {
  42. parent::logSection($section, $message, $size, $style);
  43. }
  44. }
  45. }