-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix problems with class variables overlapping #6
Conversation
src/Router.php
Outdated
function __construct(array $data = []) { | ||
$this->serviceName = $data['serviceName'] ?? null; | ||
$this->actionName = $data['actionName'] ?? null; | ||
$this->params = $data['params'] ?? null; | ||
$this->routes = []; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
тут видно что количество водящих не динамическое и не большое - лучше передать их все напрямую
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
прям параметрами без обверти масивом
src/Router.php
Outdated
throw new RoutingException(_("Empty routes"), 1); | ||
} | ||
|
||
$this->routes = $routes; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
в каждом обьекте роутера будет свой набор роутов дублирующийся массив на 100+ строк на каждый паралельный реквест. то что мы говорили про статический доступ
src/Router.php
Outdated
throw new RoutingException(_("Route not found."), 501); | ||
} | ||
|
||
return new self($routeData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Передать сразу конкретные переменные
src/Router.php
Outdated
|
||
$routesCount = 0; | ||
|
||
foreach ($this->routes as $regExpString => $route) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Юзать роуты не с обьекта
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
а с класса
added static obj logic for specific env, made changes by pullrequest
src/Router.php
Outdated
} | ||
return self::$instance[$environment]; | ||
} else { | ||
die("Некорректная среда"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нельзя просто взять и умереть нельзя останавливать процесс изза одного реквеста есть же паралельные реквесты
робочий варіант з мінімумом змін в уже існуючих проектах де використовується бібліотека
протестив в одному з проектів