8 Commits
Author SHA1 Message Date
bence 014a548096 Merge pull request 'add interface IAuthenticationRequired' (#4) from feature/interface-for-authentication-required into master
soko-web/pipeline/head This commit looks good
Reviewed-on: #4
2023-04-16 16:54:22 +02:00
bence 298a1e34ac add interface IAuthenticationRequired
soko-web/pipeline/pr-master This commit looks good
2023-04-16 16:43:53 +02:00
bence 4af7ae3521 Merge pull request 'fix check in PersistentDataManager' (#3) from bugfix/fix-check-in-persistentdatamanager into master
soko-web/pipeline/head This commit looks good
Reviewed-on: #3
2023-04-16 16:00:29 +02:00
bence 9d4cb86d41 fix check in PersistentDataManager
soko-web/pipeline/pr-master This commit looks good
2023-04-16 15:59:47 +02:00
bence bf4520a7dd Merge pull request 'get and serve headers in Request' (#2) from feature/implement-header-parsing into master
soko-web/pipeline/head This commit looks good
Reviewed-on: #2
2023-04-16 15:54:55 +02:00
bence fda796ab18 get and serve headers in Request
soko-web/pipeline/pr-master This commit looks good
2023-04-16 15:52:50 +02:00
bence ba33a9bb37 Merge pull request 'add README with build badge' (#1) from add-readme into master
soko-web/pipeline/head This commit looks good
Reviewed-on: #1
2023-04-07 21:22:45 +02:00
bence 8a20bb76ef add README with build badge
soko-web/pipeline/pr-master This commit looks good
2023-04-07 21:20:25 +02:00
5 changed files with 37 additions and 2 deletions

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
# SokoWeb
[![Build Status](https://ci.esoko.eu/job/soko-web/job/master/badge/icon)](https://ci.esoko.eu/job/soko-web/job/master/)
This is the SokoWeb framework.
---
*License: **GNU GPL 3.0**. Full license text can be found in file `LICENSE`.*
@@ -0,0 +1,6 @@
<?php namespace SokoWeb\Interfaces\Authentication;
interface IAuthenticationRequired
{
public function isAuthenticationRequired(): bool;
}
+2
View File
@@ -12,6 +12,8 @@ interface IRequest
public function post(string $key); public function post(string $key);
public function header(string $key);
public function session(): ISession; public function session(): ISession;
public function setUser(?IUser $user): void; public function setUser(?IUser $user): void;
+1 -1
View File
@@ -57,7 +57,7 @@ class PersistentDataManager
$value = current($data); $value = current($data);
$relation = key($relations); $relation = key($relations);
if (strpos($key, '__') == false) { if (strpos($key, '__') === false) {
$method = 'set' . str_replace('_', '', ucwords($key, '_')); $method = 'set' . str_replace('_', '', ucwords($key, '_'));
if (method_exists($model, $method) && isset($value)) { if (method_exists($model, $method) && isset($value)) {
+19 -1
View File
@@ -15,15 +15,24 @@ class Request implements IRequest
private array $post; private array $post;
private array $headers;
private Session $session; private Session $session;
private ?IUser $user = null; private ?IUser $user = null;
public function __construct(string $base, array &$get, array &$post, array &$session, IUserRepository $userRepository) public function __construct(
string $base,
array &$get,
array &$post,
array $headers,
array &$session,
IUserRepository $userRepository)
{ {
$this->base = $base; $this->base = $base;
$this->get = &$get; $this->get = &$get;
$this->post = &$post; $this->post = &$post;
$this->headers = $headers;
$this->session = new Session($session); $this->session = new Session($session);
$userId = $this->session->get('userId'); $userId = $this->session->get('userId');
@@ -64,6 +73,15 @@ class Request implements IRequest
return null; return null;
} }
public function header($key)
{
if (isset($this->headers[$key])) {
return $this->headers[$key];
}
return null;
}
public function session(): ISession public function session(): ISession
{ {
return $this->session; return $this->session;