1 | <?php namespace Arcanedev\Assets\Helpers; |
||
11 | class Stub |
||
12 | { |
||
13 | /* ----------------------------------------------------------------- |
||
14 | | Properties |
||
15 | | ----------------------------------------------------------------- |
||
16 | */ |
||
17 | |||
18 | /** @var string */ |
||
19 | protected $content; |
||
20 | |||
21 | /* ----------------------------------------------------------------- |
||
22 | | Main Methods |
||
23 | | ----------------------------------------------------------------- |
||
24 | */ |
||
25 | |||
26 | /** |
||
27 | * @param string|null $file |
||
28 | * |
||
29 | * @return static |
||
30 | */ |
||
31 | public static function make($file = null) |
||
37 | |||
38 | /** |
||
39 | * Get the stub file path. |
||
40 | * |
||
41 | * @return string |
||
42 | * |
||
43 | * @throws \Exception |
||
44 | */ |
||
45 | protected static function getFilePath() |
||
49 | |||
50 | /** |
||
51 | * Get the stub content. |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | public function content() |
||
59 | |||
60 | /** |
||
61 | * Set the stub content. |
||
62 | * |
||
63 | * @param string $content |
||
64 | * |
||
65 | * @return static |
||
66 | */ |
||
67 | protected function setContent($content) |
||
73 | |||
74 | /** |
||
75 | * Replace the placeholders. |
||
76 | * |
||
77 | * @param string|array $search |
||
78 | * @param string|array $replace |
||
79 | * |
||
80 | * @return static |
||
81 | */ |
||
82 | public function replace($search, $replace) |
||
88 | |||
89 | /** |
||
90 | * Get the content. |
||
91 | * |
||
92 | * @param string $file |
||
93 | * |
||
94 | * @return string |
||
95 | */ |
||
96 | public static function load($file) |
||
100 | |||
101 | /** |
||
102 | * Save the content. |
||
103 | * |
||
104 | * @param string $path |
||
105 | * |
||
106 | * @return int |
||
107 | */ |
||
108 | public function save($path) |
||
112 | |||
113 | /** |
||
114 | * Prepare the stub path. |
||
115 | * |
||
116 | * @param string|null $file |
||
117 | * |
||
118 | * @return string |
||
119 | */ |
||
120 | public static function path($file = null) |
||
129 | |||
130 | /** |
||
131 | * Get the base stubs' path. |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | public static function getBasePath() |
||
139 | |||
140 | /** |
||
141 | * Transform the stub content (json) to associated array. |
||
142 | * |
||
143 | * @return array |
||
144 | */ |
||
145 | public function toArray() |
||
149 | } |
||
150 |