function implode($col, string $glue = ', ') {
        $data = '';
        
        foreach($this->data as $key => $val) {
            if(\is_array($val)) {
                if(!isset($val[$col])) {
                    throw new \BadMethodCallException('Specified key "'.$col.'" does not exist on array');
                }
                
                $data .= $glue.$val[$col];
            } elseif(\is_object($val)) {
                if(!isset($val->$col)) {
                    throw new \BadMethodCallException('Specified key "'.$col.'" does not exist on object');
                }
                
                $data .= $glue.$val->$col;
            } else {
                $data .= $glue.$val;
            }
        }
        
        return \substr($data, \strlen($glue));
    }
function implode($col, string $glue = ', ') {
        $data = '';
        
        foreach($this->data as $key => $val) {
            if(\is_array($val)) {
                if(!isset($val[$col])) {
                    throw new \BadMethodCallException('Specified key "'.$col.'" does not exist on array');
                }
                
                $data .= $glue.$val[$col];
            } elseif(\is_object($val)) {
                if(!isset($val->$col)) {
                    throw new \BadMethodCallException('Specified key "'.$col.'" does not exist on object');
                }
                
                $data .= $glue.$val->$col;
            } else {
                $data .= $glue.$val;
            }
        }
        
        return \substr($data, \strlen($glue));
    }
function implode ( $ col , string $ glue = ', ' ) { $ data = '' ; foreach ( $ this -> data as $ key => $ val ) { if ( \ is_array ( $ val ) ) { if ( ! isset ( $ val [ $ col ] ) ) { throw new \ BadMethodCallException ( 'Specified key "' . $ col . '" does not exist on array' ) ; } $ data .= $ glue . $ val [ $ col ] ; } elseif ( \ is_object ( $ val ) ) { if ( ! isset ( $ val -> $ col ) ) { throw new \ BadMethodCallException ( 'Specified key "' . $ col . '" does not exist on object' ) ; } $ data .= $ glue . $ val -> $ col ; } else { $ data .= $ glue . $ val ; } } return \ substr ( $ data , \ strlen ( $ glue ) ) ; }
Joins the items in a collection. Its arguments depend on the type of items in the collection.
If the collection contains arrays or objects, you should pass the key of the attributes you wish to join, and the "glue" string you wish to place between the values.
@param mixed  $col
@param string $glue
@return string
@throws \BadMethodCallException
Joins the items in a collection . Its arguments depend on the type of items in the collection . If the collection contains arrays or objects you should pass the key of the attributes you wish to join and the glue string you wish to place between the values .