initial commit for soko-web
soko-web/pipeline/head This commit looks good

This commit is contained in:
bence committed 2023-04-07 19:32:15 +02:00
commit a17a88e9d4
71 files changed
+7241

No files matched your search

+16
View File
@@ -0,0 +1,16 @@
<?php namespace SokoWeb\Interfaces\Authentication;
interface IUser
{
const PERMISSION_NORMAL = 0;
const PERMISSION_ADMIN = 1;
public function hasPermission(int $permission): bool;
public function getUniqueId();
public function getDisplayName(): string;
public function checkPassword(string $password): bool;
}
@@ -0,0 +1,6 @@
<?php namespace SokoWeb\Interfaces\Authorization;
interface ISecured
{
public function authorize(): bool;
}
+20
View File
@@ -0,0 +1,20 @@
<?php namespace SokoWeb\Interfaces\Database;
interface IConnection
{
public function startTransaction(): void;
public function commit(): void;
public function rollback(): void;
public function query(string $query): ?IResultSet;
public function multiQuery(string $query): array;
public function prepare(string $query): IStatement;
public function lastId(): int;
public function getAffectedRows(): int;
}
+16
View File
@@ -0,0 +1,16 @@
<?php namespace SokoWeb\Interfaces\Database;
interface IResultSet
{
const FETCH_ASSOC = 0;
const FETCH_NUM = 1;
const FETCH_BOTH = 2;
public function fetch(int $type): ?array;
public function fetchAll(int $type): array;
public function fetchOneColumn(string $valueName, string $keyName): array;
}
+8
View File
@@ -0,0 +1,8 @@
<?php namespace SokoWeb\Interfaces\Database;
interface IStatement
{
public function execute(array $params): ?IResultSet;
public function getAffectedRows(): int;
}
+18
View File
@@ -0,0 +1,18 @@
<?php namespace SokoWeb\Interfaces\Http;
interface IRequest
{
const HTTP_GET = 0;
const HTTP_POST = 1;
public function setUrl(string $url): void;
public function setMethod(int $method): void;
public function setQuery($query): void;
public function setHeaders(array $headers): void;
public function send(): IResponse;
}
+8
View File
@@ -0,0 +1,8 @@
<?php namespace SokoWeb\Interfaces\Http;
interface IResponse
{
public function getBody(): string;
public function getHeaders(): array;
}
@@ -0,0 +1,8 @@
<?php namespace SokoWeb\Interfaces\Repository;
use SokoWeb\Interfaces\Authentication\IUser;
interface IUserRepository
{
public function getById(int $userId): ?IUser;
}
+20
View File
@@ -0,0 +1,20 @@
<?php namespace SokoWeb\Interfaces\Request;
use SokoWeb\Interfaces\Authentication\IUser;
interface IRequest
{
public function setParsedRouteParams(array &$routeParams): void;
public function getBase(): string;
public function query(string $key);
public function post(string $key);
public function session(): ISession;
public function setUser(?IUser $user): void;
public function user(): ?IUser;
}
+12
View File
@@ -0,0 +1,12 @@
<?php namespace SokoWeb\Interfaces\Request;
interface ISession
{
public function has(string $key): bool;
public function get(string $key);
public function set(string $key, $value): void;
public function delete(string $key): void;
}
+12
View File
@@ -0,0 +1,12 @@
<?php namespace SokoWeb\Interfaces\Response;
interface IContent
{
public function setData(array $data): void;
public function getData(): array;
public function render(): void;
public function getContentType(): string;
}
+12
View File
@@ -0,0 +1,12 @@
<?php namespace SokoWeb\Interfaces\Response;
interface IRedirect
{
const PERMANENT = 1;
const TEMPORARY = 2;
public function getUrl(): string;
public function getHttpCode(): int;
}
@@ -0,0 +1,9 @@
<?php namespace SokoWeb\Interfaces\Session;
use SessionHandlerInterface;
use SessionIdInterface;
use SessionUpdateTimestampHandlerInterface;
interface ISessionHandler extends SessionHandlerInterface, SessionIdInterface, SessionUpdateTimestampHandlerInterface
{
}