1 | <?php |
||
11 | class FileDateMigrationCreator implements MigrationCreator |
||
12 | { |
||
13 | use Filesystem; |
||
14 | |||
15 | /** |
||
16 | * Yarak config. |
||
17 | * |
||
18 | * @var Config |
||
19 | */ |
||
20 | protected $config; |
||
21 | |||
22 | /** |
||
23 | * Construct. |
||
24 | * |
||
25 | * @param Config $config |
||
26 | */ |
||
27 | public function __construct(Config $config) |
||
31 | |||
32 | /** |
||
33 | * Create a migration file. |
||
34 | * |
||
35 | * @param string $name |
||
36 | * @param string $create |
||
37 | * |
||
38 | * @return string |
||
39 | */ |
||
40 | public function create($name, $create = false) |
||
58 | |||
59 | /** |
||
60 | * Return StudlyCase class name. |
||
61 | * |
||
62 | * @param string $name |
||
63 | * |
||
64 | * @return string |
||
65 | */ |
||
66 | protected function getClassName($name) |
||
70 | |||
71 | /** |
||
72 | * If class name already exists, throw exception. Prone to failure due to |
||
73 | * autoloading strategy. |
||
74 | * |
||
75 | * @param string $className |
||
76 | * |
||
77 | * @throws WriteError |
||
78 | */ |
||
79 | protected function failIfClassExists($className) |
||
85 | |||
86 | /** |
||
87 | * Get stub with appropriate class name/table name. |
||
88 | * |
||
89 | * @param string $className |
||
90 | * |
||
91 | * @return string |
||
92 | */ |
||
93 | protected function getStub($className, $create) |
||
101 | |||
102 | /** |
||
103 | * Populate stub with class name and table name. |
||
104 | * |
||
105 | * @param string $stub |
||
106 | * @param string $className |
||
107 | * @param string $create |
||
108 | * |
||
109 | * @return string |
||
110 | */ |
||
111 | protected function populateStub($stub, $className, $create) |
||
119 | |||
120 | /** |
||
121 | * Get the full path to save file to. |
||
122 | * |
||
123 | * @param string $name |
||
124 | * |
||
125 | * @return string |
||
126 | */ |
||
127 | protected function getSavePath($name) |
||
133 | |||
134 | /** |
||
135 | * Build file name for migration. |
||
136 | * |
||
137 | * @param string $name |
||
138 | * |
||
139 | * @return string |
||
140 | */ |
||
141 | protected function buildFileName($name) |
||
145 | |||
146 | /** |
||
147 | * Get the date prefix for the migration. |
||
148 | * |
||
149 | * @return string |
||
150 | */ |
||
151 | protected function getDatePrefix() |
||
155 | } |
||
156 |