File tree Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Expand file tree Collapse file tree 1 file changed +0
-34
lines changed Original file line number Diff line number Diff line change 3
3
namespace Safe ;
4
4
5
5
use function array_merge ;
6
- use Complex \Exception ;
7
6
use function file_exists ;
8
- use PhpOffice \PhpSpreadsheet \Spreadsheet ;
9
- use PhpOffice \PhpSpreadsheet \Writer \Xlsx ;
10
7
11
8
class FileCreator
12
9
{
13
- /**
14
- * This function generate an xls file
15
- *
16
- * @param string[] $protoFunctions
17
- * @param string $path
18
- */
19
- public function generateXlsFile (array $ protoFunctions , string $ path ): void
20
- {
21
- $ spreadsheet = new Spreadsheet ();
22
- $ numb = 1 ;
23
-
24
- $ sheet = $ spreadsheet ->getActiveSheet ();
25
- $ sheet ->setCellValue ('A1 ' , 'Function name ' );
26
- $ sheet ->setCellValue ('B1 ' , 'Status ' );
27
-
28
- foreach ($ protoFunctions as $ protoFunction ) {
29
- if ($ protoFunction ) {
30
- if (strpos ($ protoFunction , '= ' ) === false && strpos ($ protoFunction , 'json ' ) === false ) {
31
- $ status = 'classic ' ;
32
- } elseif (strpos ($ protoFunction , 'json ' )) {
33
- $ status = 'json ' ;
34
- } else {
35
- $ status = 'opt ' ;
36
- }
37
- $ sheet ->setCellValue ('A ' .$ numb , $ protoFunction );
38
- $ sheet ->setCellValue ('B ' .$ numb ++, $ status );
39
- }
40
- }
41
- $ writer = new Xlsx ($ spreadsheet );
42
- $ writer ->save ($ path );
43
- }
44
10
45
11
/**
46
12
* This function generate an improved php lib function in a php file
You can’t perform that action at this time.
0 commit comments