vendor/codeages/plugin-bundle/Command/PluginCreateCommand.php
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
<?php
namespace Codeages\PluginBundle\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;
use Sensio\Bundle\GeneratorBundle\Model\Bundle;
use Sensio\Bundle\GeneratorBundle\Command\GeneratorCommand;
use Sensio\Bundle\GeneratorBundle\Generator\BundleGenerator;
class PluginCreateCommand extends GeneratorCommand
{
protected function configure()
{
$this
->setName('plugin:create')
->addArgument('code', InputArgument::REQUIRED, 'Plugin code.')
->setDescription('Create plugin.');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$biz = $this->getContainer()->get('biz');
$code = $input->getArgument('code');
if (!$code) {
throw new \RuntimeException('Plugin code can not be null');
}
if (!preg_match('/^[a-zA-Z\s]+$/', $code)) {
throw new \RuntimeException('Plugin code should be English');
}
$name = ucfirst($code);
$pluginName = $name.'Plugin';
$rootDir = dirname($this->getContainer()->getParameter('kernel.root_dir'));
$output->writeln(sprintf('Create plugin <comment>%s</comment> :', $name));
$generator = $this->getGenerator();
$bundleObject = $this->createBundleObject($name);
$generator->generateBundle($bundleObject);
$errors = array();
$this->getQuestionHelper()->getRunner($output, $errors);
$dir = $bundleObject->getTargetDirectory();
//write jspn
$filename = $dir.'/plugin.json';
$data = '{
"code": "'.$name.'",
"name": "'.$name.'",
"description": "",
"author": "EduSoho官方",
"version": "1.0.0",
"support_version": "8.0.0"
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。