1 | <?php |
||
8 | class FileGenerator extends Generator |
||
9 | { |
||
10 | /** |
||
11 | * The path wil be used. |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | protected $path; |
||
16 | |||
17 | /** |
||
18 | * The contens will be used. |
||
19 | * |
||
20 | * @var string |
||
21 | */ |
||
22 | protected $contents; |
||
23 | |||
24 | /** |
||
25 | * The laravel filesystem or null. |
||
26 | * |
||
27 | * @var \Illuminate\Filesystem\Filesystem|null |
||
28 | */ |
||
29 | protected $filesystem; |
||
30 | /** |
||
31 | * @var bool |
||
32 | */ |
||
33 | private $overwriteFile; |
||
34 | |||
35 | /** |
||
36 | * The constructor. |
||
37 | * |
||
38 | 92 | * @param $path |
|
39 | * @param $contents |
||
40 | 92 | * @param null $filesystem |
|
41 | 92 | */ |
|
42 | 92 | public function __construct($path, $contents, $filesystem = null) |
|
48 | |||
49 | /** |
||
50 | 92 | * Get contents. |
|
51 | * |
||
52 | 92 | * @return mixed |
|
53 | */ |
||
54 | public function getContents() |
||
58 | |||
59 | /** |
||
60 | * Set contents. |
||
61 | * |
||
62 | * @param mixed $contents |
||
63 | * |
||
64 | * @return $this |
||
65 | */ |
||
66 | public function setContents($contents) |
||
72 | |||
73 | /** |
||
74 | * Get filesystem. |
||
75 | * |
||
76 | * @return mixed |
||
77 | */ |
||
78 | public function getFilesystem() |
||
82 | |||
83 | /** |
||
84 | * Set filesystem. |
||
85 | * |
||
86 | * @param Filesystem $filesystem |
||
87 | * |
||
88 | * @return $this |
||
89 | */ |
||
90 | public function setFilesystem(Filesystem $filesystem) |
||
96 | |||
97 | /** |
||
98 | 92 | * Get path. |
|
99 | * |
||
100 | 92 | * @return mixed |
|
101 | */ |
||
102 | public function getPath() |
||
106 | |||
107 | /** |
||
108 | * Set path. |
||
109 | * |
||
110 | * @param mixed $path |
||
111 | * |
||
112 | * @return $this |
||
113 | */ |
||
114 | public function setPath($path) |
||
120 | 92 | ||
121 | public function withFileOverwrite(bool $overwrite): FileGenerator |
||
127 | |||
128 | /** |
||
129 | * Generate the file. |
||
130 | */ |
||
131 | public function generate() |
||
143 | } |
||
144 |