1 | <?php |
||
7 | class Manager |
||
8 | { |
||
9 | /** |
||
10 | * The location of the stubs directory. |
||
11 | * |
||
12 | * @var string |
||
13 | */ |
||
14 | protected $stubs_dir; |
||
15 | |||
16 | /** |
||
17 | * An instance of a parrot file wrapper. |
||
18 | * |
||
19 | * @var \Enzyme\Parrot\File |
||
20 | */ |
||
21 | protected $file_dispatch; |
||
22 | |||
23 | /** |
||
24 | * Create a new stub manager. |
||
25 | * |
||
26 | * @param \Enzyme\Parrot\File $file_dispatch |
||
27 | */ |
||
28 | public function __construct(File $file_dispatch) |
||
33 | |||
34 | /** |
||
35 | * Get the contents for the provided stub. |
||
36 | * |
||
37 | * @param string $stub |
||
38 | * |
||
39 | * @return string |
||
40 | * |
||
41 | * @throws InvalidArgumentException If the stub by the given name does not |
||
42 | * exist in the `console/Stubs` folder using the format `{name}.stub`. |
||
43 | */ |
||
44 | public function get($stub) |
||
56 | |||
57 | /** |
||
58 | * Hydrate the given contents, replacing the given keys with the values |
||
59 | * provided in the associative array. |
||
60 | * |
||
61 | * @param string $contents |
||
62 | * @param array $data |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | public function hydrate($contents, array $data) |
||
74 | |||
75 | /** |
||
76 | * Write the given contents out to the specified file. |
||
77 | * |
||
78 | * @param string $contents |
||
79 | * @param string $path |
||
80 | */ |
||
81 | public function writeOut($contents, $path) |
||
85 | } |
||
86 |