src/Cookie.php
protected static function cookieParams($args = array())
	{
		$params = array();
		if (count($args) == 1) {
			if (is_array($args[0])) {
				$params = $args[0];
			} else {
				$params['value'] = $args[0];
			}
		} elseif (count($args) == 2) {
			if (is_string($args[1])) {
				$params['name'] = $args[1];
			} else {
				$params = $args[1];
			}
			$params['value'] = $args[0];
		}
		$domainRegex = '/([^.]+\.[a-z]{2,})(:\d{1,4})?$/i';
		$paramsDefault = array(
			// 'name'		=> 'vars',
			'value'		=> '',
			// 'lifetime'	=> null,				// can pass lifetime in lieu of expiry (ala session_set_cookie_params)
												//		lifetime param takes precedence
			'domain'	=> preg_match($domainRegex, $_SERVER['HTTP_HOST'], $matches)
						? '.'.$matches[1]
						: '',
			/*
			'expiry'	=> time()+60*60*24*30,	// 30 Days in future;  set to zero to expire when browser closes
			'path'		=> '/',
			'secure'	=> false,
			'httponly'	=> false,
			*/
		);
		$params = array_merge($paramsDefault, self::$cfgStatic, $params);
		if (isset($params['lifetime'])) {
			$params['expiry'] = time() + $params['lifetime'];
		} elseif ($params['expiry'] < time() && $params['expiry'] != 0) {
			// treat as TTL
			$params['expiry'] += time();
		}
		return $params;
	}
protected static function cookieParams($args = array())
	{
		$params = array();
		if (count($args) == 1) {
			if (is_array($args[0])) {
				$params = $args[0];
			} else {
				$params['value'] = $args[0];
			}
		} elseif (count($args) == 2) {
			if (is_string($args[1])) {
				$params['name'] = $args[1];
			} else {
				$params = $args[1];
			}
			$params['value'] = $args[0];
		}
		$domainRegex = '/([^.]+\.[a-z]{2,})(:\d{1,4})?$/i';
		$paramsDefault = array(
			// 'name'		=> 'vars',
			'value'		=> '',
			// 'lifetime'	=> null,				// can pass lifetime in lieu of expiry (ala session_set_cookie_params)
												//		lifetime param takes precedence
			'domain'	=> preg_match($domainRegex, $_SERVER['HTTP_HOST'], $matches)
						? '.'.$matches[1]
						: '',
			/*
			'expiry'	=> time()+60*60*24*30,	// 30 Days in future;  set to zero to expire when browser closes
			'path'		=> '/',
			'secure'	=> false,
			'httponly'	=> false,
			*/
		);
		$params = array_merge($paramsDefault, self::$cfgStatic, $params);
		if (isset($params['lifetime'])) {
			$params['expiry'] = time() + $params['lifetime'];
		} elseif ($params['expiry'] < time() && $params['expiry'] != 0) {
			// treat as TTL
			$params['expiry'] += time();
		}
		return $params;
	}
protected static function cookieParams ( $ args = array ( ) ) { $ params = array ( ) ; if ( count ( $ args ) == 1 ) { if ( is_array ( $ args [ 0 ] ) ) { $ params = $ args [ 0 ] ; } else { $ params [ 'value' ] = $ args [ 0 ] ; } } elseif ( count ( $ args ) == 2 ) { if ( is_string ( $ args [ 1 ] ) ) { $ params [ 'name' ] = $ args [ 1 ] ; } else { $ params = $ args [ 1 ] ; } $ params [ 'value' ] = $ args [ 0 ] ; } $ domainRegex = '/([^.]+\.[a-z]{2,})(:\d{1,4})?$/i' ; $ paramsDefault = array ( // 'name'		=> 'vars', 'value' => '' , // 'lifetime'	=> null,				// can pass lifetime in lieu of expiry (ala session_set_cookie_params) //		lifetime param takes precedence 'domain' => preg_match ( $ domainRegex , $ _SERVER [ 'HTTP_HOST' ] , $ matches ) ? '.' . $ matches [ 1 ] : '' , /*
			'expiry'	=> time()+60*60*24*30,	// 30 Days in future;  set to zero to expire when browser closes
			'path'		=> '/',
			'secure'	=> false,
			'httponly'	=> false,
			*/ ) ; $ params = array_merge ( $ paramsDefault , self :: $ cfgStatic , $ params ) ; if ( isset ( $ params [ 'lifetime' ] ) ) { $ params [ 'expiry' ] = time ( ) + $ params [ 'lifetime' ] ; } elseif ( $ params [ 'expiry' ] < time ( ) && $ params [ 'expiry' ] != 0 ) { // treat as TTL $ params [ 'expiry' ] += time ( ) ; } return $ params ; }
return cookie parameters

@param array $args as passed to setCookieValue

@return array
return cookie parameters