protected function config($cacheKey, $cacheOptions)
    {
        $opts = [];

        if (is_numeric($cacheKey)) {
            if (is_array($cacheOptions)) {
                // Most explicit configuration provided
                $opts = $cacheOptions;
                $relatedModel = array_get($opts, 'model');
            } else {
                // Smallest number of options provided, figure out the rest
                $relatedModel = $cacheOptions;
            }
        } else {
            // Semi-verbose configuration provided
            $relatedModel = $cacheOptions;
            $opts['field'] = $cacheKey;

            if (is_array($cacheOptions)) {
                if (isset($cacheOptions[3])) {
                    $opts['key'] = $cacheOptions[3];
                }
                if (isset($cacheOptions[2])) {
                    $opts['foreignKey'] = $cacheOptions[2];
                }
                if (isset($cacheOptions[1])) {
                    $opts['columnToSum'] = $cacheOptions[1];
                }
                if (isset($cacheOptions[0])) {
                    $relatedModel = $cacheOptions[0];
                }
            }
        }

        return $this->defaults($opts, $relatedModel);
    }
protected function config($cacheKey, $cacheOptions)
    {
        $opts = [];

        if (is_numeric($cacheKey)) {
            if (is_array($cacheOptions)) {
                // Most explicit configuration provided
                $opts = $cacheOptions;
                $relatedModel = array_get($opts, 'model');
            } else {
                // Smallest number of options provided, figure out the rest
                $relatedModel = $cacheOptions;
            }
        } else {
            // Semi-verbose configuration provided
            $relatedModel = $cacheOptions;
            $opts['field'] = $cacheKey;

            if (is_array($cacheOptions)) {
                if (isset($cacheOptions[3])) {
                    $opts['key'] = $cacheOptions[3];
                }
                if (isset($cacheOptions[2])) {
                    $opts['foreignKey'] = $cacheOptions[2];
                }
                if (isset($cacheOptions[1])) {
                    $opts['columnToSum'] = $cacheOptions[1];
                }
                if (isset($cacheOptions[0])) {
                    $relatedModel = $cacheOptions[0];
                }
            }
        }

        return $this->defaults($opts, $relatedModel);
    }
protected function config ( $ cacheKey , $ cacheOptions ) { $ opts = [ ] ; if ( is_numeric ( $ cacheKey ) ) { if ( is_array ( $ cacheOptions ) ) { // Most explicit configuration provided $ opts = $ cacheOptions ; $ relatedModel = array_get ( $ opts , 'model' ) ; } else { // Smallest number of options provided, figure out the rest $ relatedModel = $ cacheOptions ; } } else { // Semi-verbose configuration provided $ relatedModel = $ cacheOptions ; $ opts [ 'field' ] = $ cacheKey ; if ( is_array ( $ cacheOptions ) ) { if ( isset ( $ cacheOptions [ 3 ] ) ) { $ opts [ 'key' ] = $ cacheOptions [ 3 ] ; } if ( isset ( $ cacheOptions [ 2 ] ) ) { $ opts [ 'foreignKey' ] = $ cacheOptions [ 2 ] ; } if ( isset ( $ cacheOptions [ 1 ] ) ) { $ opts [ 'columnToSum' ] = $ cacheOptions [ 1 ] ; } if ( isset ( $ cacheOptions [ 0 ] ) ) { $ relatedModel = $ cacheOptions [ 0 ] ; } } } return $ this -> defaults ( $ opts , $ relatedModel ) ; }
Takes a registered sum cache, and setups up defaults.

@param string $cacheKey
@param array $cacheOptions
@return array
Takes a registered sum cache and setups up defaults .