| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace  Onurb\Bundle\ExcelBundle\Controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Onurb\Bundle\ExcelBundle\Factory\ExcelFactory; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Symfony\Component\HttpFoundation\Response; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use PhpOffice\PhpSpreadsheet\Reader\IReader; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use PhpOffice\PhpSpreadsheet\Writer\IWriter; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  | class WrongParameterController extends Controller | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |     public function wrongTypeWriterAction() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |         // create an empty object | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |         $phpSpreadsheet = $this->createSpreadsheet(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |         // create the writer | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |         $this->get('phpspreadsheet')->createWriter($phpSpreadsheet, 'Wrong type'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |     public function wrongTypeReaderAction() | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |         // create the writer | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |         $this->get('phpspreadsheet')->createReader('Wrong type'); | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |      * utility class | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |      * @return mixed | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |     private function createSpreadsheet() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |         /** @var ExcelFactory $factory */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |         $factory = $this->get('phpspreadsheet'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         $spreadsheet = $factory->createSpreadsheet(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         $htmlHelper = $factory->createHelperHTML(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         $spreadsheet->getProperties()->setCreator("liuggio") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |             ->setLastModifiedBy("Giulio De Donato") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |             ->setTitle("Office 2005 XLSX Test Document") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |             ->setSubject("Office 2005 XLSX Test Document") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |             ->setDescription("Test document for Office 2005 XLSX, generated using PHP classes.") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |             ->setKeywords("office 2005 openxml php") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             ->setCategory("Test result file"); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $spreadsheet->setActiveSheetIndex(0) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |             ->setCellValue('A1', 'Hello') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |             ->setCellValue('B2', 'world!') | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |             ->setCellValue('C3', $htmlHelper->toRichTextObject('<b>In Bold!</b>')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         $spreadsheet->getActiveSheet()->setTitle('Simple'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         // Set active sheet index to the first sheet, so Excel opens this as the first sheet | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         $spreadsheet->setActiveSheetIndex(0); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |         return $spreadsheet; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 56 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 57 |  |  |  | 
            
                        
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.