/var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/bake/src/Command
NameSizeModeActions
AllCommand.php38990644editdlrm
BakeCommand.php77070644editdlrm
BehaviorCommand.php12380644editdlrm
CellCommand.php34180644editdlrm
CommandCommand.php12310644editdlrm
CommandHelperCommand.php12520644editdlrm
ComponentCommand.php12540644editdlrm
ControllerAllCommand.php27860644editdlrm
ControllerCommand.php94330644editdlrm
EntryCommand.php74160644editdlrm
FixtureAllCommand.php32580644editdlrm
FixtureCommand.php178000644editdlrm
FormCommand.php12070644editdlrm
HelperCommand.php12240644editdlrm
MailerCommand.php16910644editdlrm
MiddlewareCommand.php12490644editdlrm
ModelAllCommand.php27420644editdlrm
ModelCommand.php487300644editdlrm
PluginCommand.php147230644editdlrm
ShellHelperCommand.php12420644editdlrm
SimpleBakeCommand.php47930644editdlrm
TemplateAllCommand.php28420644editdlrm
TemplateCommand.php142920644editdlrm
TestCommand.php267160644editdlrm
Edit: /var/www/vhosts/ihelp.ro/httpdocs/vendor/cakephp/bake/src/Command/BakeCommand.php (7707B)
plugin = $plugin; } return $name; } /** * Get the prefix name. * * Handles camelcasing each namespace in the prefix path. * * @param \Cake\Console\Arguments $args Arguments instance to read the prefix option from. * @return string The inflected prefix path. */ protected function getPrefix(Arguments $args): string { $prefix = $args->getOption('prefix'); if (!$prefix) { return ''; } $parts = explode('/', $prefix); return implode('/', array_map([$this, '_camelize'], $parts)); } /** * Gets the path for output. Checks the plugin property * and returns the correct path. * * @param \Cake\Console\Arguments $args Arguments instance to read the prefix option from. * @return string Path to output. */ public function getPath(Arguments $args): string { $path = APP . $this->pathFragment; if ($this->plugin) { $path = $this->_pluginPath($this->plugin) . 'src/' . $this->pathFragment; } $prefix = $this->getPrefix($args); if ($prefix) { $path .= $prefix . DIRECTORY_SEPARATOR; } return str_replace('/', DIRECTORY_SEPARATOR, $path); } /** * Gets the path to the template path for the application or plugin. * * @param \Cake\Console\Arguments $args Arguments instance to read the prefix option from. * @param string|null $container The container directory in the templates directory. * @return string Path to output. */ public function getTemplatePath(Arguments $args, ?string $container = null): string { $paths = (array)Configure::read('App.paths.templates'); if (empty($paths)) { throw new InvalidArgumentException( 'Could not read template paths. ' . 'Ensure `App.paths.templates` is defined in your application configuration.' ); } $path = $paths[0]; if ($this->plugin) { $path = $this->_pluginPath($this->plugin) . 'templates' . DIRECTORY_SEPARATOR; } if ($container) { $path .= $container . DIRECTORY_SEPARATOR; } $prefix = $this->getPrefix($args); if ($prefix) { $path .= $prefix . DIRECTORY_SEPARATOR; } return str_replace('/', DIRECTORY_SEPARATOR, $path); } /** * Creates a new instance of TemplateRenderer with theme set. * * @return \Bake\Utility\TemplateRenderer */ public function createTemplateRenderer(): TemplateRenderer { $renderer = new TemplateRenderer($this->theme); EventManager::instance()->dispatch(new Event('Bake.renderer', $renderer)); return $renderer; } /** * Delete empty file in a given path * * @param string $path Path to folder which contains 'empty' file. * @param \Cake\Console\ConsoleIo $io ConsoleIo to delete file with. * @return void */ protected function deleteEmptyFile(string $path, ConsoleIo $io): void { if (file_exists($path)) { unlink($path); $io->out(sprintf('Deleted `%s`', $path), 1, ConsoleIo::NORMAL); } } /** * Check if a column name is valid. * * The Regex used here basically states that: * - the column name has to start with an ASCII character (lower or upper case) or an underscore and * - further characters are allowed to be either lower or upper case ASCII characters, numbers or underscores. * * @param string $name The name of the column. * @return bool */ protected function isValidColumnName(string $name): bool { return (bool)preg_match('/^[a-zA-Z_][a-zA-Z0-9_]*$/', $name); } /** * Parses a file if it exists. * * @param string $path File path * @return \Bake\CodeGen\ParsedFile|null */ protected function parseFile(string $path): ?ParsedFile { if (file_exists($path)) { return (new CodeParser())->parseFile(file_get_contents($path)); } return null; } /** * Write file contents out to path and prompt user with options with file exists. * * @param \Cake\Console\ConsoleIo $io Console io * @param string $path The path to create the file at * @param string $contents The contents to put into the file * @param bool $forceOverwrite Whether the file should be overwritten without prompting the user * @param bool $skipIfUnchnged Skip writing output if the contents match existing file * @return bool True if successful, false otherwise * @throws \Cake\Console\Exception\StopException When `q` is given as an answer * to whether a file should be overwritten. */ protected function writeFile( ConsoleIo $io, string $path, string $contents, bool $forceOverwrite = false, bool $skipIfUnchnged = true ): bool { if ($skipIfUnchnged && file_exists($path) && file_get_contents($path) === $contents) { $io->info("Skipping update to `{$path}`. It already exists and would not change."); return true; } return $io->createFile($path, $contents, $forceOverwrite); } }