method create documentation in bbn\Appui\Ide

Creates a new file|directory

function(array $cfg) { if ( X::hasDeepProp($cfg, ['repository', 'path'], true) && X::hasProps($cfg, ['name', 'path'], true) && X::hasProps($cfg, ['is_file', 'extension', 'tab', 'tab_path']) ) { $path = $this->getRootPath($cfg['repository']['name']); if (($cfg['repository']['alias_code'] === 'bbn-project') && X::hasProp($cfg, 'template')) { switch ($cfg['template']) { case 'mvc_vue': return; break; case 'mvc_js': return; break; case 'mvc': return; break; case 'action': return; break; default: if (!empty($cfg['type'])) { if ($cfg['type'] === 'components') { $path .= $cfg['path'] . $cfg['name']; } if ($cfg['type'] === 'mvc') { if ($cfg['path'] === 'mvc/') { $path .= 'mvc/' . $cfg['tab_path']; } else { $path .= 'mvc/' . $cfg['tab_path'] . $cfg['path']; } } if (($cfg['type'] === 'lib') || ($cfg['type'] === 'cli')) { $path .= $cfg['path']; } } } } else { if (!empty($cfg['tab_path'])) { $path .= $cfg['tab_path']; } } if (($cfg['path'] !== './') && empty($cfg['type'])) { $path .= $cfg['path']; } // New folder if (empty($cfg['is_file'])) { if ($this->fs->isDir($path . $cfg['name'])) { $this->error(X::_("Directory exists")); return false; } if ((($cfg['repository']['alias_code'] !== 'bbn-project')) || (($cfg['repository']['alias_code'] === 'bbn-project') && !empty($cfg['type'])) && ($cfg['type'] !== 'components') ) { $path .= $cfg['name']; } if (empty($this->fs->createPath($path))) { $this->error(X::_("Impossible to create the directory")); return false; } return true; } // New file elseif (!empty($cfg['is_file']) && !empty($cfg['extension'])) { $file = $path . '/' . $cfg['name'] . '.' . $cfg['extension']; $file = str_replace('//', '/', $file); if (!$this->fs->isDir($path) && empty($this->fs->createPath($path))) { $this->error(X::_("Impossible to create the container directory")); return false; } if ($this->fs->isDir($path)) { if ($this->fs->isFile($file)) { $this->error(X::_("File exists")); return false; } if (!file_put_contents($file, $cfg['default_text'])) { $this->error(X::_("Impossible to create the file")); return false; } } // Add item to options table for permissions if ((empty($cfg['type']) || ($cfg['type'] !== 'components')) && !empty($cfg['tab']) && ($cfg['tab_url'] === 'php') && !empty($file) ) { if (!$this->createPermByReal($file)) { return $this->error(X::_("Impossible to create the option")); } } return true; } } return false; }

Creates a new file|directory BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.