sfCommandApplicationTask.class.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 19112 2009-06-10 06:32:12Z fabien $
  16. */
  17. abstract class sfCommandApplicationTask extends sfTask
  18. {
  19. protected
  20. $commandApplication = null;
  21. /**
  22. * Sets the command application instance for this task.
  23. *
  24. * @param sfCommandApplication $commandApplication A sfCommandApplication instance
  25. */
  26. public function setCommandApplication(sfCommandApplication $commandApplication = null)
  27. {
  28. $this->commandApplication = $commandApplication;
  29. }
  30. /**
  31. * @see sfTask
  32. */
  33. public function log($messages)
  34. {
  35. if (is_null($this->commandApplication) || $this->commandApplication->isVerbose())
  36. {
  37. parent::log($messages);
  38. }
  39. }
  40. /**
  41. * @see sfTask
  42. */
  43. public function logSection($section, $message, $size = null, $style = 'INFO')
  44. {
  45. if (is_null($this->commandApplication) || $this->commandApplication->isVerbose())
  46. {
  47. parent::logSection($section, $message, $size, $style);
  48. }
  49. }
  50. }