fwk /
Db
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 | * Fwk |
||
| 4 | * |
||
| 5 | * Copyright (c) 2011-2014, Julien Ballestracci <[email protected]>. |
||
| 6 | * All rights reserved. |
||
| 7 | * |
||
| 8 | * For the full copyright and license information, please view the LICENSE |
||
| 9 | * file that was distributed with this source code. |
||
| 10 | * |
||
| 11 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
||
| 12 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
||
| 13 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
||
| 14 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
||
| 15 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
||
| 16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
||
| 17 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
| 18 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
||
| 19 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
||
| 20 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
||
| 21 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
||
| 22 | * POSSIBILITY OF SUCH DAMAGE. |
||
| 23 | * |
||
| 24 | * PHP Version 5.3 |
||
| 25 | * |
||
| 26 | * @category Database |
||
| 27 | * @package Fwk |
||
| 28 | * @subpackage Db |
||
| 29 | * @author Julien Ballestracci <[email protected]> |
||
| 30 | * @copyright 2011-2014 Julien Ballestracci <[email protected]> |
||
| 31 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||
| 32 | * @link http://www.nitronet.org/fwk |
||
| 33 | */ |
||
| 34 | namespace Fwk\Db\Events; |
||
| 35 | |||
| 36 | use Fwk\Db\Query; |
||
| 37 | use Fwk\Db\QueryBridge; |
||
| 38 | use Fwk\Events\Event; |
||
| 39 | use Fwk\Db\Connection; |
||
| 40 | |||
| 41 | /** |
||
| 42 | * This event is fired before a Query is sent to be executed by the Connection |
||
| 43 | * |
||
| 44 | * @category Events |
||
| 45 | * @package Fwk\Db |
||
| 46 | * @author Julien Ballestracci <[email protected]> |
||
| 47 | * @license http://www.opensource.org/licenses/bsd-license.php BSD License |
||
| 48 | * @link http://www.nitronet.org/fwk |
||
| 49 | */ |
||
| 50 | class BeforeQueryEvent extends Event |
||
| 51 | { |
||
| 52 | const EVENT_NAME = 'beforeQuery'; |
||
| 53 | |||
| 54 | /** |
||
| 55 | * Constructor |
||
| 56 | * |
||
| 57 | * @param Connection $connection The DB Connection |
||
| 58 | * @param Query $query The Query |
||
| 59 | * @param array $queryParams Query Parameters |
||
| 60 | * @param array $queryOptions Query Options |
||
| 61 | * @param mixed $results Query results/pre-results |
||
| 62 | * |
||
| 63 | * @return void |
||
|
0 ignored issues
–
show
|
|||
| 64 | */ |
||
| 65 | public function __construct(Connection $connection, Query $query, |
||
| 66 | array $queryParams = array(), array $queryOptions = array(), |
||
| 67 | $results = null |
||
| 68 | ) { |
||
| 69 | parent::__construct( |
||
| 70 | static::EVENT_NAME, array( |
||
| 71 | 'connection' => $connection, |
||
| 72 | 'query' => $query, |
||
| 73 | 'queryParameters' => (array)$queryParams, |
||
| 74 | 'queryOptions' => (array)$queryOptions, |
||
| 75 | 'results' => $results, |
||
| 76 | 'bridge' => null |
||
| 77 | ) |
||
| 78 | ); |
||
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * Returns the Database Connection |
||
| 83 | * |
||
| 84 | * @return Connection |
||
| 85 | */ |
||
| 86 | public function getConnection() |
||
| 87 | { |
||
| 88 | return $this->connection; |
||
|
0 ignored issues
–
show
The property
connection does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 89 | } |
||
| 90 | |||
| 91 | /** |
||
| 92 | * Returns the Query |
||
| 93 | * |
||
| 94 | * @return Query |
||
| 95 | */ |
||
| 96 | public function getQuery() |
||
| 97 | { |
||
| 98 | return $this->query; |
||
|
0 ignored issues
–
show
The property
query does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 99 | } |
||
| 100 | |||
| 101 | /** |
||
| 102 | * Returns the Query's parameters (i.e values) |
||
| 103 | * |
||
| 104 | * @return array |
||
| 105 | */ |
||
| 106 | public function getQueryParameters() |
||
| 107 | { |
||
| 108 | return $this->queryParameters; |
||
|
0 ignored issues
–
show
The property
queryParameters does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 109 | } |
||
| 110 | |||
| 111 | /** |
||
| 112 | * Returns the Query's driver options |
||
| 113 | * |
||
| 114 | * @return array |
||
| 115 | */ |
||
| 116 | public function getQueryOptions() |
||
| 117 | { |
||
| 118 | return $this->queryOptions; |
||
|
0 ignored issues
–
show
The property
queryOptions does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 119 | } |
||
| 120 | |||
| 121 | /** |
||
| 122 | * Returns the Query's results (if any) |
||
| 123 | * |
||
| 124 | * @return mixed |
||
| 125 | */ |
||
| 126 | public function getResults() |
||
| 127 | { |
||
| 128 | return $this->results; |
||
|
0 ignored issues
–
show
The property
results does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 129 | } |
||
| 130 | |||
| 131 | /** |
||
| 132 | * Defines the Query |
||
| 133 | * |
||
| 134 | * @param Query $query The Query |
||
| 135 | * |
||
| 136 | * @return void |
||
| 137 | */ |
||
| 138 | public function setQuery(Query $query) |
||
| 139 | { |
||
| 140 | $this->query = $query; |
||
|
0 ignored issues
–
show
The property
query does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 141 | } |
||
| 142 | |||
| 143 | /** |
||
| 144 | * Defines Driver options for this query |
||
| 145 | * |
||
| 146 | * @param array $queryOptions Driver options for this query |
||
| 147 | * |
||
| 148 | * @return void |
||
| 149 | */ |
||
| 150 | public function setQueryOptions(array $queryOptions) |
||
| 151 | { |
||
| 152 | $this->queryOptions = $queryOptions; |
||
|
0 ignored issues
–
show
The property
queryOptions does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 153 | } |
||
| 154 | |||
| 155 | /** |
||
| 156 | * Defines parameters (i.e values) for the query |
||
| 157 | * |
||
| 158 | * @param array $queryParameters Parameters (values) for the Query |
||
| 159 | * |
||
| 160 | * @return void |
||
| 161 | */ |
||
| 162 | public function setQueryParameters(array $queryParameters) |
||
| 163 | { |
||
| 164 | $this->queryParameters = $queryParameters; |
||
|
0 ignored issues
–
show
The property
queryParameters does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 165 | } |
||
| 166 | |||
| 167 | /** |
||
| 168 | * Defines Results for this Query |
||
| 169 | * |
||
| 170 | * @param mixed $results Query's results |
||
| 171 | * |
||
| 172 | * @return void |
||
| 173 | */ |
||
| 174 | public function setResults($results) |
||
| 175 | { |
||
| 176 | $this->results = $results; |
||
|
0 ignored issues
–
show
The property
results does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 177 | } |
||
| 178 | |||
| 179 | /** |
||
| 180 | * Defines the QueryBridge for this query |
||
| 181 | * |
||
| 182 | * @param QueryBridge $bridge The QueryBridge used with this Query |
||
| 183 | * |
||
| 184 | * @return void |
||
| 185 | */ |
||
| 186 | public function setQueryBridge(QueryBridge $bridge) |
||
| 187 | { |
||
| 188 | $this->bridge = $bridge; |
||
|
0 ignored issues
–
show
The property
bridge does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __set, maybe consider adding a @property annotation.
Since your code implements the magic setter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
Since the property has write access only, you can use the @property-write annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 189 | } |
||
| 190 | |||
| 191 | /** |
||
| 192 | * Returns the defined QueryBridge for this Query |
||
| 193 | * |
||
| 194 | * @return QueryBridge |
||
| 195 | */ |
||
| 196 | public function getQueryBridge() |
||
| 197 | { |
||
| 198 | return $this->bridge; |
||
|
0 ignored issues
–
show
The property
bridge does not exist on object<Fwk\Db\Events\BeforeQueryEvent>. Since you implemented __get, maybe consider adding a @property annotation.
Since your code implements the magic getter <?php
/**
* @property int $x
* @property int $y
* @property string $text
*/
class MyLabel
{
private $properties;
private $allowedProperties = array('x', 'y', 'text');
public function __get($name)
{
if (isset($properties[$name]) && in_array($name, $this->allowedProperties)) {
return $properties[$name];
} else {
return null;
}
}
public function __set($name, $value)
{
if (in_array($name, $this->allowedProperties)) {
$properties[$name] = $value;
} else {
throw new \LogicException("Property $name is not defined.");
}
}
}
If the property has read access only, you can use the @property-read annotation instead. Of course, you may also just have mistyped another name, in which case you should fix the error. See also the PhpDoc documentation for @property. Loading history...
|
|||
| 199 | } |
||
| 200 | } |
Adding a
@returnannotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.