Private/Polyfony/Response/HTML.php
public static function setLinks(array $links, bool $replace_existing=false) :void {
		// if we want to purge existing links
		!$replace_existing ?: self::$_links = []; 
		// href is the key for storing links
		foreach($links as $href_or_index => $attributes_or_href) {
			// if arguments are provided
			if(is_array($attributes_or_href)) {
				// if we have a stylesheet
				if(
					// if a rel is set, and it's not a stylesheet
					!array_key_exists('rel',$attributes_or_href) || 
					// and it's not a stylesheet
					$attributes_or_href['rel'] == 'stylesheet'
				) {
					// also rewrite the path of assets that used relative shortcuts
					$attributes_or_href['href'] 	= self::getPublicAssetPath($href_or_index,'Css');
					// force the type
					$attributes_or_href['type'] 	= 'text/css';
					// force the rel
					$attributes_or_href['rel'] 		= 'stylesheet';
					// if the media key is implicit
					array_key_exists('media', $attributes_or_href) ?: $attributes_or_href['media'] = 'all';
					// push the slightly alternated stylesheet
					self::$_links[$href_or_index] = $attributes_or_href;
				}
				// otherwize we don't know what we're dealing with
				else {
					// just set its href
					$attributes_or_href['href'] = $href_or_index;
					// push that link and its attributes
					self::$_links[$href_or_index] = $attributes_or_href;
				}
			}
			// else only an href is provided, we assume it is a stylesheet
			else {
				// push that link alone
				self::$_links[$attributes_or_href] = [
					// we assume it is a generic all media stylesheet
					'rel'	=>'stylesheet',
					'type'	=>'text/css',
					'media'	=>'all',
					// and we set its href
					'href'	=>self::getPublicAssetPath($attributes_or_href, 'Css')
				];
			}
		}
	}
public static function setLinks(array $links, bool $replace_existing=false) :void {
		// if we want to purge existing links
		!$replace_existing ?: self::$_links = []; 
		// href is the key for storing links
		foreach($links as $href_or_index => $attributes_or_href) {
			// if arguments are provided
			if(is_array($attributes_or_href)) {
				// if we have a stylesheet
				if(
					// if a rel is set, and it's not a stylesheet
					!array_key_exists('rel',$attributes_or_href) || 
					// and it's not a stylesheet
					$attributes_or_href['rel'] == 'stylesheet'
				) {
					// also rewrite the path of assets that used relative shortcuts
					$attributes_or_href['href'] 	= self::getPublicAssetPath($href_or_index,'Css');
					// force the type
					$attributes_or_href['type'] 	= 'text/css';
					// force the rel
					$attributes_or_href['rel'] 		= 'stylesheet';
					// if the media key is implicit
					array_key_exists('media', $attributes_or_href) ?: $attributes_or_href['media'] = 'all';
					// push the slightly alternated stylesheet
					self::$_links[$href_or_index] = $attributes_or_href;
				}
				// otherwize we don't know what we're dealing with
				else {
					// just set its href
					$attributes_or_href['href'] = $href_or_index;
					// push that link and its attributes
					self::$_links[$href_or_index] = $attributes_or_href;
				}
			}
			// else only an href is provided, we assume it is a stylesheet
			else {
				// push that link alone
				self::$_links[$attributes_or_href] = [
					// we assume it is a generic all media stylesheet
					'rel'	=>'stylesheet',
					'type'	=>'text/css',
					'media'	=>'all',
					// and we set its href
					'href'	=>self::getPublicAssetPath($attributes_or_href, 'Css')
				];
			}
		}
	}
public static function setLinks ( array $ links , bool $ replace_existing = false ) : void { // if we want to purge existing links ! $ replace_existing ? : self :: $ _links = [ ] ; // href is the key for storing links foreach ( $ links as $ href_or_index => $ attributes_or_href ) { // if arguments are provided if ( is_array ( $ attributes_or_href ) ) { // if we have a stylesheet if ( // if a rel is set, and it's not a stylesheet ! array_key_exists ( 'rel' , $ attributes_or_href ) || // and it's not a stylesheet $ attributes_or_href [ 'rel' ] == 'stylesheet' ) { // also rewrite the path of assets that used relative shortcuts $ attributes_or_href [ 'href' ] = self :: getPublicAssetPath ( $ href_or_index , 'Css' ) ; // force the type $ attributes_or_href [ 'type' ] = 'text/css' ; // force the rel $ attributes_or_href [ 'rel' ] = 'stylesheet' ; // if the media key is implicit array_key_exists ( 'media' , $ attributes_or_href ) ? : $ attributes_or_href [ 'media' ] = 'all' ; // push the slightly alternated stylesheet self :: $ _links [ $ href_or_index ] = $ attributes_or_href ; } // otherwize we don't know what we're dealing with else { // just set its href $ attributes_or_href [ 'href' ] = $ href_or_index ; // push that link and its attributes self :: $ _links [ $ href_or_index ] = $ attributes_or_href ; } } // else only an href is provided, we assume it is a stylesheet else { // push that link alone self :: $ _links [ $ attributes_or_href ] = [ // we assume it is a generic all media stylesheet 'rel' => 'stylesheet' , 'type' => 'text/css' , 'media' => 'all' , // and we set its href 'href' => self :: getPublicAssetPath ( $ attributes_or_href , 'Css' ) ] ; } } }
set links for the current HTML page
set links for the current HTML page