Skip to content

Commit 1fc61b3

Browse files
committed
configuration is now extendable and responsive alert speed up
- Changed - Core - Added - configuration - Improved - content - directory - responsive alert - http - route
1 parent ca7a9db commit 1fc61b3

15 files changed

Lines changed: 226 additions & 200 deletions

src/asset/avail.php

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ abstract class avail
1515
*/
1616
static $application;
1717
/**
18-
* @var (string) Root directory
18+
* @var (string) letId root directory
1919
*/
2020
static $root = __DIR__;
2121
/**
@@ -26,7 +26,7 @@ abstract class avail
2626
* @var (array) html content used in Template, Menu and Language
2727
*/
2828
static $content = array();
29-
static $context = array(), $contextLog=array(),$contextResponse,$contextType='responseTemplate';// $contextMeta,$contextHeader,$contextExt;
29+
static $context = array(), $contextLog=array(), $contextResponse, $contextType='responseTemplate';// $contextMeta,$contextHeader,$contextExt;
3030
/**
3131
* @var (object) database connection status
3232
*/
@@ -36,7 +36,7 @@ abstract class avail
3636
*/
3737
static $config = array(
3838
/**
39-
* applications root directory
39+
* all applications root directory
4040
*/
4141
'ARO' => '../app/',
4242
/**
@@ -113,7 +113,7 @@ abstract class avail
113113
/**
114114
* @var (object) directory
115115
*/
116-
static $dir = array();
116+
static $dir;
117117
/**
118118
* @var (array) Language list
119119
*/
@@ -169,7 +169,8 @@ abstract class avail
169169
'configuration'=>'configuration',
170170
'route'=>'route',
171171
'class'=>'class',
172-
'method'=>'method'
172+
'method'=>'method',
173+
'success'=>'success'
173174
);
174175
/**
175176
* @var (array) Default Template's Extension
@@ -192,8 +193,8 @@ abstract class avail
192193
* NOTE: framework info.
193194
*/
194195
static $letid = array(
195-
'build' => '07.09.16.15.00',
196-
'version' => '1.0.7',
196+
'build' => '07.10.16.17.20',
197+
'version' => '1.0.8',
197198
'name' => 'letId',
198199
'description' => 'letId PHP Framework'
199200
);
@@ -207,19 +208,14 @@ abstract class avail
207208
* @var (string) Id
208209
*/
209210
public $Id = '!';
210-
public function __construct()
211+
public function __construct($Id='')
211212
{
212-
if (func_get_args()) {
213-
$this->Id = func_get_args()[0];
214-
}
213+
$this->Id = $Id;
215214
}
216215
static function request($Id=null)
217216
{
218217
return new self($Id);
219218
}
220-
/**
221-
* NOTE: class availables
222-
*/
223219
static function language($Id=null)
224220
{
225221
return new language($Id);
@@ -235,10 +231,6 @@ static function html($Id=array())
235231
static function content($Id=null)
236232
{
237233
return new content($Id);
238-
}
239-
static function configuration($Id=null)
240-
{
241-
return new configuration($Id);
242234
}
243235
static function directory($Id=null)
244236
{
@@ -269,6 +261,10 @@ static function assist($Id=null)
269261
static function arrays($Id=null)
270262
{
271263
return new arrays($Id);
264+
}
265+
static function configuration($Id=null)
266+
{
267+
return new self::$config['ASC']($Id);
272268
}
273269
static function validation($Id=array())
274270
{
@@ -282,21 +278,5 @@ static function mail($Id=array())
282278
{
283279
return new self::$config['ASM']($Id);
284280
}
285-
static function intObj($Id=self::class)
286-
{
287-
self::$application = new \ReflectionClass($Id);
288-
}
289-
static function hasObj($Id)
290-
{
291-
return self::$application->hasProperty($Id);
292-
}
293-
static function getObj($Id)
294-
{
295-
return self::$application->getStaticPropertyValue($Id);
296-
}
297-
static function setObj($Id,$Value)
298-
{
299-
return self::$application->setStaticPropertyValue($Id,$Value);
300-
}
301281
}
302282
}

src/asset/configuration.php

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,52 +6,56 @@
66
$configuration->set(Value);
77
$configuration->all();
88
9-
configuration::request(Id)
10-
configuration::request(Id)->get()
11-
configuration::request(Id)->set(Value)
12-
configuration::request()->all()
13-
149
avail::configuration(Id);
1510
avail::configuration(Id)->get();
1611
avail::configuration(Id)->set(Value);
1712
avail::configuration()->all();
1813
*/
19-
class configuration extends avail
14+
abstract class configuration
2015
{
16+
public $Id;
17+
public function __construct($Id=null)
18+
{
19+
$this->Id = $Id;
20+
}
21+
public function initiate()
22+
{
23+
avail::$config = array_merge(avail::$config,$this->setting);
24+
}
25+
public function request($Id)
26+
{
27+
if ($this->Id) {
28+
return array_merge($this->Id,$this->{$Id});
29+
} else {
30+
return $this->{$Id};
31+
}
32+
}
2133
public function all()
2234
{
23-
return self::$config;
35+
return avail::$config;
2436
}
2537
public function has()
2638
{
27-
return isset(self::$config[$this->Id]);
39+
return isset(avail::$config[$this->Id]);
2840
}
2941
public function set()
3042
{
3143
if ($this->Id) {
3244
if (func_get_args()) {
33-
return self::$config[$this->Id]=func_get_args()[0];
45+
return avail::$config[$this->Id]=func_get_args()[0];
3446
} else {
35-
self::$config[$this->Id] = null;
47+
avail::$config[$this->Id] = null;
3648
}
3749
}
3850
}
3951
public function get($Id=null)
4052
{
41-
return $this->has()?self::$config[$this->Id]:$Id;
42-
}
43-
public function setClass($Id=null)
44-
{
45-
if ($this->has()) {
46-
if (class_exists(self::$config[$this->Id])) {
47-
return new self::$config[$this->Id]($Id);
48-
}
49-
}
53+
return $this->has()?avail::$config[$this->Id]:$Id;
5054
}
5155
public function merge($Id=array())
5256
{
5357
if (is_array($this->Id)) {
54-
self::$config = array_merge(self::$config,$this->Id,$Id);
58+
avail::$config = array_merge(avail::$config,$this->Id,$Id);
5559
}
5660
}
5761
public function __toString()

src/asset/content.php

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,75 +16,58 @@
1616
avail::content(Id)->set(Value);
1717
avail::content()->all();
1818
*/
19-
class content extends avail
19+
class content
2020
{
21+
public $Id = '!';
22+
public function __construct($Id='')
23+
{
24+
$this->Id = $Id;
25+
}
2126
public function all()
2227
{
23-
return self::$content;
28+
return avail::$content;
2429
}
2530
public function has()
2631
{
2732
if ($this->Id) {
28-
return isset(self::$content[$this->Id]);
33+
return isset(avail::$content[$this->Id]);
2934
}
3035
}
31-
// public function setId($Id=null)
32-
// {
33-
// if ($Id) {
34-
// $this->Id = $Id;
35-
// }
36-
// return $this;
37-
// }
38-
public function set()
36+
public function set($Id)
3937
{
40-
if ($this->Id) {
41-
if (func_get_args()) {
42-
return self::$content[$this->Id]=func_get_args()[0];
43-
}
44-
}
38+
return avail::$content[$this->Id]=$Id;
4539
}
4640
public function get()
4741
{
48-
if ($this->has()) {
49-
return self::$content[$this->Id];
50-
}
42+
if ($this->has()) return avail::$content[$this->Id];
5143
}
5244
public function resolve()
5345
{
5446
if ($this->has()) {
55-
return self::$content[$this->Id];
56-
} else if (self::hasObj($this->Id)) {
57-
if ($name=self::getObj($this->Id) and is_scalar($name)) {
58-
return $name;
59-
}
47+
return avail::$content[$this->Id];
48+
} else{
49+
return avail::configuration($this->Id)->get();
6050
}
6151
// if ($this->has()) {
62-
// return self::$content[$this->Id];
63-
// } else if (self::hasObj($this->Id)) {
64-
// if ($name=self::getObj($this->Id) and is_scalar($name)) {
52+
// return avail::$content[$this->Id];
53+
// } else if (avail::hasObj($this->Id)) {
54+
// if ($name=avail::getObj($this->Id) and is_scalar($name)) {
6555
// return $name;
6656
// }
6757
// }
6858
}
6959
public function statics()
7060
{
71-
if (self::hasObj($this->Id)) {
72-
if ($name=self::getObj($this->Id) and is_scalar($name)) {
73-
return $name;
74-
}
75-
}
76-
}
77-
public function statics___()
78-
{
79-
$needle = 'app.';
80-
$haystack = $this->Id;
81-
$position = strpos($haystack, $needle);
82-
if ($position === 0) {
83-
$name = substr_replace($haystack, '', $position, strlen($needle));
84-
if (is_scalar($varName=self::getObj($name))) {
85-
return $varName;
86-
}
87-
}
61+
return avail::configuration($this->Id)->get();
62+
// $needle = 'app.';
63+
// $haystack = $this->Id;
64+
// $position = strpos($haystack, $needle);
65+
// if ($position === 0) {
66+
// $name = substr_replace($haystack, '', $position, strlen($needle));
67+
// if (is_scalar($varName=avail::getObj($name))) {
68+
// return $varName;
69+
// }
70+
// }
8871
}
8972
public function __toString()
9073
{

src/asset/directory.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@
66
$directory->set(Value);
77
$directory->all();
88
9-
directory::request(Id)
10-
directory::request(Id)->get()
11-
directory::request(Id)->set(Value)
12-
directory::request()->all()
13-
149
avail::directory(Id);
1510
avail::directory(Id)->get();
1611
avail::directory(Id)->set(Value);
1712
avail::directory()->all();
1813
*/
19-
class directory extends avail
14+
class directory
2015
{
16+
public $Id;
17+
public function __construct($Id=null)
18+
{
19+
$this->Id = $Id;
20+
}
2121
public function all()
2222
{
23-
return self::$dir;
23+
return avail::$dir;
2424
}
2525
public function has()
2626
{
2727
if ($this->Id) {
28-
return isset(self::$dir[$this->Id]);
28+
return isset(avail::$dir[$this->Id]);
2929
}
3030
}
3131
/**
@@ -34,29 +34,30 @@ public function has()
3434
*/
3535
public function set($Id=null)
3636
{
37-
if (self::$dir->root) {
37+
if (avail::$dir->root) {
3838
if (is_array($Id)) {
3939
foreach ($Id as $name => $dir)
4040
{
41-
self::$dir->{$name} = self::$dir->root.$dir.static::SlA;
41+
avail::$dir->{$name} = avail::$dir->root.$dir.avail::SlA;
4242
}
4343
} elseif ($this->Id) {
44-
self::$dir->{$this->Id} = self::$dir->root.$Id.static::SlA;
44+
avail::$dir->{$this->Id} = avail::$dir->root.$Id.avail::SlA;
4545
}
4646
}
4747

4848
}
4949
public function get()
5050
{
5151
if ($this->has()) {
52-
return self::$dir[$this->Id];
52+
return avail::$dir[$this->Id];
5353
}
5454
}
5555
public function existsTemplate()
5656
{
57-
self::$dir->template = self::$config['ARO'].self::$config['ARD'];
58-
if (!file_exists(self::$dir->template.$this->Id.self::$Extension['template'])) {
59-
self::$dir->template = self::$root.self::$Alert['dir'];
57+
avail::$dir->template = avail::$config['ARD'];
58+
// avail::$dir->template = avail::$config['ARO'].avail::$config['ARD'];
59+
if (!file_exists(avail::$dir->template.$this->Id.avail::$Extension['template'])) {
60+
avail::$dir->template = avail::$root.avail::$Alert['dir'];
6061
}
6162
}
6263
public function __toString()

0 commit comments

Comments
 (0)