Skip to content

Commit 7633fd5

Browse files
committed
Merge branch 'feature/2.8'
2 parents f24d2dd + a09dd58 commit 7633fd5

File tree

13 files changed

+55
-44
lines changed

13 files changed

+55
-44
lines changed

src/Database/PicoPageData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public function __construct(
201201
$this->stmt = $stmt;
202202
$this->entity = $entity;
203203
$this->className = $entity !== null ? get_class($entity) : null;
204-
$this->subqueryMap = $subqueryMap !== null ? $subqueryMap : [];
204+
$this->subqueryMap = $subqueryMap !== null ? $subqueryMap : array();
205205
}
206206

207207
/**

src/Geometry/Area.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class Area
6464
public function __construct($object, $zoom = 1, $href = null, $attributes = null)
6565
{
6666
$this->href = $href;
67-
$this->attributes = is_array($attributes) ? $attributes : [];
67+
$this->attributes = is_array($attributes) ? $attributes : array();
6868
$this->zoom = $zoom;
6969

7070
if ($object instanceof Rectangle) {

src/Geometry/LatLngBounds.php

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class LatLngBounds
1616
/**
1717
* @var LatBounds The latitude bounds of the bounding box.
1818
*/
19-
protected $_LatBounds; // NOSONAR
19+
protected $_latBounds; // NOSONAR
2020

2121
/**
2222
* @var LngBounds The longitude bounds of the bounding box.
2323
*/
24-
protected $_LngBounds; // NOSONAR
24+
protected $_lngBounds; // NOSONAR
2525

2626
/**
2727
* LatLngBounds constructor.
@@ -48,26 +48,26 @@ public function __construct($latLngSw = null, $tatLngNe = null)
4848
{
4949
$sw = SphericalGeometry::clampLatitude($latLngSw->getLat());
5050
$ne = SphericalGeometry::clampLatitude($tatLngNe->getLat());
51-
$this->_LatBounds = new LatBounds($sw, $ne);
51+
$this->_latBounds = new LatBounds($sw, $ne);
5252

5353
$sw = $latLngSw->getLng();
5454
$ne = $tatLngNe->getLng();
5555

5656
if ($ne - $sw >= 360)
5757
{
58-
$this->_LngBounds = new LngBounds(-180, 180);
58+
$this->_lngBounds = new LngBounds(-180, 180);
5959
}
6060
else
6161
{
6262
$sw = SphericalGeometry::wrapLongitude($latLngSw->getLng());
6363
$ne = SphericalGeometry::wrapLongitude($tatLngNe->getLng());
64-
$this->_LngBounds = new LngBounds($sw, $ne);
64+
$this->_lngBounds = new LngBounds($sw, $ne);
6565
}
6666
}
6767
else
6868
{
69-
$this->_LatBounds = new LatBounds(1, -1);
70-
$this->_LngBounds = new LngBounds(180, -180);
69+
$this->_latBounds = new LatBounds(1, -1);
70+
$this->_lngBounds = new LngBounds(180, -180);
7171
}
7272
}
7373

@@ -78,7 +78,7 @@ public function __construct($latLngSw = null, $tatLngNe = null)
7878
*/
7979
public function getLatBounds()
8080
{
81-
return $this->_LatBounds;
81+
return $this->_latBounds;
8282
}
8383

8484
/**
@@ -88,7 +88,7 @@ public function getLatBounds()
8888
*/
8989
public function getLngBounds()
9090
{
91-
return $this->_LngBounds;
91+
return $this->_lngBounds;
9292
}
9393

9494
/**
@@ -98,7 +98,7 @@ public function getLngBounds()
9898
*/
9999
public function getCenter()
100100
{
101-
return new LatLng($this->_LatBounds->getMidpoint(), $this->_LngBounds->getMidpoint());
101+
return new LatLng($this->_latBounds->getMidpoint(), $this->_lngBounds->getMidpoint());
102102
}
103103

104104
/**
@@ -108,7 +108,7 @@ public function getCenter()
108108
*/
109109
public function isEmpty()
110110
{
111-
return $this->_LatBounds->isEmpty() || $this->_LngBounds->isEmpty();
111+
return $this->_latBounds->isEmpty() || $this->_lngBounds->isEmpty();
112112
}
113113

114114
/**
@@ -118,7 +118,7 @@ public function isEmpty()
118118
*/
119119
public function getSouthWest()
120120
{
121-
return new LatLng($this->_LatBounds->getSw(), $this->_LngBounds->getSw(), true);
121+
return new LatLng($this->_latBounds->getSw(), $this->_lngBounds->getSw(), true);
122122
}
123123

124124
/**
@@ -128,7 +128,7 @@ public function getSouthWest()
128128
*/
129129
public function getNorthEast()
130130
{
131-
return new LatLng($this->_LatBounds->getNe(), $this->_LngBounds->getNe(), true);
131+
return new LatLng($this->_latBounds->getNe(), $this->_lngBounds->getNe(), true);
132132
}
133133

134134
/**
@@ -138,19 +138,19 @@ public function getNorthEast()
138138
*/
139139
public function toSpan()
140140
{
141-
if ($this->_LatBounds->isEmpty()) {
141+
if ($this->_latBounds->isEmpty()) {
142142
$lat = 0;
143143
} else {
144-
$lat = $this->_LatBounds->getNe() - $this->_LatBounds->getSw();
144+
$lat = $this->_latBounds->getNe() - $this->_latBounds->getSw();
145145
}
146146

147-
if ($this->_LngBounds->isEmpty()) {
147+
if ($this->_lngBounds->isEmpty()) {
148148
$lng = 0;
149149
} else {
150-
if ($this->_LngBounds->getSw() > $this->_LngBounds->getNe()) {
151-
$lng = 360 - ($this->_LngBounds->getSw() - $this->_LngBounds->getNe());
150+
if ($this->_lngBounds->getSw() > $this->_lngBounds->getNe()) {
151+
$lng = 360 - ($this->_lngBounds->getSw() - $this->_lngBounds->getNe());
152152
} else {
153-
$lng = $this->_LngBounds->getNe() - $this->_LngBounds->getSw();
153+
$lng = $this->_lngBounds->getNe() - $this->_lngBounds->getSw();
154154
}
155155
}
156156

@@ -190,8 +190,8 @@ public function equals($latLngBounds)
190190
{
191191
return !$latLngBounds
192192
? false
193-
: $this->_LatBounds->equals($latLngBounds->getLatBounds())
194-
&& $this->_LngBounds->equals($latLngBounds->getLngBounds());
193+
: $this->_latBounds->equals($latLngBounds->getLatBounds())
194+
&& $this->_lngBounds->equals($latLngBounds->getLngBounds());
195195
}
196196

197197
/**
@@ -202,8 +202,8 @@ public function equals($latLngBounds)
202202
*/
203203
public function intersects($latLngBounds)
204204
{
205-
return $this->_LatBounds->intersects($latLngBounds->getLatBounds())
206-
&& $this->_LngBounds->intersects($latLngBounds->getLngBounds());
205+
return $this->_latBounds->intersects($latLngBounds->getLatBounds())
206+
&& $this->_lngBounds->intersects($latLngBounds->getLngBounds());
207207
}
208208

209209
/**
@@ -227,8 +227,8 @@ public function union($latLngBounds)
227227
*/
228228
public function contains($latLng)
229229
{
230-
return $this->_LatBounds->contains($latLng->getLat())
231-
&& $this->_LngBounds->contains($latLng->getLng());
230+
return $this->_latBounds->contains($latLng->getLat())
231+
&& $this->_lngBounds->contains($latLng->getLng());
232232
}
233233

234234
/**
@@ -239,8 +239,8 @@ public function contains($latLng)
239239
*/
240240
public function extend($latLng)
241241
{
242-
$this->_LatBounds->extend($latLng->getLat());
243-
$this->_LngBounds->extend($latLng->getLng());
242+
$this->_latBounds->extend($latLng->getLat());
243+
$this->_lngBounds->extend($latLng->getLng());
244244
return $this;
245245
}
246246
}

src/Geometry/Line.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace MagicObject\Geometry;
44

5+
use InvalidArgumentException;
6+
57
/**
68
* Class representing a Line with two Point objects.
79
*
@@ -33,11 +35,11 @@ class Line {
3335
*
3436
* @param Point $a Point A.
3537
* @param Point $b Point B.
36-
* @throws \InvalidArgumentException If the parameters are not instances of Point.
38+
* @throws InvalidArgumentException If the parameters are not instances of Point.
3739
*/
3840
public function __construct($a, $b) {
3941
if (!$a instanceof Point || !$b instanceof Point) {
40-
throw new \InvalidArgumentException('Both parameters must be instances of Point.');
42+
throw new InvalidArgumentException('Both parameters must be instances of Point.');
4143
}
4244
$this->a = $a;
4345
$this->b = $b;

src/Geometry/Point.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace MagicObject\Geometry;
44

5+
use InvalidArgumentException;
6+
57
/**
68
* Class representing a Point with x and y coordinates.
79
*
@@ -48,13 +50,13 @@ public function __construct($x, $y)
4850
*
4951
* @param Point $p Another Point.
5052
* @return float The distance between the two Points.
51-
* @throws \InvalidArgumentException If the argument is not of type Point.
53+
* @throws InvalidArgumentException If the argument is not of type Point.
5254
*/
5355
public function distanceFrom($p)
5456
{
5557
// Ensure $p is an instance of Point
5658
if (!$p instanceof Point) {
57-
throw new \InvalidArgumentException('Argument must be of type Point.');
59+
throw new InvalidArgumentException('Argument must be of type Point.');
5860
}
5961

6062
$dx = $this->x - $p->x;

src/Getter.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ class Getter extends stdClass
4040
*/
4141
private $_classParams = array(); // NOSONAR
4242

43-
4443
/**
4544
* Constructor that initializes class parameters based on annotations.
4645
*/

src/MagicObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ protected function executeNativeQuery()
797797
$traceCaller = $trace[1];
798798

799799
// Extract the caller's parameters
800-
$callerParamValues = isset($traceCaller['args']) ? $traceCaller['args'] : [];
800+
$callerParamValues = isset($traceCaller['args']) ? $traceCaller['args'] : array();
801801

802802
// Get the caller's function and class names
803803
$callerFunctionName = $traceCaller['function'];

src/Pagination/PicoPagination.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public static function getPageUrl($page, $parameterName = 'page', $path = null)
198198
$path = $path === null ? trim($paths[0]) : $path;
199199
$urls[] = $path;
200200

201-
$urlParameters = isset($_GET) ? $_GET : [];
201+
$urlParameters = isset($_GET) ? $_GET : array();
202202
$urlParameters[$parameterName] = $page; // Replace the page parameter
203203

204204
// Build the query string

src/Util/ClassUtil/PicoObjectParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,11 @@ public static function parseRecursiveArray($data)
182182
{
183183
foreach($data as $val)
184184
{
185-
if (self::isObject($val))
185+
if(self::isObject($val))
186186
{
187187
$result[] = self::parseRecursiveObject($val);
188188
}
189-
else if (is_array($val))
189+
else if(is_array($val))
190190
{
191191
if(self::hasStringKeys($val))
192192
{

src/Util/Database/PicoSqlParser.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,15 +214,23 @@ public function getResult()
214214

215215
/**
216216
* Initializes the list of valid SQL data types supported by the parser.
217-
*
218-
* This method sets the list of data types that the parser recognizes, such as `varchar`, `int`, `timestamp`, etc.
217+
*
218+
* This method sets the list of data types that the parser recognizes, such as `varchar`, `int`, `timestamp`, `boolean`,
219+
* `json`, `uuid`, etc. These data types correspond to common column types in various SQL-based databases like PostgreSQL,
220+
* MySQL, and SQLite. The list may be used to validate or process SQL statements when parsing or generating SQL.
221+
*
222+
* @return void
219223
*/
220224
public function init()
221225
{
222-
$typeList = 'timestamp,serial4,bigserial,int2,int4,int8,tinyint,bigint,text,varchar,char,real,float,integer,int,datetime,date,double';
226+
// List of valid SQL data types that the parser will recognize
227+
$typeList = 'timestamp,serial4,bigserial,int2,int4,int8,tinyint,bigint,text,varchar,char,real,float,integer,int,datetime,date,double,boolean,json,uuid,bytea,money,decimal,numeric,blob,clob';
228+
229+
// Splitting the string into an array of data types
223230
$this->typeList = explode(',', $typeList);
224231
}
225232

233+
226234
/**
227235
* Parses all `CREATE TABLE` statements in the provided SQL text.
228236
*

0 commit comments

Comments
 (0)