ProcedureFactory.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. /*
  3. * This file is part of the php-phantomjs.
  4. *
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. */
  8. namespace JonnyW\PhantomJs\Procedure;
  9. use \JonnyW\PhantomJs\Cache\CacheInterface;
  10. use \JonnyW\PhantomJs\Parser\ParserInterface;
  11. use \JonnyW\PhantomJs\Template\TemplateRendererInterface;
  12. /**
  13. * PHP PhantomJs
  14. *
  15. * @author Jon Wenmoth <contact@jonnyw.me>
  16. */
  17. class ProcedureFactory implements ProcedureFactoryInterface
  18. {
  19. /**
  20. * Parser.
  21. *
  22. * @var \JonnyW\PhantomJs\Parser\ParserInterface
  23. * @access protected
  24. */
  25. protected $parser;
  26. /**
  27. * Cache handler.
  28. *
  29. * @var \JonnyW\PhantomJs\Cache\CacheInterface
  30. * @access protected
  31. */
  32. protected $cacheHandler;
  33. /**
  34. * Template renderer.
  35. *
  36. * @var \JonnyW\PhantomJs\Template\TemplateRendererInterface
  37. * @access protected
  38. */
  39. protected $renderer;
  40. /**
  41. * Internal constructor.
  42. *
  43. * @access public
  44. * @param \JonnyW\PhantomJs\Parser\ParserInterface $parser
  45. * @param \JonnyW\PhantomJs\Cache\CacheInterface $cacheHandler
  46. * @param \JonnyW\PhantomJs\Template\TemplateRendererInterface $renderer
  47. */
  48. public function __construct(ParserInterface $parser, CacheInterface $cacheHandler, TemplateRendererInterface $renderer)
  49. {
  50. $this->parser = $parser;
  51. $this->cacheHandler = $cacheHandler;
  52. $this->renderer = $renderer;
  53. }
  54. /**
  55. * Create new procedure instance.
  56. *
  57. * @access public
  58. * @return \JonnyW\PhantomJs\Procedure\Procedure
  59. */
  60. public function createProcedure()
  61. {
  62. $procedure = new Procedure(
  63. $this->parser,
  64. $this->cacheHandler,
  65. $this->renderer
  66. );
  67. return $procedure;
  68. }
  69. }