Skip to content

Commit 8ab84ea

Browse files
authored
Merge pull request #7 from SimpleREST/develop
Реализация основного функционала
2 parents 6bf68de + ab9b1ba commit 8ab84ea

File tree

3 files changed

+63
-7
lines changed

3 files changed

+63
-7
lines changed

src/Main/Application.php

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,14 @@ class Application implements BaseApplicationContract
1313
*
1414
* @var string
1515
*/
16-
const VERSION = '0.0.5';
16+
const VERSION = '0.0.6';
17+
18+
/**
19+
* The base path for the SimpleStub installation.
20+
*
21+
* @var string
22+
*/
23+
protected $basePath;
1724

1825
/**
1926
* The application namespace.
@@ -36,14 +43,18 @@ class Application implements BaseApplicationContract
3643
*/
3744
private static $output;
3845

39-
public function __construct()
46+
public function __construct($basePath)
4047
{
41-
self::$input = Input::getInstance();
42-
self::$output = Output::getInstance();
48+
// self::$input = Input::getInstance();
49+
// self::$output = Output::getInstance();
50+
if ($basePath) {
51+
$this->basePath = rtrim($basePath, '\/');
52+
}
4353
}
4454

4555
public function version(): string
4656
{
57+
if (defined('STUB_APP_VERSION')) echo STUB_APP_VERSION;
4758
return static::VERSION;
4859
}
4960

src/Main/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Throwable;
1010

1111
/**
12-
*
12+
* Класс ядра консоли
1313
*/
1414
class Kernel implements \Stub\Framework\Contracts\Console\Kernel
1515
{

src/Main/Http/Kernel.php

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,56 @@
22

33
namespace Stub\Framework\Main\Http;
44

5+
use DateTime;
6+
use Stub\Framework\Contracts\Main\Application;
7+
use Stub\Framework\Http\View\Stub;
8+
9+
/**
10+
* Класс ядра НТТР
11+
*/
512
class Kernel implements \Stub\Framework\Contracts\Http\Kernel
613
{
14+
/**
15+
* Содержит экземпляр класса приложения
16+
* @var Application
17+
*/
18+
protected $app;
19+
20+
/**
21+
* Дата и время старта обрабатываемого запроса
22+
* @var DateTime|Null
23+
*/
24+
protected $requestStartedDateTime;
25+
26+
/**
27+
* Создает новый экземпляр ядра HTTP
28+
* @param Application $app
29+
*/
30+
public function __construct(Application $app)
31+
{
32+
$this->app = $app;
33+
}
34+
35+
/**
36+
* @return void
37+
*/
38+
public function hendle()
39+
{
40+
$this->requestStartedDateTime = new DateTime();
41+
42+
}
43+
44+
/**
45+
* @return string
46+
*/
747
public function sayHello(): string
848
{
9-
echo "Hello!! It is Console Kernel...";
10-
return "Hi!! It is Console Kernel...";
49+
// echo "Hello!! It is Console Kernel...";
50+
// return "Hi!! It is Console Kernel...";
51+
$stub = new Stub($this->app);
52+
$stub->generate($this->app);
53+
echo $stub->getDocumentResult();
54+
55+
return "";
1156
}
1257
}

0 commit comments

Comments
 (0)