Cake\Network\Response::vary PHP Method

vary() public method

Sets the Vary header for the response, if an array is passed, values will be imploded into a comma separated string. If no parameters are passed, then an array with the current Vary header value is returned
public vary ( string | array | null $cacheVariances = null ) : array | null
$cacheVariances string | array | null A single Vary string or an array containing the list for variances.
return array | null
    public function vary($cacheVariances = null)
    {
        if ($cacheVariances !== null) {
            $cacheVariances = (array) $cacheVariances;
            $this->_headers['Vary'] = implode(', ', $cacheVariances);
        }
        if (isset($this->_headers['Vary'])) {
            return explode(', ', $this->_headers['Vary']);
        }
        return null;
    }