...
"dependencies": {
"axios": "^0.19.0-beta.1",
"bootstrap-vue": "^2.0.0-rc.28",
"core-js": "^2.6.5",
"vue": "^2.6.10",
"vue-meta": "^2.2.1",
"vue-router": "^3.1.2",
"vue-toasted": "^1.1.27",
"vue2-storage": "^4.0.5",
"vuescroll": "^4.13.1",
"vuetify": "^2.0.7",
"vuex": "^3.0.1"
}
...
<?php
namespace Console\src\Command;
use Engine\Core\Console\Exception\FileAccessException;
use Engine\Core\Console\GeneratorCommand;
use Exception;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Class MakeController
* @package Console\src\Command
*/
class MakeController extends GeneratorCommand
{
protected static $defaultName = "app:make-controller";
/** @var string */
private $class_name;
/** @var string */
private $env;
private $stock;
/**
* MakeController constructor.
*/
public function __construct()
{
parent::__construct();
}
protected function configure()
{
$this
->setDescription("Controller creator")
->setHelp("This command generates a controller")
->addArgument("name", InputArgument::REQUIRED, "New class name")
->addArgument("env", InputArgument::REQUIRED, "The environment in which the new class will be created");
}
/**
* @param InputInterface $input
* @param OutputInterface $output
*
* @return int|void|null
* @throws Exception
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->env = $input->getArgument("env");
$this->class_name = $input->getArgument("name") . "Controller";
$namespace = $this->makeNamespace($this->env);
$this->stock = $this->getStock("controller");
$this->replace("namespace", $namespace);
$this->replace("class_name", $this->class_name);
$this->write($this->getRootDirController(ucfirst($this->env)) . "/$this->class_name.php", $this->stock);
$output->writeln([
'',
'================================================================================================',
' New controller created: <info>' . $this->class_name.'</>',
'================================================================================================',
'',
]);
}
/**
* @param $mask
* @param $new_value
* @return MakeController
*/
protected function replace($mask, $new_value)
{
$this->stock = str_replace("%$mask%", $new_value, $this->stock);
return $this;
}
/**
* @param string $env
* @return string
*/
protected function getRootDirController(string $env)
{
return ROOT_DIR . "/app/Http/Controller/$env";
}
/**
* @param string $rootNamespace
* @return string
*/
protected function getDefaultNamespace(string $rootNamespace = "")
{
return parent::getDefaultNamespace($rootNamespace) . "App\\Http\\Controllers";
}
/**
* @param string $env
* @return string
*/
protected function makeNamespace($env = "Api")
{
return $this->getDefaultNamespace() . "\\$env";
}
/**
* @param string $name
* @return string
* @throws FileAccessException
*/
protected function getStock(string $name)
{
$file_name = $this->getRootDir() . "/console/src/stock/class/$name";
if (!file_exists($file_name)) throw new FileAccessException("The file does not exist.");
return file_get_contents($file_name);
}
/**
* @param string $out_name
* @param $content
* @throws Exception
*/
protected function write(string $out_name, $content)
{
if (file_exists($out_name)) throw new Exception("Controller already exists!");
file_put_contents($out_name, $content);
}
}
<?php
namespace App\Http\Controllers\Api;
use App\Http\Controller;
/**
* Class UserController
* @package App\Http\Controllers\Api
*/
class UserController extends Controller
{
public function index()
{
// todo: Implement the index method
}
}
Всё же я думаю, что заражена сама система.
Есть какие инструменты для мониторинга трафик на сервере, наподобие какого нибудь сниффера?