1 | <?php |
||
24 | class XlsHandler |
||
25 | { |
||
26 | /** |
||
27 | * Instance of the project. |
||
28 | * |
||
29 | * @var Project |
||
30 | */ |
||
31 | protected $project; |
||
32 | |||
33 | /** |
||
34 | * Collection of project issues. |
||
35 | * |
||
36 | * @var Project\Issue[] |
||
37 | */ |
||
38 | protected $issues; |
||
39 | |||
40 | /** |
||
41 | * Columns to export from the issues table. |
||
42 | * |
||
43 | * @var array |
||
44 | */ |
||
45 | protected $columns = [ |
||
46 | 'id' => '', |
||
47 | 'title' => '', |
||
48 | 'time_quote' => '', |
||
49 | 'created_at' => '', |
||
50 | 'updated_at' => '', |
||
51 | 'closed_at' => '', |
||
52 | 'status' => '', |
||
53 | ]; |
||
54 | |||
55 | /** |
||
56 | * Columns in the output file. |
||
57 | * |
||
58 | * @var array |
||
59 | */ |
||
60 | protected $header = [ |
||
61 | 'tinyissue.id', |
||
62 | 'tinyissue.title', |
||
63 | 'tinyissue.time_quote', |
||
64 | 'tinyissue.label_created', |
||
65 | 'tinyissue.updated', |
||
66 | 'tinyissue.label_closed', |
||
67 | 'tinyissue.status', |
||
68 | ]; |
||
69 | |||
70 | /** |
||
71 | * Set an instance of a project model. |
||
72 | * |
||
73 | * @param Project $project |
||
74 | * |
||
75 | * @return $this |
||
76 | */ |
||
77 | 1 | public function setProject(Project $project) |
|
83 | |||
84 | /** |
||
85 | * @param Exporter $exporter |
||
86 | * |
||
87 | * @return void |
||
88 | */ |
||
89 | 1 | public function handle(Exporter $exporter) |
|
132 | |||
133 | /** |
||
134 | * Setup sheet global styles. |
||
135 | * |
||
136 | * @param LaravelExcelWorksheet $sheet |
||
137 | * |
||
138 | * @return void |
||
139 | */ |
||
140 | 1 | protected function globalStyle(LaravelExcelWorksheet $sheet) |
|
146 | |||
147 | /** |
||
148 | * Sheet title in the first row. |
||
149 | * |
||
150 | * @param CellWriter $cell |
||
151 | * |
||
152 | * @return void |
||
153 | */ |
||
154 | 1 | public function sheetTitle(CellWriter $cell) |
|
161 | |||
162 | /** |
||
163 | * Sheet data row. |
||
164 | * |
||
165 | * @param LaravelExcelWorksheet $sheet |
||
166 | * @param int $index |
||
167 | * @param Project\Issue $issue |
||
168 | * |
||
169 | * @return void |
||
170 | */ |
||
171 | 1 | protected function sheetRow(LaravelExcelWorksheet $sheet, $index, Project\Issue $issue) |
|
191 | } |
||
192 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.