StaticMethodFile.php 773B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /*
  3. Copyright (c) 2009 hamcrest.org
  4. */
  5. class StaticMethodFile extends FactoryFile
  6. {
  7. /**
  8. * @var string containing method definitions
  9. */
  10. private $methods;
  11. public function __construct($file)
  12. {
  13. parent::__construct($file, ' ');
  14. $this->methods = '';
  15. }
  16. public function addCall(FactoryCall $call)
  17. {
  18. $this->methods .= PHP_EOL . $this->generateFactoryCall($call);
  19. }
  20. public function getDeclarationModifiers()
  21. {
  22. return 'public static ';
  23. }
  24. public function build()
  25. {
  26. $this->addFileHeader();
  27. $this->addPart('matchers_imports');
  28. $this->addPart('matchers_header');
  29. $this->addCode($this->methods);
  30. $this->addPart('matchers_footer');
  31. }
  32. }