Skip to content

Commit 746e492

Browse files
committed
configs + templater
1 parent 1676c1f commit 746e492

File tree

7 files changed

+67
-1
lines changed

7 files changed

+67
-1
lines changed

.htaccess

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
RewriteEngine on
2+
3+
4+
#RewriteCond %{REQUEST_URI} ^/i/
5+
#RewriteCond %{REQUEST_FILENAME} !-f
6+
#RewriteRule .* image.php [L]
7+
8+
9+
10+
RewriteCond %{REQUEST_URI} !/(public|Favicon)/
211
RewriteCond %{REQUEST_FILENAME} !-f
312
RewriteCond %{REQUEST_FILENAME} !-d
4-
RewriteRule ^(.*) index.php?url=$1 [L,QSA]
13+
RewriteRule ^(.*) index.php?url=$1 [L,QSA]
14+

Engine/Tools/Config.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: dawid
5+
* Date: 29.07.18
6+
* Time: 15:11
7+
*/
8+
9+
namespace Tools;
10+
11+
12+
final class Config {
13+
private static $instance;
14+
15+
private static $_configs = [];
16+
17+
public static function getInstance(): self {
18+
if (self::$instance === null) {
19+
self::$instance = new Config();
20+
}
21+
return self::$instance;
22+
}
23+
24+
public static function __get(?string $name) {
25+
26+
if($name){
27+
if(array_key_exists($name, self::$_configs)){
28+
return self::$_configs[$name];
29+
}
30+
}
31+
32+
return self::$_configs;
33+
}
34+
35+
}

Engine/View/Templater.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: dawid
5+
* Date: 10.07.18
6+
* Time: 21:38
7+
*/
8+
9+
namespace View;
10+
11+
12+
class Templater {
13+
14+
}

application/config/config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
3+
}

application/controller/HelloController.php

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

33
namespace Controllers;
44

5+
use Tools\Config;
6+
57
class HelloController extends \Engine\Controller {
68

79
public function index() {

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"autoload": {
1717
"psr-4": {
1818
"View\\": "Engine/View",
19+
"Tools\\": "Engine/Tools",
1920
"Engine\\": "Engine",
2021
"Controllers\\": "application/controller"
2122
}

index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
//error_reporting(E_ALL);
23
error_reporting(-1);
34
ini_set('display_errors', 'Off');
45

0 commit comments

Comments
 (0)