Skip to content
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

Remove token. #131

Open
michaeljcoyne opened this issue Nov 8, 2016 · 2 comments
Open

Remove token. #131

michaeljcoyne opened this issue Nov 8, 2016 · 2 comments

Comments

@michaeljcoyne
Copy link

michaeljcoyne commented Nov 8, 2016

When the class calls this function

private function checkDevicesTokens()
    {
        $devices = $this->getDevices();
        $adapter = $this->getAdapter();

        foreach ($devices as $device) {
            if (false === $adapter->supports($device->getToken())) {
                throw new AdapterException(
                    sprintf(
                        'Adapter %s does not support %s token\'s device',
                        (string) $adapter,
                        $device->getToken()
                    )
                );
            }
        }
    }

instead of throwing a new exception. Is there a way to just remove the token from the iterator object? And then the script would not die and just cleanse / purge the token list.

@aliemam
Copy link

aliemam commented Feb 25, 2018

This function is not supposed to have a heavy overhead (regarding to the original purpose that it have been developed for).
Therefore, I suggest to add an API-function (preferably public function inside the class) that does similar loop to this one, except it must have a flag-check (boolean for "either skip or force to send the push after encountering error") and then do the logic and [if necessary] logging after the original loop-logic.

@seyfer
Copy link
Collaborator

seyfer commented Feb 26, 2018

@aliemam, I agree, but the name is like filterSupportedTokens() and without exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants