original_string: protected function _buildJoinPart($parts, $query, $generator)
      {
          $joins = '';
          foreach ($parts as $join) {
              $subquery = $join['table'] instanceof Query || $join['table'] instanceof QueryExpression;
              if ($join['table'] instanceof ExpressionInterface) {
                  $join['table'] = $join['table']->sql($generator);
              }
  
              if ($subquery) {
                  $join['table'] = '(' . $join['table'] . ')';
              }
  
              $joins .= sprintf(' %s JOIN %s %s', $join['type'], $join['table'], $join['alias']);
  
              $condition = '';
              if (isset($join['conditions']) && $join['conditions'] instanceof ExpressionInterface) {
                  $condition = $join['conditions']->sql($generator);
              }
              if (strlen($condition)) {
                  $joins .= " ON {$condition}";
              } else {
                  $joins .= ' ON 1 = 1';
              }
          }
  
          return $joins;
      }
code: protected function _buildJoinPart($parts, $query, $generator)
      {
          $joins = '';
          foreach ($parts as $join) {
              $subquery = $join['table'] instanceof Query || $join['table'] instanceof QueryExpression;
              if ($join['table'] instanceof ExpressionInterface) {
                  $join['table'] = $join['table']->sql($generator);
              }
  
              if ($subquery) {
                  $join['table'] = '(' . $join['table'] . ')';
              }
  
              $joins .= sprintf(' %s JOIN %s %s', $join['type'], $join['table'], $join['alias']);
  
              $condition = '';
              if (isset($join['conditions']) && $join['conditions'] instanceof ExpressionInterface) {
                  $condition = $join['conditions']->sql($generator);
              }
              if (strlen($condition)) {
                  $joins .= " ON {$condition}";
              } else {
                  $joins .= ' ON 1 = 1';
              }
          }
  
          return $joins;
      }
code_tokens: protected function _buildJoinPart ( $ parts , $ query , $ generator ) { $ joins = '' ; foreach ( $ parts as $ join ) { $ subquery = $ join [ 'table' ] instanceof Query || $ join [ 'table' ] instanceof QueryExpression ; if ( $ join [ 'table' ] instanceof ExpressionInterface ) { $ join [ 'table' ] = $ join [ 'table' ] -> sql ( $ generator ) ; } if ( $ subquery ) { $ join [ 'table' ] = '(' . $ join [ 'table' ] . ')' ; } $ joins .= sprintf ( ' %s JOIN %s %s' , $ join [ 'type' ] , $ join [ 'table' ] , $ join [ 'alias' ] ) ; $ condition = '' ; if ( isset ( $ join [ 'conditions' ] ) && $ join [ 'conditions' ] instanceof ExpressionInterface ) { $ condition = $ join [ 'conditions' ] -> sql ( $ generator ) ; } if ( strlen ( $ condition ) ) { $ joins .= " ON {$condition}" ; } else { $ joins .= ' ON 1 = 1' ; } } return $ joins ; }
docstring: Helper function used to build the string representation of multiple JOIN clauses,
  it constructs the joins list taking care of aliasing and converting
  expression objects to string in both the table to be joined and the conditions
  to be used.
  
  @param array $parts list of joins to be transformed to string
  @param \Cake\Database\Query $query The query that is being compiled
  @param \Cake\Database\ValueBinder $generator the placeholder generator to be used in expressions
  @return string
docstring_tokens: Helper function used to build the string representation of multiple JOIN clauses it constructs the joins list taking care of aliasing and converting expression objects to string in both the table to be joined and the conditions to be used .