protected function determineKeywordsState($key, array $newKeywords = [], array $oldKeywords = [])
    {
        $this->setKeywordsOperation(true);

        static $state = [];

        // Build state if:
        // - not built yet
        // - $newKeywords or $oldKeywords is provided
        if (! isset($state[$key]) || func_num_args() > 1) {
            $old = empty($oldKeywords) ? parent::get($this->generateInverseIndexKey($key), []) : $oldKeywords;
            $new = $this->mergeKeywords ? array_unique(array_merge($old, $newKeywords)) : $newKeywords;
            $state[$key] = [
                'old'      => $old,
                'new'      => $new,
                'obsolete' => array_diff($old, $new),
            ];
        }

        $this->setKeywordsOperation(false);

        return $state[$key];
    }
protected function determineKeywordsState($key, array $newKeywords = [], array $oldKeywords = [])
    {
        $this->setKeywordsOperation(true);

        static $state = [];

        // Build state if:
        // - not built yet
        // - $newKeywords or $oldKeywords is provided
        if (! isset($state[$key]) || func_num_args() > 1) {
            $old = empty($oldKeywords) ? parent::get($this->generateInverseIndexKey($key), []) : $oldKeywords;
            $new = $this->mergeKeywords ? array_unique(array_merge($old, $newKeywords)) : $newKeywords;
            $state[$key] = [
                'old'      => $old,
                'new'      => $new,
                'obsolete' => array_diff($old, $new),
            ];
        }

        $this->setKeywordsOperation(false);

        return $state[$key];
    }
protected function determineKeywordsState ( $ key , array $ newKeywords = [ ] , array $ oldKeywords = [ ] ) { $ this -> setKeywordsOperation ( true ) ; static $ state = [ ] ; // Build state if: // - not built yet // - $newKeywords or $oldKeywords is provided if ( ! isset ( $ state [ $ key ] ) || func_num_args ( ) > 1 ) { $ old = empty ( $ oldKeywords ) ? parent :: get ( $ this -> generateInverseIndexKey ( $ key ) , [ ] ) : $ oldKeywords ; $ new = $ this -> mergeKeywords ? array_unique ( array_merge ( $ old , $ newKeywords ) ) : $ newKeywords ; $ state [ $ key ] = [ 'old' => $ old , 'new' => $ new , 'obsolete' => array_diff ( $ old , $ new ) , ] ; } $ this -> setKeywordsOperation ( false ) ; return $ state [ $ key ] ; }
Assembles a comparison of the provided keywords against the current state for a given key.

@param  string $key
@param  array  $newKeywords
@param  array  $oldKeywords
@return array
Assembles a comparison of the provided keywords against the current state for a given key .