This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace AlgoWeb\ModelViews\Database; |
||
3 | |||
4 | use Illuminate\Database\Connection as BaseConnection; |
||
5 | use Illuminate\Database\Eloquent\Model; |
||
6 | |||
7 | class Connection extends BaseConnection |
||
0 ignored issues
–
show
|
|||
8 | { |
||
9 | protected static $classes = []; |
||
10 | |||
11 | protected static $information_schema = []; |
||
0 ignored issues
–
show
$information_schema does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
12 | |||
13 | public static function RegisterTableToProvide($ModelOfTable) |
||
0 ignored issues
–
show
function RegisterTableToProvide() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() $ModelOfTable does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() The parameter $ModelOfTable is not named in camelCase.
This check marks parameter names that have not been written in camelCase. In camelCase names are written without any punctuation, the start of each new word being marked
by a capital letter. Thus the name database connection string becomes ![]() This method is not in camel caps format.
This check looks for method names that are not written in camelCase. In camelCase names are written without any punctuation, the start of each new
word being marked by a capital letter. Thus the name
database connection seeker becomes ![]() |
|||
14 | { |
||
15 | self::$classes[] = $ModelOfTable; |
||
0 ignored issues
–
show
$ModelOfTable does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
16 | $currentISchemaTables = 0; |
||
17 | if(array_key_exists("tables",self::$information_schema)){ |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
tables does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
18 | $currentISchemaTables = count(self::$information_schema["tables"]); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
tables does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
19 | } else { |
||
20 | self::$information_schema["tables"] = []; |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
tables does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
21 | } |
||
22 | self::$information_schema["tables"][$currentISchemaTables]["Model"] = $ModelOfTable; |
||
0 ignored issues
–
show
$ModelOfTable does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
tables does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
Model does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
23 | self::$information_schema["tables"][$currentISchemaTables]["TABLE_NAME"] = $ModelOfTable::getTableName(); |
||
0 ignored issues
–
show
$ModelOfTable does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
tables does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
TABLE_NAME does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
24 | self::$information_schema["tables"][$currentISchemaTables]["TABLE_SCHEMA"] = \Config::get('database.connections.'.\Config::get('database.default').'.database'); |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
tables does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() Coding Style
Comprehensibility
introduced
by
The string literal
TABLE_SCHEMA does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
25 | } |
||
26 | |||
27 | protected $normalizer; |
||
28 | /** |
||
29 | * Run a select statement and return a single result. |
||
30 | * |
||
31 | * @param string $query |
||
32 | * @param array $bindings |
||
33 | * @return mixed |
||
34 | */ |
||
35 | public function selectOne($query, $bindings = array()) |
||
36 | { |
||
37 | $records = parent::select($query, $bindings); |
||
0 ignored issues
–
show
It seems like you call parent on a different method (
select() instead of selectOne() ). Are you sure this is correct? If so, you might want to change this to $this->select() .
This check looks for a call to a parent method whose name is different than the method from which it is called. Consider the following code: class Daddy
{
protected function getFirstName()
{
return "Eidur";
}
protected function getSurName()
{
return "Gudjohnsen";
}
}
class Son
{
public function getFirstName()
{
return parent::getSurname();
}
}
The ![]() |
|||
38 | return $records; |
||
39 | } |
||
40 | /** |
||
41 | * Run a select statement against the database. |
||
42 | * |
||
43 | * @param string $query |
||
44 | * @param array $bindings |
||
45 | * @return \Stidges\LaravelDbNormalizer\Collection |
||
0 ignored issues
–
show
Should the return type not be
array ? Also, consider making the array more specific, something like array<String> , or String[] .
This check compares the return type specified in the If the return type contains the type array, this check recommends the use of
a more specific type like ![]() |
|||
46 | */ |
||
47 | public function select($query, $bindings = array()) |
||
48 | { |
||
49 | |||
50 | //dd(self::$information_schema); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
86% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
51 | dd(self::getSQL($query,$bindings)); |
||
52 | $records = parent::select($query, $bindings); |
||
53 | dd($records); |
||
54 | return $records; |
||
55 | } |
||
56 | |||
57 | private function ProcessSQL($query,$results){ |
||
0 ignored issues
–
show
function ProcessSQL() does not seem to conform to the naming convention (^(?:[a-z]|__)[a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() This method is not in camel caps format.
This check looks for method names that are not written in camelCase. In camelCase names are written without any punctuation, the start of each new
word being marked by a capital letter. Thus the name
database connection seeker becomes ![]() |
|||
58 | |||
59 | } |
||
60 | |||
61 | private static function getSQL($sql, $bindings) |
||
62 | { |
||
63 | $needle = '?'; |
||
64 | foreach ($bindings as $replace){ |
||
65 | $pos = strpos($sql, $needle); |
||
66 | if ($pos !== false) { |
||
67 | if (gettype($replace) === "string") { |
||
0 ignored issues
–
show
Coding Style
Comprehensibility
introduced
by
The string literal
string does not require double quotes, as per coding-style, please use single quotes.
PHP provides two ways to mark string literals. Either with single quotes String literals in single quotes on the other hand are evaluated very literally and the only two
characters that needs escaping in the literal are the single quote itself ( Double quoted string literals may contain other variables or more complex escape sequences. <?php
$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";
print $doubleQuoted;
will print an indented: If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear. For more information on PHP string literals and available escape sequences see the PHP core documentation. ![]() |
|||
68 | $replace = ' "'.addslashes($replace).'" '; |
||
69 | } |
||
70 | $sql = substr_replace($sql, $replace, $pos, strlen($needle)); |
||
0 ignored issues
–
show
|
|||
71 | } |
||
72 | } |
||
73 | return $sql; |
||
74 | } |
||
75 | } |
||
76 |
This check marks property names that have not been written in camelCase.
In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes
databaseConnectionString
.