protected function optimizeBranchesHead(array &$branches)
	{
		// Capture common output
		$before = $this->optimizeBranchesOutput($branches, 'head');

		// Move the branch output to the tail for branches that have no body
		foreach ($branches as &$branch)
		{
			if ($branch['body'] !== '' || !empty($branch['tail']))
			{
				continue;
			}

			$branch['tail'] = array_reverse($branch['head']);
			$branch['head'] = [];
		}
		unset($branch);

		return $before;
	}
protected function optimizeBranchesHead(array &$branches)
	{
		// Capture common output
		$before = $this->optimizeBranchesOutput($branches, 'head');

		// Move the branch output to the tail for branches that have no body
		foreach ($branches as &$branch)
		{
			if ($branch['body'] !== '' || !empty($branch['tail']))
			{
				continue;
			}

			$branch['tail'] = array_reverse($branch['head']);
			$branch['head'] = [];
		}
		unset($branch);

		return $before;
	}
protected function optimizeBranchesHead ( array & $ branches ) { // Capture common output $ before = $ this -> optimizeBranchesOutput ( $ branches , 'head' ) ; // Move the branch output to the tail for branches that have no body foreach ( $ branches as & $ branch ) { if ( $ branch [ 'body' ] !== '' || ! empty ( $ branch [ 'tail' ] ) ) { continue ; } $ branch [ 'tail' ] = array_reverse ( $ branch [ 'head' ] ) ; $ branch [ 'head' ] = [ ] ; } unset ( $ branch ) ; return $ before ; }
Optimize the "head" part of a series of branches in-place

@param  array    &$branches Array of branches, modified in-place
@return string[]            PHP expressions removed from the "head" part of the branches
Optimize the head part of a series of branches in - place