Skip to content

Commit 0e698a4

Browse files
committed
Upgrade
1 parent 6961bba commit 0e698a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+213
-265
lines changed

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "floatphp/helpers",
3-
"version" : "1.3.3",
3+
"version" : "1.4.0",
44
"type": "library",
55
"description": "FloatPHP Helpers Components",
66
"keywords": ["floatphp","micro-framework","framework","PSR","ORM","jakiboy"],
@@ -17,10 +17,10 @@
1717
"php": ">=8.2",
1818
"phpfastcache/phpfastcache": "^9.2.3",
1919
"rakibtg/sleekdb": "^2.15",
20-
"floatphp/classes": "^1.3.0",
21-
"floatphp/interfaces": "^1.3.0",
22-
"floatphp/exceptions": "^1.3.0",
23-
"floatphp/kernel": "^1.3.0"
20+
"floatphp/classes": "^1.4.0",
21+
"floatphp/interfaces": "^1.4.0",
22+
"floatphp/exceptions": "^1.4.0",
23+
"floatphp/kernel": "^1.4.0"
2424
},
2525
"autoload": {
2626
"psr-4" : {

src/Connection/Config.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -59,9 +59,6 @@ public function __construct($key = self::KEY, $value = self::VALUE, $id = self::
5959
$this->valueColumn = $value;
6060
$this->key = $id;
6161
$this->table = $table;
62-
63-
// Reset config
64-
$this->resetConfig();
6562
}
6663

6764
/**

src/Connection/DataTable.php

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -25,8 +25,7 @@
2525
*/
2626
class DataTable extends Orm
2727
{
28-
use \FloatPHP\Helpers\Framework\tr\TraitCacheable,
29-
\FloatPHP\Helpers\Framework\tr\TraitRequestable,
28+
use \FloatPHP\Helpers\Framework\tr\TraitRequestable,
3029
\FloatPHP\Helpers\Framework\tr\TraitDatable,
3130
\FloatPHP\Helpers\Framework\tr\TraitTranslatable,
3231
\FloatPHP\Helpers\Framework\tr\TraitLoggable;
@@ -75,15 +74,6 @@ public function format(array $data = []) : string
7574
return "{{$prefix}{$json}}";
7675
}
7776

78-
/**
79-
* @inheritdoc
80-
*/
81-
public function noCache() : self
82-
{
83-
$this->useCache = false;
84-
return $this;
85-
}
86-
8777
/**
8878
* Build datatable response.
8979
*
@@ -95,9 +85,6 @@ public function noCache() : self
9585
*/
9686
protected function build(?string $table = null, ?string $key = null, array $columns = []) : string
9787
{
98-
// Init ORM
99-
parent::__construct();
100-
10188
// Set table
10289
$this->table = $table ? $table : (new Catcher())->key;
10390
$this->key = $key ?: "{$this->table}Id";
@@ -369,28 +356,23 @@ protected function getData() : array
369356
// Set filtered data outside cache
370357
$this->setSearchCount();
371358

372-
if ( $this->useCache ) {
373-
374-
$cache = new Cache();
375-
$key = $cache->getKey($this->table, [
376-
'start' => $this->getStart(),
377-
'length' => $this->getLength(),
378-
'orderby' => $this->getOrderBy(),
379-
'order' => $this->getOrder(),
380-
'search' => $this->getSearch(),
381-
'total' => $this->total,
382-
'filtered' => $this->filtered
383-
]);
384-
385-
$data = $cache->get($key, $status);
386-
if ( !$status ) {
387-
$data = $this->prepare();
388-
$cache->validate()->set($key, $data, 0, $this->table);
389-
}
390-
return $data;
391-
}
359+
$cache = new Cache();
360+
$key = $cache->getKey($this->table, [
361+
'start' => $this->getStart(),
362+
'length' => $this->getLength(),
363+
'orderby' => $this->getOrderBy(),
364+
'order' => $this->getOrder(),
365+
'search' => $this->getSearch(),
366+
'total' => $this->total,
367+
'filtered' => $this->filtered
368+
]);
392369

393-
return $this->prepare();
370+
$data = $cache->get($key, $status);
371+
if ( !$status ) {
372+
$data = $this->prepare();
373+
$cache->validate()->set($key, $data, 0, $this->table);
374+
}
375+
return $data;
394376
}
395377

396378
/**

src/Connection/Dump.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -40,17 +40,11 @@ final class Dump
4040
*/
4141
public function __construct($config = [])
4242
{
43-
// Init configuration
44-
$this->initConfig();
45-
4643
// Init access
4744
$this->access = Arrayify::merge(
4845
$this->getDbAccess(),
4946
$config
5047
);
51-
52-
// Reset configuration
53-
$this->resetConfig();
5448
}
5549

5650
/**

src/Connection/Infile.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

src/Connection/Role.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

src/Connection/Settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

src/Connection/Table.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -34,7 +34,6 @@ final class Table extends Orm
3434
* Init database.
3535
*
3636
* @param string $table
37-
* @uses resetConfig()
3837
*/
3938
public function __construct(?string $table = null)
4039
{
@@ -46,9 +45,6 @@ public function __construct(?string $table = null)
4645

4746
// Set key
4847
$this->key = "{$this->table}Id";
49-
50-
// Reset config
51-
$this->resetConfig();
5248
}
5349

5450
/**

src/Connection/Transient.php

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT
@@ -24,25 +24,30 @@
2424
final class Transient
2525
{
2626
use \FloatPHP\Helpers\Framework\tr\TraitConfigurable,
27-
\FloatPHP\Helpers\Framework\tr\TraitCacheable,
2827
\FloatPHP\Helpers\Framework\tr\TraitFormattable,
2928
\FloatPHP\Helpers\Framework\tr\TraitDatable;
3029

3130
/**
3231
* @access private
3332
* @var string $row, Temp row name
3433
* @var string $cache, Cache object
34+
*/
35+
private $row;
36+
private $cache;
37+
38+
/**
39+
* @access public
3540
* @var string ROW
3641
* @var string DRIVER
3742
* @var string TTL
3843
*/
39-
private $row;
40-
private $cache;
41-
private const ROW = '--temp';
42-
private const DRIVER = 'File';
43-
private const TTL = 300;
44+
public const ROW = '--temp';
45+
public const DRIVER = 'File';
46+
public const TTL = 300;
4447

4548
/**
49+
* Init transient.
50+
*
4651
* @access public
4752
* @param string $row
4853
* @param string $driver
@@ -56,21 +61,7 @@ public function __construct(string $row = self::ROW, string $driver = self::DRIV
5661
$this->getConfigObject();
5762

5863
// Init cache
59-
if ( $this->useCache ) {
60-
$this->cache = new Cache($driver);
61-
}
62-
}
63-
64-
/**
65-
* Disable cache.
66-
*
67-
* @access public
68-
* @return object
69-
*/
70-
public function noCache() : self
71-
{
72-
$this->useCache = false;
73-
return $this;
64+
$this->cache = new Cache($driver);
7465
}
7566

7667
/**
@@ -134,9 +125,6 @@ public function delete(string $key) : bool
134125
*/
135126
public function getTemp(string $key) : mixed
136127
{
137-
if ( !$this->useCache ) {
138-
return null;
139-
}
140128
return $this->cache->get($key);
141129
}
142130

@@ -151,9 +139,6 @@ public function getTemp(string $key) : mixed
151139
*/
152140
public function setTemp(string $key, $value = true, int $ttl = self::TTL) : bool
153141
{
154-
if ( !$this->useCache ) {
155-
return false;
156-
}
157142
return $this->cache->set($key, $value, $ttl, $this->row);
158143
}
159144

@@ -166,9 +151,6 @@ public function setTemp(string $key, $value = true, int $ttl = self::TTL) : bool
166151
*/
167152
public function deleteTemp(string $key) : bool
168153
{
169-
if ( !$this->useCache ) {
170-
return false;
171-
}
172154
return $this->cache->delete($key);
173155
}
174156

src/Connection/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* @author : Jakiboy
44
* @package : FloatPHP
55
* @subpackage : Helpers Connection Component
6-
* @version : 1.3.x
6+
* @version : 1.4.x
77
* @copyright : (c) 2018 - 2024 Jihad Sinnaour <[email protected]>
88
* @link : https://floatphp.com
99
* @license : MIT

0 commit comments

Comments
 (0)