Issues (53)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

sources/Generators/Commands/ModelMakeCommand.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace LaravelPlus\Extension\Generators\Commands;
4
5
use Jumilla\Generators\Laravel\OneFileGeneratorCommand as BaseCommand;
6
use Jumilla\Generators\FileGenerator;
7
use LaravelPlus\Extension\Addons\Addon;
8
use LaravelPlus\Extension\Generators\GeneratorCommandTrait;
9
use Illuminate\Support\Str;
10
11
class ModelMakeCommand extends BaseCommand
12
{
13
    use GeneratorCommandTrait;
14
15
    /**
16
     * The console command singature.
17
     *
18
     * @var stringphp
19
     */
20
    protected $signature = 'make:model
21
        {name : The name of the class}
22
        {--a|addon= : The name of the addon}
23
        {--m|migration= : Create a new migration file for the model}
24
    ';
25
26
    /**
27
     * The console command description.
28
     *
29
     * @var string
30
     */
31
    protected $description = '[+] Create a new Eloquent model class';
32
33
    /**
34
     * The type of class being generated.
35
     *
36
     * @var string
37
     */
38
    protected $type = 'Model';
39
40
    /**
41
     * The constructor.
42
     */
43 6
    public function __construct()
44
    {
45 6
        parent::__construct();
46
47 6
        $this->setStubDirectory(__DIR__.'/../stubs');
48 6
    }
49
50
    /**
51
     * Execute the console command.
52
     */
53 4
    public function handle()
54
    {
55 4
        $this->addon = $this->getAddon();
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getAddon() of type string is incompatible with the declared type object<LaravelPlus\Extension\Addons\Addon> of property $addon.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
56
57 3
        if (parent::handle() !== false) {
58 3
            if ($this->option('migration')) {
59 1
                $table = $this->toTable($this->argument('name'));
60
61 1
                $this->call('make:migration', [
62 1
                    'name' => $this->option('migration'),
63 1
                    '--addon' => $this->option('addon'),
64 1
                    '--create' => $table,
65
                ]);
66
            }
67
        }
68 3
    }
69
70
    /**
71
     * Get the default namespace for the class.
72
     *
73
     * @return string
74
     */
75 3
    protected function getDefaultNamespace()
76
    {
77 3
        return $this->getRootNamespace();
78
    }
79
80
    /**
81
     * Get the stub file for the generator.
82
     *
83
     * @return string
84
     */
85 3
    protected function getStub()
86
    {
87 3
        return 'model.stub';
88
    }
89
90
    /**
91
     * Generate file.
92
     *
93
     * @param \Jumilla\Generators\FileGenerator $generator
94
     * @param string $path
95
     * @param string $fqcn
96
     *
97
     * @return bool
98
     */
99 3
    protected function generateFile(FileGenerator $generator, $path, $fqcn)
100
    {
101 3
        list($namespace, $class) = $this->splitFullQualifyClassName($fqcn);
102
103 3
        return $generator->file($path)->template($this->getStub(), [
104 3
            'namespace' => $namespace,
105 3
            'class' => $class,
106 3
            'table' => $this->toTable($class),
107
        ]);
108
    }
109
110
    /**
111
     * Convert name to table.
112
     *
113
     * @param string $name
114
     *
115
     * @return string
116
     */
117 3
    protected function toTable($name)
118
    {
119 3
        return Str::plural(Str::snake(class_basename($name)));
120
    }
121
}
122