original_string: public function parse($string) {
  
  		$response = new Response();
  
  		// normalize line endings
  		$filtered = preg_replace("/(\n|\r){2,}/", PHP_EOL, $string);
  
  		$lines = explode(PHP_EOL, $filtered);
  
  		foreach($lines as $line) {
  			$matches = array();
  			if(preg_match('/^(\s*)\[(.*)\]$/', $line, $matches)) {
  				// entering new section
  				$depth = strlen($matches[1]);
  				// merge all lower sections
  				$this->completeSection($response, $depth);
  				$this->stack[$depth] = new Section($matches[2]);
  			} else if(preg_match('/^(\s*)(.*)=(.*)$/', $line, $matches)) {
  				$depth = strlen($matches[1]);
  				if(isset($this->stack[$depth])) {
  					$section = $this->stack[$depth];
  					$section->__set($matches[2], self::cast($matches[3]));
  				}
  			}
  		}
  		// merge remaining children into parents
  		$this->completeSection($response, 0);
  		
  		return $response;
  	}
code: public function parse($string) {
  
  		$response = new Response();
  
  		// normalize line endings
  		$filtered = preg_replace("/(\n|\r){2,}/", PHP_EOL, $string);
  
  		$lines = explode(PHP_EOL, $filtered);
  
  		foreach($lines as $line) {
  			$matches = array();
  			if(preg_match('/^(\s*)\[(.*)\]$/', $line, $matches)) {
  				// entering new section
  				$depth = strlen($matches[1]);
  				// merge all lower sections
  				$this->completeSection($response, $depth);
  				$this->stack[$depth] = new Section($matches[2]);
  			} else if(preg_match('/^(\s*)(.*)=(.*)$/', $line, $matches)) {
  				$depth = strlen($matches[1]);
  				if(isset($this->stack[$depth])) {
  					$section = $this->stack[$depth];
  					$section->__set($matches[2], self::cast($matches[3]));
  				}
  			}
  		}
  		// merge remaining children into parents
  		$this->completeSection($response, 0);
  		
  		return $response;
  	}
code_tokens: public function parse ( $ string ) { $ response = new Response ( ) ; // normalize line endings $ filtered = preg_replace ( "/(\n|\r){2,}/" , PHP_EOL , $ string ) ; $ lines = explode ( PHP_EOL , $ filtered ) ; foreach ( $ lines as $ line ) { $ matches = array ( ) ; if ( preg_match ( '/^(\s*)\[(.*)\]$/' , $ line , $ matches ) ) { // entering new section $ depth = strlen ( $ matches [ 1 ] ) ; // merge all lower sections $ this -> completeSection ( $ response , $ depth ) ; $ this -> stack [ $ depth ] = new Section ( $ matches [ 2 ] ) ; } else if ( preg_match ( '/^(\s*)(.*)=(.*)$/' , $ line , $ matches ) ) { $ depth = strlen ( $ matches [ 1 ] ) ; if ( isset ( $ this -> stack [ $ depth ] ) ) { $ section = $ this -> stack [ $ depth ] ; $ section -> __set ( $ matches [ 2 ] , self :: cast ( $ matches [ 3 ] ) ) ; } } } // merge remaining children into parents $ this -> completeSection ( $ response , 0 ) ; return $ response ; }
docstring: Parses the passed response and passes the key-value pairs to references.
  @param string $string the string to parse
  @return Response the response
docstring_tokens: Parses the passed response and passes the key - value pairs to references .