Init
This commit is contained in:
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
.idea/
|
||||||
|
/vendor
|
||||||
|
composer.lock
|
||||||
20
composer.json
Normal file
20
composer.json
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"name": "rmphp/foundation",
|
||||||
|
"license": "proprietary",
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Yuri Zuev",
|
||||||
|
"email": "y_zuev@mail.ru"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"php": "^8.1",
|
||||||
|
"psr/http-message": "^1.0"
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"Rmphp\\Foundation\\": "src/"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
11
src/Exceptions/AppError.php
Normal file
11
src/Exceptions/AppError.php
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rmphp\Foundation\Exceptions;
|
||||||
|
|
||||||
|
|
||||||
|
class AppError extends \Error {
|
||||||
|
|
||||||
|
public static function invalidRequiredObject($objectName) : self {
|
||||||
|
return new self("Invalid required object". $objectName);
|
||||||
|
}
|
||||||
|
}
|
||||||
20
src/Exceptions/AppException.php
Normal file
20
src/Exceptions/AppException.php
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rmphp\Foundation\Exceptions;
|
||||||
|
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
|
class AppException extends \Exception {
|
||||||
|
|
||||||
|
public static function invalidObject($objectName) : self {
|
||||||
|
return new self("Invalid object factory ". $objectName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function emptyConfig() : self {
|
||||||
|
return new self('Empty config');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function emptyAppNodes() : self {
|
||||||
|
return new self('Empty App Nodes list');
|
||||||
|
}
|
||||||
|
}
|
||||||
21
src/MatchObject.php
Normal file
21
src/MatchObject.php
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rmphp\Foundation;
|
||||||
|
|
||||||
|
class MatchObject {
|
||||||
|
|
||||||
|
public string $className;
|
||||||
|
public string $methodName;
|
||||||
|
public array $params;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $className
|
||||||
|
* @param string $methodName
|
||||||
|
* @param array $params
|
||||||
|
*/
|
||||||
|
public function __construct(string $className = "", string $methodName="", array $params=[]) {
|
||||||
|
$this->className = $className;
|
||||||
|
$this->methodName = $methodName;
|
||||||
|
$this->params = (is_array($params)) ? $params : [];
|
||||||
|
}
|
||||||
|
}
|
||||||
12
src/RouterInterface.php
Normal file
12
src/RouterInterface.php
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rmphp\Foundation;
|
||||||
|
|
||||||
|
use Psr\Http\Message\RequestInterface;
|
||||||
|
|
||||||
|
|
||||||
|
interface RouterInterface {
|
||||||
|
public function setStartPoint(string $mountPoint): void;
|
||||||
|
public function withRules(array $rules) : void;
|
||||||
|
public function match(RequestInterface $request) : ?array;
|
||||||
|
}
|
||||||
18
src/TemplateInterface.php
Normal file
18
src/TemplateInterface.php
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Rmphp\Foundation;
|
||||||
|
|
||||||
|
interface TemplateInterface {
|
||||||
|
|
||||||
|
public function setTemplate(string $template, array $resource = []): TemplateInterface;
|
||||||
|
public function setSubtemplePath(string $subtemplatePath) : TemplateInterface;
|
||||||
|
public function getSubtemplePath(): string;
|
||||||
|
public function setValue(string $point, string $string) : void;
|
||||||
|
public function addValue(string $point, string $string) : void;
|
||||||
|
public function setSubtemple(string $point, string $subTempl, array $resource = []) : void;
|
||||||
|
public function addSubtemple(string $point, string $subTempl, array $resource = []) : void;
|
||||||
|
public function setGlobals(array $globals = []) : void;
|
||||||
|
public function inc(string $incFile) : string;
|
||||||
|
public function getPoint(string $point) : string;
|
||||||
|
public function getResponse(): string;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user