more optimizations
This commit is contained in:
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user