1 | <?php |
||
14 | class Builder |
||
15 | { |
||
16 | /** |
||
17 | * @var \Rougin\Describe\Column |
||
18 | */ |
||
19 | protected $column; |
||
20 | |||
21 | /** |
||
22 | * @var \Rougin\Describe\Describe |
||
23 | */ |
||
24 | protected $describe; |
||
25 | |||
26 | /** |
||
27 | * @var \Rougin\Refinery\Parser |
||
28 | */ |
||
29 | protected $parser; |
||
30 | |||
31 | /** |
||
32 | * Initializes the column instance. |
||
33 | */ |
||
34 | 9 | public function __construct() |
|
46 | |||
47 | /** |
||
48 | * Sets the column instance to be used. |
||
49 | * |
||
50 | * @param \Rougin\Describe\Column $column |
||
51 | * @return self |
||
52 | */ |
||
53 | 3 | public function column(Column $column) |
|
59 | |||
60 | /** |
||
61 | * Sets the Describe instance. |
||
62 | * |
||
63 | * @param \Rougin\Describe\Describe $describe |
||
64 | * @return self |
||
65 | */ |
||
66 | 3 | public function describe(Describe $describe) |
|
72 | |||
73 | /** |
||
74 | * Builds the migration file. |
||
75 | * |
||
76 | * @param string $name |
||
77 | * @return boolean |
||
78 | */ |
||
79 | 9 | public function make($name) |
|
99 | |||
100 | /** |
||
101 | * Returns a string value of the specified data type. |
||
102 | * |
||
103 | * @param boolean|string $value |
||
104 | * @return string |
||
105 | */ |
||
106 | 9 | protected function type($value) |
|
116 | |||
117 | /** |
||
118 | * Generates code based from the column instance. |
||
119 | * |
||
120 | * @param \Rougin\Describe\Column $column |
||
121 | * @return string |
||
122 | */ |
||
123 | 9 | protected function create(Column $column, $file) |
|
143 | |||
144 | /** |
||
145 | * Creates a migration based from a database schema. |
||
146 | * |
||
147 | * @return string |
||
148 | */ |
||
149 | 3 | protected function database() |
|
167 | |||
168 | /** |
||
169 | * Prepares the contents of the migration file. |
||
170 | * |
||
171 | * @param string $file |
||
172 | * @param \Rougin\Describe\Column $column |
||
173 | * @return string |
||
174 | */ |
||
175 | 6 | protected function prepare($file, Column $column) |
|
195 | |||
196 | /** |
||
197 | * Creates a template based on given filename. |
||
198 | * |
||
199 | * @param string $filename |
||
200 | * @return string |
||
201 | */ |
||
202 | 9 | protected function template($filename) |
|
216 | } |
||
217 |