1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace PhpOffice\PhpSpreadsheet\Helper; |
4
|
|
|
|
5
|
|
|
class Migrator |
6
|
|
|
{ |
7
|
|
|
/** |
8
|
|
|
* Return the ordered mapping from old PHPExcel class names to new PhpSpreadsheet one. |
9
|
|
|
* |
10
|
|
|
* @return string[] |
11
|
|
|
*/ |
12
|
1 |
|
public function getMapping() |
13
|
|
|
{ |
14
|
|
|
// Order matters here, we should have the deepest namespaces first (the most "unique" strings) |
15
|
|
|
$classes = [ |
16
|
1 |
|
'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE\Blip::class, |
17
|
|
|
'PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer\SpContainer::class, |
18
|
|
|
'PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer\BSE::class, |
19
|
|
|
'PHPExcel_Shared_Escher_DgContainer_SpgrContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer\SpgrContainer::class, |
20
|
|
|
'PHPExcel_Shared_Escher_DggContainer_BstoreContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer\BstoreContainer::class, |
21
|
|
|
'PHPExcel_Shared_OLE_PPS_File' => \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\File::class, |
22
|
|
|
'PHPExcel_Shared_OLE_PPS_Root' => \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS\Root::class, |
23
|
|
|
'PHPExcel_Worksheet_AutoFilter_Column_Rule' => \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column\Rule::class, |
24
|
|
|
'PHPExcel_Writer_OpenDocument_Cell_Comment' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Cell\Comment::class, |
25
|
|
|
'PHPExcel_Calculation_Token_Stack' => \PhpOffice\PhpSpreadsheet\Calculation\Token\Stack::class, |
26
|
|
|
'PHPExcel_Chart_Renderer_jpgraph' => \PhpOffice\PhpSpreadsheet\Chart\Renderer\JpGraph::class, |
27
|
|
|
'PHPExcel_Reader_Excel5_Escher' => \PhpOffice\PhpSpreadsheet\Reader\Xls\Escher::class, |
28
|
|
|
'PHPExcel_Reader_Excel5_MD5' => \PhpOffice\PhpSpreadsheet\Reader\Xls\MD5::class, |
29
|
|
|
'PHPExcel_Reader_Excel5_RC4' => \PhpOffice\PhpSpreadsheet\Reader\Xls\RC4::class, |
30
|
|
|
'PHPExcel_Reader_Excel2007_Chart' => \PhpOffice\PhpSpreadsheet\Reader\Xlsx\Chart::class, |
31
|
|
|
'PHPExcel_Reader_Excel2007_Theme' => \PhpOffice\PhpSpreadsheet\Reader\Xlsx\Theme::class, |
32
|
|
|
'PHPExcel_Shared_Escher_DgContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DgContainer::class, |
33
|
|
|
'PHPExcel_Shared_Escher_DggContainer' => \PhpOffice\PhpSpreadsheet\Shared\Escher\DggContainer::class, |
34
|
|
|
'CholeskyDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\CholeskyDecomposition::class, |
35
|
|
|
'EigenvalueDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\EigenvalueDecomposition::class, |
36
|
|
|
'PHPExcel_Shared_JAMA_LUDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\LUDecomposition::class, |
37
|
|
|
'PHPExcel_Shared_JAMA_Matrix' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\Matrix::class, |
38
|
|
|
'QRDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\QRDecomposition::class, |
39
|
|
|
'PHPExcel_Shared_JAMA_QRDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\QRDecomposition::class, |
40
|
|
|
'SingularValueDecomposition' => \PhpOffice\PhpSpreadsheet\Shared\JAMA\SingularValueDecomposition::class, |
41
|
|
|
'PHPExcel_Shared_OLE_ChainedBlockStream' => \PhpOffice\PhpSpreadsheet\Shared\OLE\ChainedBlockStream::class, |
42
|
|
|
'PHPExcel_Shared_OLE_PPS' => \PhpOffice\PhpSpreadsheet\Shared\OLE\PPS::class, |
43
|
|
|
'PHPExcel_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\BestFit::class, |
44
|
|
|
'PHPExcel_Exponential_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\ExponentialBestFit::class, |
45
|
|
|
'PHPExcel_Linear_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\LinearBestFit::class, |
46
|
|
|
'PHPExcel_Logarithmic_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\LogarithmicBestFit::class, |
47
|
|
|
'polynomialBestFit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\PolynomialBestFit::class, |
48
|
|
|
'PHPExcel_Polynomial_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\PolynomialBestFit::class, |
49
|
|
|
'powerBestFit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\PowerBestFit::class, |
50
|
|
|
'PHPExcel_Power_Best_Fit' => \PhpOffice\PhpSpreadsheet\Shared\Trend\PowerBestFit::class, |
51
|
|
|
'trendClass' => \PhpOffice\PhpSpreadsheet\Shared\Trend\Trend::class, |
52
|
|
|
'PHPExcel_Worksheet_AutoFilter_Column' => \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter\Column::class, |
53
|
|
|
'PHPExcel_Worksheet_Drawing_Shadow' => \PhpOffice\PhpSpreadsheet\Worksheet\Drawing\Shadow::class, |
54
|
|
|
'PHPExcel_Writer_OpenDocument_Content' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Content::class, |
55
|
|
|
'PHPExcel_Writer_OpenDocument_Meta' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Meta::class, |
56
|
|
|
'PHPExcel_Writer_OpenDocument_MetaInf' => \PhpOffice\PhpSpreadsheet\Writer\Ods\MetaInf::class, |
57
|
|
|
'PHPExcel_Writer_OpenDocument_Mimetype' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Mimetype::class, |
58
|
|
|
'PHPExcel_Writer_OpenDocument_Settings' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Settings::class, |
59
|
|
|
'PHPExcel_Writer_OpenDocument_Styles' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Styles::class, |
60
|
|
|
'PHPExcel_Writer_OpenDocument_Thumbnails' => \PhpOffice\PhpSpreadsheet\Writer\Ods\Thumbnails::class, |
61
|
|
|
'PHPExcel_Writer_OpenDocument_WriterPart' => \PhpOffice\PhpSpreadsheet\Writer\Ods\WriterPart::class, |
62
|
|
|
'PHPExcel_Writer_PDF_Core' => \PhpOffice\PhpSpreadsheet\Writer\Pdf::class, |
63
|
|
|
'PHPExcel_Writer_PDF_DomPDF' => \PhpOffice\PhpSpreadsheet\Writer\Pdf\Dompdf::class, |
64
|
|
|
'PHPExcel_Writer_PDF_mPDF' => \PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf::class, |
65
|
|
|
'PHPExcel_Writer_PDF_tcPDF' => \PhpOffice\PhpSpreadsheet\Writer\Pdf\Tcpdf::class, |
66
|
|
|
'PHPExcel_Writer_Excel5_BIFFwriter' => \PhpOffice\PhpSpreadsheet\Writer\Xls\BIFFwriter::class, |
67
|
|
|
'PHPExcel_Writer_Excel5_Escher' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Escher::class, |
68
|
|
|
'PHPExcel_Writer_Excel5_Font' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Font::class, |
69
|
|
|
'PHPExcel_Writer_Excel5_Parser' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Parser::class, |
70
|
|
|
'PHPExcel_Writer_Excel5_Workbook' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Workbook::class, |
71
|
|
|
'PHPExcel_Writer_Excel5_Worksheet' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Worksheet::class, |
72
|
|
|
'PHPExcel_Writer_Excel5_Xf' => \PhpOffice\PhpSpreadsheet\Writer\Xls\Xf::class, |
73
|
|
|
'PHPExcel_Writer_Excel2007_Chart' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Chart::class, |
74
|
|
|
'PHPExcel_Writer_Excel2007_Comments' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Comments::class, |
75
|
|
|
'PHPExcel_Writer_Excel2007_ContentTypes' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\ContentTypes::class, |
76
|
|
|
'PHPExcel_Writer_Excel2007_DocProps' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\DocProps::class, |
77
|
|
|
'PHPExcel_Writer_Excel2007_Drawing' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Drawing::class, |
78
|
|
|
'PHPExcel_Writer_Excel2007_Rels' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Rels::class, |
79
|
|
|
'PHPExcel_Writer_Excel2007_RelsRibbon' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsRibbon::class, |
80
|
|
|
'PHPExcel_Writer_Excel2007_RelsVBA' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\RelsVBA::class, |
81
|
|
|
'PHPExcel_Writer_Excel2007_StringTable' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\StringTable::class, |
82
|
|
|
'PHPExcel_Writer_Excel2007_Style' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style::class, |
83
|
|
|
'PHPExcel_Writer_Excel2007_Theme' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Theme::class, |
84
|
|
|
'PHPExcel_Writer_Excel2007_Workbook' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Workbook::class, |
85
|
|
|
'PHPExcel_Writer_Excel2007_Worksheet' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\Worksheet::class, |
86
|
|
|
'PHPExcel_Writer_Excel2007_WriterPart' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx\WriterPart::class, |
87
|
|
|
'PHPExcel_CachedObjectStorage_CacheBase' => \PhpOffice\PhpSpreadsheet\Collection\Cells::class, |
88
|
|
|
'PHPExcel_CalcEngine_CyclicReferenceStack' => \PhpOffice\PhpSpreadsheet\Calculation\Engine\CyclicReferenceStack::class, |
89
|
|
|
'PHPExcel_CalcEngine_Logger' => \PhpOffice\PhpSpreadsheet\Calculation\Engine\Logger::class, |
90
|
|
|
'PHPExcel_Calculation_Functions' => \PhpOffice\PhpSpreadsheet\Calculation\Functions::class, |
91
|
|
|
'PHPExcel_Calculation_Function' => \PhpOffice\PhpSpreadsheet\Calculation\Category::class, |
92
|
|
|
'PHPExcel_Calculation_Database' => \PhpOffice\PhpSpreadsheet\Calculation\Database::class, |
93
|
|
|
'PHPExcel_Calculation_DateTime' => \PhpOffice\PhpSpreadsheet\Calculation\DateTime::class, |
94
|
|
|
'PHPExcel_Calculation_Engineering' => \PhpOffice\PhpSpreadsheet\Calculation\Engineering::class, |
95
|
|
|
'PHPExcel_Calculation_Exception' => \PhpOffice\PhpSpreadsheet\Calculation\Exception::class, |
96
|
|
|
'PHPExcel_Calculation_ExceptionHandler' => \PhpOffice\PhpSpreadsheet\Calculation\ExceptionHandler::class, |
97
|
|
|
'PHPExcel_Calculation_Financial' => \PhpOffice\PhpSpreadsheet\Calculation\Financial::class, |
98
|
|
|
'PHPExcel_Calculation_FormulaParser' => \PhpOffice\PhpSpreadsheet\Calculation\FormulaParser::class, |
99
|
|
|
'PHPExcel_Calculation_FormulaToken' => \PhpOffice\PhpSpreadsheet\Calculation\FormulaToken::class, |
100
|
|
|
'PHPExcel_Calculation_Logical' => \PhpOffice\PhpSpreadsheet\Calculation\Logical::class, |
101
|
|
|
'PHPExcel_Calculation_LookupRef' => \PhpOffice\PhpSpreadsheet\Calculation\LookupRef::class, |
102
|
|
|
'PHPExcel_Calculation_MathTrig' => \PhpOffice\PhpSpreadsheet\Calculation\MathTrig::class, |
103
|
|
|
'PHPExcel_Calculation_Statistical' => \PhpOffice\PhpSpreadsheet\Calculation\Statistical::class, |
104
|
|
|
'PHPExcel_Calculation_TextData' => \PhpOffice\PhpSpreadsheet\Calculation\TextData::class, |
105
|
|
|
'PHPExcel_Cell_AdvancedValueBinder' => \PhpOffice\PhpSpreadsheet\Cell\AdvancedValueBinder::class, |
106
|
|
|
'PHPExcel_Cell_DataType' => \PhpOffice\PhpSpreadsheet\Cell\DataType::class, |
107
|
|
|
'PHPExcel_Cell_DataValidation' => \PhpOffice\PhpSpreadsheet\Cell\DataValidation::class, |
108
|
|
|
'PHPExcel_Cell_DefaultValueBinder' => \PhpOffice\PhpSpreadsheet\Cell\DefaultValueBinder::class, |
109
|
|
|
'PHPExcel_Cell_Hyperlink' => \PhpOffice\PhpSpreadsheet\Cell\Hyperlink::class, |
110
|
|
|
'PHPExcel_Cell_IValueBinder' => \PhpOffice\PhpSpreadsheet\Cell\IValueBinder::class, |
111
|
|
|
'PHPExcel_Chart_Axis' => \PhpOffice\PhpSpreadsheet\Chart\Axis::class, |
112
|
|
|
'PHPExcel_Chart_DataSeries' => \PhpOffice\PhpSpreadsheet\Chart\DataSeries::class, |
113
|
|
|
'PHPExcel_Chart_DataSeriesValues' => \PhpOffice\PhpSpreadsheet\Chart\DataSeriesValues::class, |
114
|
|
|
'PHPExcel_Chart_Exception' => \PhpOffice\PhpSpreadsheet\Chart\Exception::class, |
115
|
|
|
'PHPExcel_Chart_GridLines' => \PhpOffice\PhpSpreadsheet\Chart\GridLines::class, |
116
|
|
|
'PHPExcel_Chart_Layout' => \PhpOffice\PhpSpreadsheet\Chart\Layout::class, |
117
|
|
|
'PHPExcel_Chart_Legend' => \PhpOffice\PhpSpreadsheet\Chart\Legend::class, |
118
|
|
|
'PHPExcel_Chart_PlotArea' => \PhpOffice\PhpSpreadsheet\Chart\PlotArea::class, |
119
|
|
|
'PHPExcel_Properties' => \PhpOffice\PhpSpreadsheet\Chart\Properties::class, |
120
|
|
|
'PHPExcel_Chart_Title' => \PhpOffice\PhpSpreadsheet\Chart\Title::class, |
121
|
|
|
'PHPExcel_DocumentProperties' => \PhpOffice\PhpSpreadsheet\Document\Properties::class, |
122
|
|
|
'PHPExcel_DocumentSecurity' => \PhpOffice\PhpSpreadsheet\Document\Security::class, |
123
|
|
|
'PHPExcel_Helper_HTML' => \PhpOffice\PhpSpreadsheet\Helper\Html::class, |
124
|
|
|
'PHPExcel_Reader_Abstract' => \PhpOffice\PhpSpreadsheet\Reader\BaseReader::class, |
125
|
|
|
'PHPExcel_Reader_CSV' => \PhpOffice\PhpSpreadsheet\Reader\Csv::class, |
126
|
|
|
'PHPExcel_Reader_DefaultReadFilter' => \PhpOffice\PhpSpreadsheet\Reader\DefaultReadFilter::class, |
127
|
|
|
'PHPExcel_Reader_Excel2003XML' => \PhpOffice\PhpSpreadsheet\Reader\Xml::class, |
128
|
|
|
'PHPExcel_Reader_Exception' => \PhpOffice\PhpSpreadsheet\Reader\Exception::class, |
129
|
|
|
'PHPExcel_Reader_Gnumeric' => \PhpOffice\PhpSpreadsheet\Reader\Gnumeric::class, |
130
|
|
|
'PHPExcel_Reader_HTML' => \PhpOffice\PhpSpreadsheet\Reader\Html::class, |
131
|
|
|
'PHPExcel_Reader_IReadFilter' => \PhpOffice\PhpSpreadsheet\Reader\IReadFilter::class, |
132
|
|
|
'PHPExcel_Reader_IReader' => \PhpOffice\PhpSpreadsheet\Reader\IReader::class, |
133
|
|
|
'PHPExcel_Reader_OOCalc' => \PhpOffice\PhpSpreadsheet\Reader\Ods::class, |
134
|
|
|
'PHPExcel_Reader_SYLK' => \PhpOffice\PhpSpreadsheet\Reader\Slk::class, |
135
|
|
|
'PHPExcel_Reader_Excel5' => \PhpOffice\PhpSpreadsheet\Reader\Xls::class, |
136
|
|
|
'PHPExcel_Reader_Excel2007' => \PhpOffice\PhpSpreadsheet\Reader\Xlsx::class, |
137
|
|
|
'PHPExcel_RichText_ITextElement' => \PhpOffice\PhpSpreadsheet\RichText\ITextElement::class, |
138
|
|
|
'PHPExcel_RichText_Run' => \PhpOffice\PhpSpreadsheet\RichText\Run::class, |
139
|
|
|
'PHPExcel_RichText_TextElement' => \PhpOffice\PhpSpreadsheet\RichText\TextElement::class, |
140
|
|
|
'PHPExcel_Shared_CodePage' => \PhpOffice\PhpSpreadsheet\Shared\CodePage::class, |
141
|
|
|
'PHPExcel_Shared_Date' => \PhpOffice\PhpSpreadsheet\Shared\Date::class, |
142
|
|
|
'PHPExcel_Shared_Drawing' => \PhpOffice\PhpSpreadsheet\Shared\Drawing::class, |
143
|
|
|
'PHPExcel_Shared_Escher' => \PhpOffice\PhpSpreadsheet\Shared\Escher::class, |
144
|
|
|
'PHPExcel_Shared_File' => \PhpOffice\PhpSpreadsheet\Shared\File::class, |
145
|
|
|
'PHPExcel_Shared_Font' => \PhpOffice\PhpSpreadsheet\Shared\Font::class, |
146
|
|
|
'PHPExcel_Shared_OLE' => \PhpOffice\PhpSpreadsheet\Shared\OLE::class, |
147
|
|
|
'PHPExcel_Shared_OLERead' => \PhpOffice\PhpSpreadsheet\Shared\OLERead::class, |
148
|
|
|
'PHPExcel_Shared_PasswordHasher' => \PhpOffice\PhpSpreadsheet\Shared\PasswordHasher::class, |
149
|
|
|
'PHPExcel_Shared_String' => \PhpOffice\PhpSpreadsheet\Shared\StringHelper::class, |
150
|
|
|
'PHPExcel_Shared_TimeZone' => \PhpOffice\PhpSpreadsheet\Shared\TimeZone::class, |
151
|
|
|
'PHPExcel_Shared_XMLWriter' => \PhpOffice\PhpSpreadsheet\Shared\XMLWriter::class, |
152
|
|
|
'PHPExcel_Shared_Excel5' => \PhpOffice\PhpSpreadsheet\Shared\Xls::class, |
153
|
|
|
'PHPExcel_Style_Alignment' => \PhpOffice\PhpSpreadsheet\Style\Alignment::class, |
154
|
|
|
'PHPExcel_Style_Border' => \PhpOffice\PhpSpreadsheet\Style\Border::class, |
155
|
|
|
'PHPExcel_Style_Borders' => \PhpOffice\PhpSpreadsheet\Style\Borders::class, |
156
|
|
|
'PHPExcel_Style_Color' => \PhpOffice\PhpSpreadsheet\Style\Color::class, |
157
|
|
|
'PHPExcel_Style_Conditional' => \PhpOffice\PhpSpreadsheet\Style\Conditional::class, |
158
|
|
|
'PHPExcel_Style_Fill' => \PhpOffice\PhpSpreadsheet\Style\Fill::class, |
159
|
|
|
'PHPExcel_Style_Font' => \PhpOffice\PhpSpreadsheet\Style\Font::class, |
160
|
|
|
'PHPExcel_Style_NumberFormat' => \PhpOffice\PhpSpreadsheet\Style\NumberFormat::class, |
161
|
|
|
'PHPExcel_Style_Protection' => \PhpOffice\PhpSpreadsheet\Style\Protection::class, |
162
|
|
|
'PHPExcel_Style_Supervisor' => \PhpOffice\PhpSpreadsheet\Style\Supervisor::class, |
163
|
|
|
'PHPExcel_Worksheet_AutoFilter' => \PhpOffice\PhpSpreadsheet\Worksheet\AutoFilter::class, |
164
|
|
|
'PHPExcel_Worksheet_BaseDrawing' => \PhpOffice\PhpSpreadsheet\Worksheet\BaseDrawing::class, |
165
|
|
|
'PHPExcel_Worksheet_CellIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\CellIterator::class, |
166
|
|
|
'PHPExcel_Worksheet_Column' => \PhpOffice\PhpSpreadsheet\Worksheet\Column::class, |
167
|
|
|
'PHPExcel_Worksheet_ColumnCellIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\ColumnCellIterator::class, |
168
|
|
|
'PHPExcel_Worksheet_ColumnDimension' => \PhpOffice\PhpSpreadsheet\Worksheet\ColumnDimension::class, |
169
|
|
|
'PHPExcel_Worksheet_ColumnIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\ColumnIterator::class, |
170
|
|
|
'PHPExcel_Worksheet_Drawing' => \PhpOffice\PhpSpreadsheet\Worksheet\Drawing::class, |
171
|
|
|
'PHPExcel_Worksheet_HeaderFooter' => \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooter::class, |
172
|
|
|
'PHPExcel_Worksheet_HeaderFooterDrawing' => \PhpOffice\PhpSpreadsheet\Worksheet\HeaderFooterDrawing::class, |
173
|
|
|
'PHPExcel_WorksheetIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\Iterator::class, |
174
|
|
|
'PHPExcel_Worksheet_MemoryDrawing' => \PhpOffice\PhpSpreadsheet\Worksheet\MemoryDrawing::class, |
175
|
|
|
'PHPExcel_Worksheet_PageMargins' => \PhpOffice\PhpSpreadsheet\Worksheet\PageMargins::class, |
176
|
|
|
'PHPExcel_Worksheet_PageSetup' => \PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::class, |
177
|
|
|
'PHPExcel_Worksheet_Protection' => \PhpOffice\PhpSpreadsheet\Worksheet\Protection::class, |
178
|
|
|
'PHPExcel_Worksheet_Row' => \PhpOffice\PhpSpreadsheet\Worksheet\Row::class, |
179
|
|
|
'PHPExcel_Worksheet_RowCellIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\RowCellIterator::class, |
180
|
|
|
'PHPExcel_Worksheet_RowDimension' => \PhpOffice\PhpSpreadsheet\Worksheet\RowDimension::class, |
181
|
|
|
'PHPExcel_Worksheet_RowIterator' => \PhpOffice\PhpSpreadsheet\Worksheet\RowIterator::class, |
182
|
|
|
'PHPExcel_Worksheet_SheetView' => \PhpOffice\PhpSpreadsheet\Worksheet\SheetView::class, |
183
|
|
|
'PHPExcel_Writer_Abstract' => \PhpOffice\PhpSpreadsheet\Writer\BaseWriter::class, |
184
|
|
|
'PHPExcel_Writer_CSV' => \PhpOffice\PhpSpreadsheet\Writer\Csv::class, |
185
|
|
|
'PHPExcel_Writer_Exception' => \PhpOffice\PhpSpreadsheet\Writer\Exception::class, |
186
|
|
|
'PHPExcel_Writer_HTML' => \PhpOffice\PhpSpreadsheet\Writer\Html::class, |
187
|
|
|
'PHPExcel_Writer_IWriter' => \PhpOffice\PhpSpreadsheet\Writer\IWriter::class, |
188
|
|
|
'PHPExcel_Writer_OpenDocument' => \PhpOffice\PhpSpreadsheet\Writer\Ods::class, |
189
|
|
|
'PHPExcel_Writer_PDF' => \PhpOffice\PhpSpreadsheet\Writer\Pdf::class, |
190
|
|
|
'PHPExcel_Writer_Excel5' => \PhpOffice\PhpSpreadsheet\Writer\Xls::class, |
191
|
|
|
'PHPExcel_Writer_Excel2007' => \PhpOffice\PhpSpreadsheet\Writer\Xlsx::class, |
192
|
|
|
'PHPExcel_CachedObjectStorageFactory' => \PhpOffice\PhpSpreadsheet\Collection\CellsFactory::class, |
193
|
|
|
'PHPExcel_Calculation' => \PhpOffice\PhpSpreadsheet\Calculation\Calculation::class, |
194
|
|
|
'PHPExcel_Cell' => \PhpOffice\PhpSpreadsheet\Cell\Cell::class, |
195
|
|
|
'PHPExcel_Chart' => \PhpOffice\PhpSpreadsheet\Chart\Chart::class, |
196
|
|
|
'PHPExcel_Comment' => \PhpOffice\PhpSpreadsheet\Comment::class, |
197
|
|
|
'PHPExcel_Exception' => \PhpOffice\PhpSpreadsheet\Exception::class, |
198
|
|
|
'PHPExcel_HashTable' => \PhpOffice\PhpSpreadsheet\HashTable::class, |
199
|
|
|
'PHPExcel_IComparable' => \PhpOffice\PhpSpreadsheet\IComparable::class, |
200
|
|
|
'PHPExcel_IOFactory' => \PhpOffice\PhpSpreadsheet\IOFactory::class, |
201
|
|
|
'PHPExcel_NamedRange' => \PhpOffice\PhpSpreadsheet\NamedRange::class, |
202
|
|
|
'PHPExcel_ReferenceHelper' => \PhpOffice\PhpSpreadsheet\ReferenceHelper::class, |
203
|
|
|
'PHPExcel_RichText' => \PhpOffice\PhpSpreadsheet\RichText\RichText::class, |
204
|
|
|
'PHPExcel_Settings' => \PhpOffice\PhpSpreadsheet\Settings::class, |
205
|
|
|
'PHPExcel_Style' => \PhpOffice\PhpSpreadsheet\Style\Style::class, |
206
|
|
|
'PHPExcel_Worksheet' => \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::class, |
207
|
|
|
]; |
208
|
|
|
|
209
|
|
|
$methods = [ |
210
|
1 |
|
'MINUTEOFHOUR' => 'MINUTE', |
211
|
|
|
'SECONDOFMINUTE' => 'SECOND', |
212
|
|
|
'DAYOFWEEK' => 'WEEKDAY', |
213
|
|
|
'WEEKOFYEAR' => 'WEEKNUM', |
214
|
|
|
'ExcelToPHPObject' => 'excelToDateTimeObject', |
215
|
|
|
'ExcelToPHP' => 'excelToTimestamp', |
216
|
|
|
'FormattedPHPToExcel' => 'formattedPHPToExcel', |
217
|
|
|
'Cell::absoluteCoordinate' => 'Coordinate::absoluteCoordinate', |
218
|
|
|
'Cell::absoluteReference' => 'Coordinate::absoluteReference', |
219
|
|
|
'Cell::buildRange' => 'Coordinate::buildRange', |
220
|
|
|
'Cell::columnIndexFromString' => 'Coordinate::columnIndexFromString', |
221
|
|
|
'Cell::coordinateFromString' => 'Coordinate::coordinateFromString', |
222
|
|
|
'Cell::extractAllCellReferencesInRange' => 'Coordinate::extractAllCellReferencesInRange', |
223
|
|
|
'Cell::getRangeBoundaries' => 'Coordinate::getRangeBoundaries', |
224
|
|
|
'Cell::mergeRangesInCollection' => 'Coordinate::mergeRangesInCollection', |
225
|
|
|
'Cell::rangeBoundaries' => 'Coordinate::rangeBoundaries', |
226
|
|
|
'Cell::rangeDimension' => 'Coordinate::rangeDimension', |
227
|
|
|
'Cell::splitRange' => 'Coordinate::splitRange', |
228
|
|
|
'Cell::stringFromColumnIndex' => 'Coordinate::stringFromColumnIndex', |
229
|
|
|
]; |
230
|
|
|
|
231
|
|
|
// Keep '\' prefix for class names |
232
|
1 |
|
$prefixedClasses = []; |
233
|
1 |
|
foreach ($classes as $key => &$value) { |
234
|
1 |
|
$value = str_replace('PhpOffice\\', '\\PhpOffice\\', $value); |
235
|
1 |
|
$prefixedClasses['\\' . $key] = $value; |
236
|
|
|
} |
237
|
1 |
|
$mapping = $prefixedClasses + $classes + $methods; |
238
|
|
|
|
239
|
1 |
|
return $mapping; |
240
|
|
|
} |
241
|
|
|
|
242
|
|
|
/** |
243
|
|
|
* Search in all files in given directory. |
244
|
|
|
* |
245
|
|
|
* @param string $path |
246
|
|
|
*/ |
247
|
|
|
private function recursiveReplace($path) |
248
|
|
|
{ |
249
|
|
|
$patterns = [ |
250
|
|
|
'/*.md', |
251
|
|
|
'/*.txt', |
252
|
|
|
'/*.TXT', |
253
|
|
|
'/*.php', |
254
|
|
|
'/*.phpt', |
255
|
|
|
'/*.php3', |
256
|
|
|
'/*.php4', |
257
|
|
|
'/*.php5', |
258
|
|
|
'/*.phtml', |
259
|
|
|
]; |
260
|
|
|
|
261
|
|
|
$from = array_keys($this->getMapping()); |
262
|
|
|
$to = array_values($this->getMapping()); |
263
|
|
|
|
264
|
|
|
foreach ($patterns as $pattern) { |
265
|
|
|
foreach (glob($path . $pattern) as $file) { |
266
|
|
|
if (strpos($path, '/vendor/') !== false) { |
267
|
|
|
echo $file . " skipped\n"; |
268
|
|
|
|
269
|
|
|
continue; |
270
|
|
|
} |
271
|
|
|
$original = file_get_contents($file); |
272
|
|
|
$converted = str_replace($from, $to, $original); |
|
|
|
|
273
|
|
|
|
274
|
|
|
// The string "PHPExcel" gets special treatment because of how common it might be. |
275
|
|
|
// This regex requires a word boundary around the string, and it can't be |
276
|
|
|
// preceded by $ or -> (goal is to filter out cases where a variable is named $PHPExcel or similar) |
277
|
|
|
$converted = preg_replace('/(?<!\$|->)\bPHPExcel\b/', \PhpOffice\PhpSpreadsheet\Spreadsheet::class, $original); |
278
|
|
|
|
279
|
|
|
if ($original !== $converted) { |
280
|
|
|
echo $file . " converted\n"; |
281
|
|
|
file_put_contents($file, $converted); |
282
|
|
|
} |
283
|
|
|
} |
284
|
|
|
} |
285
|
|
|
|
286
|
|
|
// Do the recursion in subdirectory |
287
|
|
|
foreach (glob($path . '/*', GLOB_ONLYDIR) as $subpath) { |
288
|
|
|
if (strpos($subpath, $path . '/') === 0) { |
289
|
|
|
$this->recursiveReplace($subpath); |
290
|
|
|
} |
291
|
|
|
} |
292
|
|
|
} |
293
|
|
|
|
294
|
|
|
public function migrate() |
295
|
|
|
{ |
296
|
|
|
$path = realpath(getcwd()); |
297
|
|
|
echo 'This will search and replace recursively in ' . $path . PHP_EOL; |
298
|
|
|
echo 'You MUST backup your files first, or you risk losing data.' . PHP_EOL; |
299
|
|
|
echo 'Are you sure ? (y/n)'; |
300
|
|
|
|
301
|
|
|
$confirm = fread(STDIN, 1); |
302
|
|
|
if ($confirm === 'y') { |
303
|
|
|
$this->recursiveReplace($path); |
304
|
|
|
} |
305
|
|
|
} |
306
|
|
|
} |
307
|
|
|
|