more optimizations

This commit is contained in:
2026-07-22 17:01:18 +02:00
parent 6e3665696c
commit ad6fa5ef2a
2 changed files with 8 additions and 8 deletions
@@ -41,7 +41,7 @@ class ElixFormsController
$username = $this->config->secret('elixforms_api_username');
$password = $this->config->secret('elixforms_api_password');
if (!is_string($username) || trim($username) === '' || !is_string($password) || $password === '') {
if (!\is_string($username) || trim($username) === '' || !\is_string($password) || $password === '') {
throw new ElixFormsException('Credenziali elixForms non configurate.');
}
@@ -85,7 +85,7 @@ class ElixFormsController
private function requiredString(array $values, string $key): ?string
{
if (!isset($values[$key]) || !is_string($values[$key])) {
if (!isset($values[$key]) || !\is_string($values[$key])) {
return null;
}
@@ -96,11 +96,11 @@ class ElixFormsController
private function optionalNonEmptyString(array $values, string $key, string $default): ?string
{
if (!array_key_exists($key, $values)) {
if (!\array_key_exists($key, $values)) {
return $default;
}
if (!is_string($values[$key])) {
if (!\is_string($values[$key])) {
return null;
}
@@ -112,7 +112,7 @@ class ElixFormsController
private function requestId(array $instance)
{
foreach (['idDomanda', 'requestId', 'idRequest'] as $key) {
if (isset($instance[$key]) && (is_int($instance[$key]) || is_string($instance[$key]))) {
if (isset($instance[$key]) && (\is_int($instance[$key]) || \is_string($instance[$key]))) {
return $instance[$key];
}
}
+3 -3
View File
@@ -53,7 +53,7 @@ class Container {
*/
public function make(string $abstract) {
// return existing singleton instance if already created
if (array_key_exists($abstract, $this->instances) && $this->instances[$abstract] !== null) {
if (\array_key_exists($abstract, $this->instances) && $this->instances[$abstract] !== null) {
return $this->instances[$abstract];
}
@@ -70,7 +70,7 @@ class Container {
if (is_callable($concrete)) {
// factory receives the container
$object = $concrete($this);
} elseif (is_string($concrete) && class_exists($concrete)) {
} elseif (\is_string($concrete) && class_exists($concrete)) {
$object = $this->build($concrete);
} else {
throw new \Exception("Invalid binding for [{$abstract}]");
@@ -78,7 +78,7 @@ class Container {
}
// if abstract was registered as singleton, cache the instance
if (array_key_exists($abstract, $this->instances)) {
if (\array_key_exists($abstract, $this->instances)) {
$this->instances[$abstract] = $object;
}