-
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
Added function to allow dot notation in Source->config array #28
Added function to allow dot notation in Source->config array #28
Conversation
{ | ||
|
||
if(($diff = array_diff(self::REQUIRED_PARAMETERS_PASSWORD, array_keys(array: $configuration))) !== []) { | ||
throw new BadRequestException(message: 'Some required parameters are not set: ['.implode(separator: ',', array: $diff).']'); |
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.
Can the implode be assigned to a var on an empty line above?
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.
We could try that, yes
@@ -3,9 +3,138 @@ | |||
namespace OCA\OpenConnector\Service; | |||
|
|||
|
|||
use GuzzleHttp\Client; | |||
use OAuthException; | |||
use Symfony\Component\HttpFoundation\Exception\BadRequestException; | |||
|
|||
class AuthenticationService |
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.
Do we want class docblocks in this repo?
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 no docblock yet, we can add it if we want to.
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.
This is not a question, we want docblocks
// Check if there are keys containing a dot we want to map to a different position in the $config array. | ||
foreach ($config as $key => $value) { | ||
if (str_contains($key, '.')) { | ||
$dotConfig->set($key, $value); | ||
$unsetKeys[] = $key; | ||
} | ||
} | ||
|
||
// Remove the old keys containing a dot that we mapped to a different position in the $config array. | ||
$config = $dotConfig->all(); | ||
foreach ($unsetKeys as $key) { | ||
unset($config[$key]); | ||
} |
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.
For my understanding, this is to prevent a key that contains a dot from being seen as another step deeper in the dotArray?
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.
No description provided.