original_string: private function splitIntoBlocks($css)
  	{
  		if (is_array($css)) {
  			return $css;
  		}
  
  		$blocks = array();
  		$css    = $this->stripComments($css);
  		$offset = 0;
  
  		// catch all @feature {...} blocks
  		if (preg_match_all('/(@[^{]+){([^{}]*{[^}]*})*\s*}/ism', $css, $matches, PREG_OFFSET_CAPTURE) > 0) {
  			foreach ($matches[0] as $key => $match) {
  				$atRule              = trim($matches[1][$key][0]);
  				list($rules, $start) = $match;
  
  				if ($start > $offset) {
  					// make previous selectors into their own block
  					$block = trim(substr($css, $offset, $start - $offset));
  					if (!empty($block)) {
  						$blocks[] = $this->summarizeBlock($block);
  					}
  				}
  				$offset = $start + strlen($rules);
  
  				// currently only @media rules need to be parsed and counted for IE9 selectors
  				if (strpos($atRule, '@media') === 0) {
  					$block  = $this->summarizeBlock(substr($rules, strpos($rules, '{') + 1, -1));
  				}
  				else {
  					$block  = array(
  						'count'   => 1,
  						'rules'   => array(
  							array(
  								'rule' => substr($rules, strpos($rules, '{') + 1, -1),
  								'count' => 1,
  							)
  						),
  
  					);
  				}
  
  				$block['at-rule'] = $atRule;
  				$blocks[]               = $block;
  			}
  
  			// catch any remaining as it's own block
  			$block = trim(substr($css, $offset));
  			if (!empty($block)) {
  				$blocks[] = $this->summarizeBlock($block);
  			}
  		}
  		else {
  			$blocks[] = $this->summarizeBlock($css);
  		}
  
  		return $blocks;
  	}
code: private function splitIntoBlocks($css)
  	{
  		if (is_array($css)) {
  			return $css;
  		}
  
  		$blocks = array();
  		$css    = $this->stripComments($css);
  		$offset = 0;
  
  		// catch all @feature {...} blocks
  		if (preg_match_all('/(@[^{]+){([^{}]*{[^}]*})*\s*}/ism', $css, $matches, PREG_OFFSET_CAPTURE) > 0) {
  			foreach ($matches[0] as $key => $match) {
  				$atRule              = trim($matches[1][$key][0]);
  				list($rules, $start) = $match;
  
  				if ($start > $offset) {
  					// make previous selectors into their own block
  					$block = trim(substr($css, $offset, $start - $offset));
  					if (!empty($block)) {
  						$blocks[] = $this->summarizeBlock($block);
  					}
  				}
  				$offset = $start + strlen($rules);
  
  				// currently only @media rules need to be parsed and counted for IE9 selectors
  				if (strpos($atRule, '@media') === 0) {
  					$block  = $this->summarizeBlock(substr($rules, strpos($rules, '{') + 1, -1));
  				}
  				else {
  					$block  = array(
  						'count'   => 1,
  						'rules'   => array(
  							array(
  								'rule' => substr($rules, strpos($rules, '{') + 1, -1),
  								'count' => 1,
  							)
  						),
  
  					);
  				}
  
  				$block['at-rule'] = $atRule;
  				$blocks[]               = $block;
  			}
  
  			// catch any remaining as it's own block
  			$block = trim(substr($css, $offset));
  			if (!empty($block)) {
  				$blocks[] = $this->summarizeBlock($block);
  			}
  		}
  		else {
  			$blocks[] = $this->summarizeBlock($css);
  		}
  
  		return $blocks;
  	}
code_tokens: private function splitIntoBlocks ( $ css ) { if ( is_array ( $ css ) ) { return $ css ; } $ blocks = array ( ) ; $ css = $ this -> stripComments ( $ css ) ; $ offset = 0 ; // catch all @feature {...} blocks if ( preg_match_all ( '/(@[^{]+){([^{}]*{[^}]*})*\s*}/ism' , $ css , $ matches , PREG_OFFSET_CAPTURE ) > 0 ) { foreach ( $ matches [ 0 ] as $ key => $ match ) { $ atRule = trim ( $ matches [ 1 ] [ $ key ] [ 0 ] ) ; list ( $ rules , $ start ) = $ match ; if ( $ start > $ offset ) { // make previous selectors into their own block $ block = trim ( substr ( $ css , $ offset , $ start - $ offset ) ) ; if ( ! empty ( $ block ) ) { $ blocks [ ] = $ this -> summarizeBlock ( $ block ) ; } } $ offset = $ start + strlen ( $ rules ) ; // currently only @media rules need to be parsed and counted for IE9 selectors if ( strpos ( $ atRule , '@media' ) === 0 ) { $ block = $ this -> summarizeBlock ( substr ( $ rules , strpos ( $ rules , '{' ) + 1 , - 1 ) ) ; } else { $ block = array ( 'count' => 1 , 'rules' => array ( array ( 'rule' => substr ( $ rules , strpos ( $ rules , '{' ) + 1 , - 1 ) , 'count' => 1 , ) ) , ) ; } $ block [ 'at-rule' ] = $ atRule ; $ blocks [ ] = $ block ; } // catch any remaining as it's own block $ block = trim ( substr ( $ css , $ offset ) ) ; if ( ! empty ( $ block ) ) { $ blocks [ ] = $ this -> summarizeBlock ( $ block ) ; } } else { $ blocks [ ] = $ this -> summarizeBlock ( $ css ) ; } return $ blocks ; }
docstring: Splits the css into blocks maintaining the order of the rules and media queries
  
  This makes it easier to split the CSS into files when a media query might be split
  
  @param $css
  @return array
docstring_tokens: Splits the css into blocks maintaining the order of the rules and media queries