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 | |||
3 | namespace fuitad\LaravelCassandra\Eloquent; |
||
4 | |||
5 | use Carbon\Carbon; |
||
6 | use Cassandra\Timestamp; |
||
7 | use fuitad\LaravelCassandra\Query\Builder as QueryBuilder; |
||
8 | use Illuminate\Database\Eloquent\Model as BaseModel; |
||
9 | |||
10 | abstract class Model extends BaseModel |
||
11 | { |
||
12 | /** |
||
13 | * Indicates if the IDs are auto-incrementing. |
||
14 | * This is not possible in cassandra so we override this |
||
15 | * |
||
16 | * @var bool |
||
17 | */ |
||
18 | public $incrementing = false; |
||
19 | |||
20 | /** |
||
21 | * @inheritdoc |
||
22 | */ |
||
23 | public function newEloquentBuilder($query) |
||
24 | { |
||
25 | return new Builder($query); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @inheritdoc |
||
30 | */ |
||
31 | protected function newBaseQueryBuilder() |
||
32 | { |
||
33 | $connection = $this->getConnection(); |
||
34 | |||
35 | return new QueryBuilder($connection, $connection->getPostProcessor()); |
||
0 ignored issues
–
show
$connection->getPostProcessor() of type object<Illuminate\Databa...y\Processors\Processor> is not a sub-type of object<fuitad\LaravelCassandra\Query\Processor> . It seems like you assume a child class of the class Illuminate\Database\Query\Processors\Processor to be always present.
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass. Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type. ![]() |
|||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @inheritdoc |
||
40 | */ |
||
41 | public function freshTimestamp() |
||
42 | { |
||
43 | return new Timestamp(); |
||
0 ignored issues
–
show
The return type of
return new \Cassandra\Timestamp(); (Cassandra\Timestamp ) is incompatible with the return type of the parent method Illuminate\Database\Eloquent\Model::freshTimestamp of type Illuminate\Support\Carbon .
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function ![]() |
|||
44 | } |
||
45 | |||
46 | /** |
||
47 | * @inheritdoc |
||
48 | */ |
||
49 | public function fromDateTime($value) |
||
50 | { |
||
51 | // If the value is already a Timestamp instance, we don't need to parse it. |
||
52 | if ($value instanceof Timestamp) { |
||
0 ignored issues
–
show
The class
Cassandra\Timestamp does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
53 | return $value; |
||
0 ignored issues
–
show
The return type of
return $value; (Cassandra\Timestamp ) is incompatible with the return type of the parent method Illuminate\Database\Eloquent\Model::fromDateTime of type integer|string .
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function ![]() |
|||
54 | } |
||
55 | |||
56 | // Let Eloquent convert the value to a DateTime instance. |
||
57 | if (!$value instanceof DateTime) { |
||
0 ignored issues
–
show
The class
fuitad\LaravelCassandra\Eloquent\DateTime does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
58 | $value = parent::asDateTime($value); |
||
0 ignored issues
–
show
It seems like you call parent on a different method (
asDateTime() instead of fromDateTime() ). Are you sure this is correct? If so, you might want to change this to $this->asDateTime() .
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 ![]() |
|||
59 | } |
||
60 | |||
61 | return new Timestamp($value->getTimestamp() * 1000); |
||
0 ignored issues
–
show
The return type of
return new \Cassandra\Ti...getTimestamp() * 1000); (Cassandra\Timestamp ) is incompatible with the return type of the parent method Illuminate\Database\Eloquent\Model::fromDateTime of type integer|string .
If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design. Let’s take a look at an example: class Author {
private $name;
public function __construct($name) {
$this->name = $name;
}
public function getName() {
return $this->name;
}
}
abstract class Post {
public function getAuthor() {
return 'Johannes';
}
}
class BlogPost extends Post {
public function getAuthor() {
return new Author('Johannes');
}
}
class ForumPost extends Post { /* ... */ }
function my_function(Post $post) {
echo strtoupper($post->getAuthor());
}
Our function ![]() |
|||
62 | } |
||
63 | |||
64 | /** |
||
65 | * @inheritdoc |
||
66 | */ |
||
67 | protected function asDateTime($value) |
||
68 | { |
||
69 | // Convert UTCDateTime instances. |
||
70 | if ($value instanceof Timestamp) { |
||
0 ignored issues
–
show
The class
Cassandra\Timestamp does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
71 | return Carbon::instance($value->toDateTime()); |
||
72 | } |
||
73 | |||
74 | return parent::asDateTime($value); |
||
75 | } |
||
76 | |||
77 | /** |
||
78 | * @inheritdoc |
||
79 | */ |
||
80 | protected function originalIsNumericallyEquivalent($key) |
||
81 | { |
||
82 | $current = $this->attributes[$key]; |
||
83 | $original = $this->original[$key]; |
||
84 | |||
85 | // Date comparison. |
||
86 | if (in_array($key, $this->getDates())) { |
||
87 | $current = $current instanceof Timestamp ? $this->asDateTime($current) : $current; |
||
0 ignored issues
–
show
The class
Cassandra\Timestamp does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
88 | $original = $original instanceof Timestamp ? $this->asDateTime($original) : $original; |
||
0 ignored issues
–
show
The class
Cassandra\Timestamp does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
89 | |||
90 | return $current == $original; |
||
91 | } |
||
92 | |||
93 | return parent::originalIsNumericallyEquivalent($key); |
||
94 | } |
||
95 | |||
96 | /** |
||
97 | * Get the table qualified key name. |
||
98 | * Cassandra does not support the table.column annotation so |
||
99 | * we override this |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | public function getQualifiedKeyName() |
||
104 | { |
||
105 | return $this->getKeyName(); |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * @inheritdoc |
||
110 | */ |
||
111 | public function __call($method, $parameters) |
||
112 | { |
||
113 | // Unset method |
||
114 | if ($method == 'unset') { |
||
115 | return call_user_func_array([$this, 'drop'], $parameters); |
||
116 | } |
||
117 | |||
118 | return parent::__call($method, $parameters); |
||
119 | } |
||
120 | } |
||
121 |
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.