PhpDependLoggerElement.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * $Id: PhpDependLoggerElement.php 905 2010-10-05 16:28:03Z mrook $
  4. *
  5. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  6. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  7. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  8. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  9. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  10. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  11. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  12. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  13. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  14. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  15. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  16. *
  17. * This software consists of voluntary contributions made by many individuals
  18. * and is licensed under the LGPL. For more information please see
  19. * <http://phing.info>.
  20. */
  21. require_once 'phing/system/io/PhingFile.php';
  22. /**
  23. * Logger element for the PhpDependTask.
  24. *
  25. * @package phing.tasks.ext.pdepend
  26. * @author Benjamin Schultz <bschultz@proqrent.de>
  27. * @version $Id: PhpDependLoggerElement.php 905 2010-10-05 16:28:03Z mrook $
  28. * @since 2.4.1
  29. */
  30. class PhpDependLoggerElement
  31. {
  32. /**
  33. * The type of the logger.
  34. *
  35. * @var string
  36. */
  37. protected $_type = '';
  38. /**
  39. * Output file for logger.
  40. *
  41. * @var PhingFile
  42. */
  43. protected $_outfile = null;
  44. /**
  45. * Sets the logger type.
  46. *
  47. * @param string $type Type of the logger
  48. *
  49. * @return void
  50. */
  51. public function setType($type)
  52. {
  53. $this->_type = $type;
  54. switch ($this->_type) {
  55. case 'jdepend-chart':
  56. case 'jdepend-xml':
  57. case 'overview-pyramid':
  58. case 'phpunit-xml':
  59. case 'summary-xml':
  60. break;
  61. default:
  62. throw new BuildException(
  63. "Logger '" . $this->_type . "' not implemented"
  64. );
  65. }
  66. }
  67. /**
  68. * Get the logger type
  69. *
  70. * @return string
  71. */
  72. public function getType()
  73. {
  74. return $this->_type;
  75. }
  76. /**
  77. * Sets the output file for the logger results.
  78. *
  79. * @param PhingFile $outfile The output file
  80. *
  81. * @return void
  82. */
  83. public function setOutfile(PhingFile $outfile)
  84. {
  85. $this->_outfile = $outfile;
  86. }
  87. /**
  88. * Get the output file.
  89. *
  90. * @return PhingFile
  91. */
  92. public function getOutfile()
  93. {
  94. return $this->_outfile;
  95. }
  96. }