dateTime = $dateTime; $this->fileFactory = $fileFactory; $this->collectInfo = $collectInfo; $this->serializer = $serializer; } /** * Create json file with debug info. * * @throws \Exception */ public function execute() { $date = $this->dateTime->date('Y-m-d_H-i-s'); $zipFileName = 'debug_info_' . $date . '.json'; $debugInfo = $this->collectInfo->execute(); $this->fileFactory->create( $zipFileName, [ 'type' => 'string', 'value' => $this->serializer->serialize($debugInfo), 'rm' => true ], DirectoryList::VAR_EXPORT, 'json', null ); } }