SvnCommit.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Intl\Util;
  11. /**
  12. * An SVN commit.
  13. *
  14. * @author Bernhard Schussek <bschussek@gmail.com>
  15. */
  16. class SvnCommit
  17. {
  18. /**
  19. * @var \SimpleXMLElement
  20. */
  21. private $svnInfo;
  22. /**
  23. * Creates a commit from the given "svn info" data.
  24. *
  25. * @param \SimpleXMLElement $svnInfo The XML result from the "svn info"
  26. * command.
  27. */
  28. public function __construct(\SimpleXMLElement $svnInfo)
  29. {
  30. $this->svnInfo = $svnInfo;
  31. }
  32. /**
  33. * Returns the revision of the commit.
  34. *
  35. * @return string The revision of the commit
  36. */
  37. public function getRevision()
  38. {
  39. return (string) $this->svnInfo['revision'];
  40. }
  41. /**
  42. * Returns the author of the commit.
  43. *
  44. * @return string The author name
  45. */
  46. public function getAuthor()
  47. {
  48. return (string) $this->svnInfo->author;
  49. }
  50. /**
  51. * Returns the date of the commit.
  52. *
  53. * @return string The commit date
  54. */
  55. public function getDate()
  56. {
  57. return (string) $this->svnInfo->date;
  58. }
  59. }