private function writeJsonToFile()
 {
     if (!$this->jsonData) {
         //if not loaded
         return false;
     }
     $folder = GitHubModule::Config()->get('absolute_temp_folder');
     $filename = $folder . '/' . $this->gitHubModuleInstance->ModuleName . '/composer.json';
     $file = fopen($filename, 'w');
     if ($file) {
         fwrite($file, json_encode($this->jsonData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
     }
     fclose($file);
     return true;
 }
 public static function get_or_create_github_module($moduleName)
 {
     $moduleName = trim($moduleName);
     $filter = array('ModuleName' => $moduleName);
     $gitHubModule = GitHubModule::get()->filter($filter)->first();
     if (!$gitHubModule) {
         $gitHubModule = GitHubModule::create($filter);
         $gitHubModule->write();
     }
     return $gitHubModule;
 }
 private function checkFile($module, $filename)
 {
     $folder = GitHubModule::Config()->get('absolute_temp_folder');
     return file_exists($folder . '/' . $module . '/' . $filename);
 }
 protected function getReadMeComponent($componentName)
 {
     $temp_dir = GitHubModule::Config()->get('absolute_temp_folder');
     $moduleName = $this->gitObject->ModuleName;
     $fileName = $temp_dir . '/' . $moduleName . '/docs/en/' . strtoupper($componentName) . '.md';
     set_error_handler(array($this, 'catchFopenWarning'), E_WARNING);
     $file = fopen($fileName, 'r');
     restore_error_handler();
     if ($file) {
         $content = fread($file, filesize($filename));
     } else {
         $content = "";
     }
 }