1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the php-phantomjs. |
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
|
|
|
namespace JonnyW\PhantomJs\Procedure; |
11
|
|
|
|
12
|
|
|
use JonnyW\PhantomJs\Engine; |
13
|
|
|
use JonnyW\PhantomJs\Cache\CacheInterface; |
14
|
|
|
use JonnyW\PhantomJs\Parser\ParserInterface; |
15
|
|
|
use JonnyW\PhantomJs\Template\TemplateRendererInterface; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* PHP PhantomJs |
19
|
|
|
* |
20
|
|
|
* @author Jon Wenmoth <[email protected]> |
21
|
|
|
*/ |
22
|
|
|
class ProcedureFactory implements ProcedureFactoryInterface |
23
|
|
|
{ |
24
|
|
|
/** |
25
|
|
|
* PhantomJS engine |
26
|
|
|
* |
27
|
|
|
* @var \JonnyW\PhantomJs\Engine |
28
|
|
|
* @access protected |
29
|
|
|
*/ |
30
|
|
|
protected $engine; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Parser. |
34
|
|
|
* |
35
|
|
|
* @var \JonnyW\PhantomJs\Parser\ParserInterface |
36
|
|
|
* @access protected |
37
|
|
|
*/ |
38
|
|
|
protected $parser; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* Cache handler. |
42
|
|
|
* |
43
|
|
|
* @var \JonnyW\PhantomJs\Cache\CacheInterface |
44
|
|
|
* @access protected |
45
|
|
|
*/ |
46
|
|
|
protected $cacheHandler; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Template renderer. |
50
|
|
|
* |
51
|
|
|
* @var \JonnyW\PhantomJs\Template\TemplateRendererInterface |
52
|
|
|
* @access protected |
53
|
|
|
*/ |
54
|
|
|
protected $renderer; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Internal constructor. |
58
|
|
|
* |
59
|
|
|
* @access public |
60
|
|
|
* @param \JonnyW\PhantomJs\Engine $engine |
61
|
|
|
* @param \JonnyW\PhantomJs\Parser\ParserInterface $parser |
62
|
|
|
* @param \JonnyW\PhantomJs\Cache\CacheInterface $cacheHandler |
63
|
|
|
* @param \JonnyW\PhantomJs\Template\TemplateRendererInterface $renderer |
64
|
|
|
*/ |
65
|
|
|
public function __construct(Engine $engine, ParserInterface $parser, CacheInterface $cacheHandler, TemplateRendererInterface $renderer) |
66
|
|
|
{ |
67
|
|
|
$this->engine = $engine; |
68
|
|
|
$this->parser = $parser; |
69
|
|
|
$this->cacheHandler = $cacheHandler; |
70
|
|
|
$this->renderer = $renderer; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Create new procedure instance. |
75
|
|
|
* |
76
|
|
|
* @access public |
77
|
|
|
* @return \JonnyW\PhantomJs\Procedure\Procedure |
78
|
|
|
*/ |
79
|
|
|
public function createProcedure() |
80
|
|
|
{ |
81
|
|
|
$procedure = new Procedure( |
82
|
|
|
$this->engine, |
83
|
|
|
$this->parser, |
84
|
|
|
$this->cacheHandler, |
85
|
|
|
$this->renderer |
86
|
|
|
); |
87
|
|
|
|
88
|
|
|
return $procedure; |
89
|
|
|
} |
90
|
|
|
} |
91
|
|
|
|