public function store($key, $value): bool
    {
        $storageInstance = null;

        try {
            $storageInstance = $this->getRepository();
        } catch (\Exception $e) {
            // Create the file, if it does not exist..
            $storageInstance = $this->createFile();
        }

        // Check for existing tokens
        if (isset($storageInstance->{$key})) {
            // If there is a single token, make it an array so we can push the additional tokens in it
            if (!is_array($storageInstance->{$key})) {
                $storageInstance->{$key} = [$storageInstance->{$key}];
            }

            // Prevent duplicates
            if (!in_array($value, $storageInstance->{$key})) {
                // Add new token to existing key
                array_push($storageInstance->{$key}, $value);
            }
        } else {
            // First token for this key
            $storageInstance->{$key} = [$value];
        }

        $file = $this->updateRepository($storageInstance);

        return (bool) $file;
    }
public function store($key, $value): bool
    {
        $storageInstance = null;

        try {
            $storageInstance = $this->getRepository();
        } catch (\Exception $e) {
            // Create the file, if it does not exist..
            $storageInstance = $this->createFile();
        }

        // Check for existing tokens
        if (isset($storageInstance->{$key})) {
            // If there is a single token, make it an array so we can push the additional tokens in it
            if (!is_array($storageInstance->{$key})) {
                $storageInstance->{$key} = [$storageInstance->{$key}];
            }

            // Prevent duplicates
            if (!in_array($value, $storageInstance->{$key})) {
                // Add new token to existing key
                array_push($storageInstance->{$key}, $value);
            }
        } else {
            // First token for this key
            $storageInstance->{$key} = [$value];
        }

        $file = $this->updateRepository($storageInstance);

        return (bool) $file;
    }
public function store ( $ key , $ value ) : bool { $ storageInstance = null ; try { $ storageInstance = $ this -> getRepository ( ) ; } catch ( \ Exception $ e ) { // Create the file, if it does not exist.. $ storageInstance = $ this -> createFile ( ) ; } // Check for existing tokens if ( isset ( $ storageInstance -> { $ key } ) ) { // If there is a single token, make it an array so we can push the additional tokens in it if ( ! is_array ( $ storageInstance -> { $ key } ) ) { $ storageInstance -> { $ key } = [ $ storageInstance -> { $ key } ] ; } // Prevent duplicates if ( ! in_array ( $ value , $ storageInstance -> { $ key } ) ) { // Add new token to existing key array_push ( $ storageInstance -> { $ key } , $ value ) ; } } else { // First token for this key $ storageInstance -> { $ key } = [ $ value ] ; } $ file = $ this -> updateRepository ( $ storageInstance ) ; return ( bool ) $ file ; }
Stores an Expo token with a given identifier

@param $key
@param $value

@return bool
Stores an Expo token with a given identifier