Issues (36)

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.

Model/Dealer.php (2 issues)

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 Dealer\Model;
4
5
use Dealer\Model\Base\Dealer as BaseDealer;
6
use Propel\Runtime\ActiveQuery\Criteria;
7
use Propel\Runtime\Collection\Collection;
8
use Propel\Runtime\Collection\ObjectCollection;
9
use Propel\Runtime\Connection\ConnectionInterface;
10
use Dealer\Model\DealerShedulesQuery as ChildDealerShedulesQuery;
11
use Propel\Runtime\Exception\PropelException;
12
use Dealer\Model\DealerShedules as ChildDealerShedules;
13
14
class Dealer extends BaseDealer
15
{
16
17
    /**
18
     * @var        ObjectCollection|ChildDealerShedules[] Collection to store aggregation of ChildDealerShedules objects.
19
     */
20
    protected $collDealerDefaultSheduless;
21
22
    /**
23
     * @var        ObjectCollection|ChildDealerShedules[] Collection to store aggregation of ChildDealerShedules objects.
24
     */
25
    protected $collDealerExtraSheduless;
26
27
    /**
28
     * Initializes the collDealerSheduless collection.
29
     *
30
     * By default this just sets the collDealerSheduless collection to an empty array (like clearcollDealerSheduless());
31
     * however, you may wish to override this method in your stub class to provide setting appropriate
32
     * to your application -- for example, setting the initial array to the values stored in database.
33
     *
34
     * @param      boolean $overrideExisting If set to true, the method call initializes
35
     *                                        the collection even if it is not empty
36
     *
37
     * @return void
38
     */
39
    public function initDealerDefaultSheduless($overrideExisting = true)
40
    {
41
        if (null !== $this->collDealerDefaultSheduless && !$overrideExisting) {
42
            return;
43
        }
44
        $this->collDealerDefaultSheduless = new ObjectCollection();
45
        $this->collDealerDefaultSheduless->setModel('\Dealer\Model\DealerShedules');
46
    }
47
48
    /**
49
     * Initializes the collDealerSheduless collection.
50
     *
51
     * By default this just sets the collDealerSheduless collection to an empty array (like clearcollDealerSheduless());
52
     * however, you may wish to override this method in your stub class to provide setting appropriate
53
     * to your application -- for example, setting the initial array to the values stored in database.
54
     *
55
     * @param      boolean $overrideExisting If set to true, the method call initializes
56
     *                                        the collection even if it is not empty
57
     *
58
     * @return void
59
     */
60
    public function initDealerExtraSheduless($overrideExisting = true)
61
    {
62
        if (null !== $this->collDealerExtraSheduless && !$overrideExisting) {
63
            return;
64
        }
65
        $this->collDealerExtraSheduless = new ObjectCollection();
66
        $this->collDealerExtraSheduless->setModel('\Dealer\Model\DealerShedules');
67
    }
68
69
    /**
70
     * Gets an array of ChildDealerShedules objects which contain a foreign key that references this object.
71
     *
72
     * If the $criteria is not null, it is used to always fetch the results from the database.
73
     * Otherwise the results are fetched from the database the first time, then cached.
74
     * Next time the same method is called without $criteria, the cached collection is returned.
75
     * If this ChildDealer is new, it will return
76
     * an empty collection or the current collection; the criteria is ignored on a new object.
77
     *
78
     * @param      Criteria $criteria optional Criteria object to narrow the query
79
     * @param      ConnectionInterface $con optional connection object
80
     * @return Collection|ChildDealerShedules[] List of ChildDealerShedules objects
81
     * @throws PropelException
82
     */
83
    public function getDefaultSchedules($criteria = null, ConnectionInterface $con = null)
84
    {
85
        $partial = $this->collDealerShedulessPartial && !$this->isNew();
86
        if (null === $this->collDealerDefaultSheduless || null !== $criteria || $partial) {
87
            if ($this->isNew() && null === $this->collDealerDefaultSheduless) {
88
                // return empty collection
89
                $this->initDealerDefaultSheduless();
90
            } else {
91
                $collDealerSheduless = ChildDealerShedulesQuery::create(null, $criteria)
92
                    ->filterByDealer($this)
93
                    ->filterByPeriodNull()
94
                    ->find($con);
95
96
                if (null !== $criteria) {
97
                    if (false !== $this->collDealerShedulessPartial && count($collDealerSheduless)) {
98
                        $this->initDealerDefaultSheduless(false);
99
100
                        foreach ($collDealerSheduless as $obj) {
101
                            if (false == $this->collDealerDefaultSheduless->contains($obj)) {
102
                                $this->collDealerDefaultSheduless->append($obj);
103
                            }
104
                        }
105
106
                        $this->collDealerShedulessPartial = true;
107
                    }
108
109
                    reset($collDealerSheduless);
110
111
                    return $collDealerSheduless;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $collDealerSheduless; (array) is incompatible with the return type documented by Dealer\Model\Dealer::getDefaultSchedules of type Propel\Runtime\Collectio...\Model\DealerShedules[].

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 my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
112
                }
113
114
                if ($partial && $this->collDealerDefaultSheduless) {
115
                    foreach ($this->collDealerDefaultSheduless as $obj) {
116
                        if ($obj->isNew()) {
117
                            $collDealerSheduless[] = $obj;
118
                        }
119
                    }
120
                }
121
122
                $this->collDealerDefaultSheduless = $collDealerSheduless;
123
                $this->collDealerShedulessPartial = false;
124
            }
125
        }
126
127
        return $this->collDealerDefaultSheduless;
128
    }
129
130
    /**
131
     * Gets an array of ChildDealerShedules objects which contain a foreign key that references this object.
132
     *
133
     * If the $criteria is not null, it is used to always fetch the results from the database.
134
     * Otherwise the results are fetched from the database the first time, then cached.
135
     * Next time the same method is called without $criteria, the cached collection is returned.
136
     * If this ChildDealer is new, it will return
137
     * an empty collection or the current collection; the criteria is ignored on a new object.
138
     *
139
     * @param      Criteria $criteria optional Criteria object to narrow the query
140
     * @param      ConnectionInterface $con optional connection object
141
     * @return Collection|ChildDealerShedules[] List of ChildDealerShedules objects
142
     * @throws PropelException
143
     */
144
    public function getExtraSchedules($criteria = null, ConnectionInterface $con = null)
145
    {
146
        $partial = $this->collDealerShedulessPartial && !$this->isNew();
147
        if (null === $this->collDealerExtraSheduless || null !== $criteria || $partial) {
148
            if ($this->isNew() && null === $this->collDealerSheduless) {
149
                // return empty collection
150
                $this->initDealerExtraSheduless();
151
            } else {
152
                $collDealerSheduless = ChildDealerShedulesQuery::create(null, $criteria)
153
                    ->filterByDealer($this)
154
                    ->filterByPeriodNotNull()
155
                    ->find($con);
156
157
                if (null !== $criteria) {
158
                    if (false !== $this->collDealerShedulessPartial && count($collDealerSheduless)) {
159
                        $this->initDealerExtraSheduless(false);
160
161
                        foreach ($collDealerSheduless as $obj) {
162
                            if (false == $this->collDealerExtraSheduless->contains($obj)) {
163
                                $this->collDealerExtraSheduless->append($obj);
164
                            }
165
                        }
166
167
                        $this->collDealerShedulessPartial = true;
168
                    }
169
170
                    reset($collDealerSheduless);
171
172
                    return $collDealerSheduless;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $collDealerSheduless; (array) is incompatible with the return type documented by Dealer\Model\Dealer::getExtraSchedules of type Propel\Runtime\Collectio...\Model\DealerShedules[].

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 my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
173
                }
174
175
                if ($partial && $this->collDealerSheduless) {
176
                    foreach ($this->collDealerExtraSheduless as $obj) {
177
                        if ($obj->isNew()) {
178
                            $collDealerSheduless[] = $obj;
179
                        }
180
                    }
181
                }
182
183
                $this->collDealerExtraSheduless = $collDealerSheduless;
184
                $this->collDealerShedulessPartial = false;
185
            }
186
        }
187
188
        return $this->collDealerExtraSheduless;
189
    }
190
191
}
192