public function transform($array)
    {
        if (null === $array) {
            return '';
        }

        if (!is_array($array)) {
            throw new TransformationFailedException('Expected an array.');
        }

        foreach ($array as &$value) {
            $value = sprintf('%s%s%s',
                str_repeat(' ', $this->paddingLeft),
                $value,
                str_repeat(' ', $this->paddingRight)
            );
        }

        $string = trim(implode($this->delimiter, $array));

        return $string;
    }
public function transform($array)
    {
        if (null === $array) {
            return '';
        }

        if (!is_array($array)) {
            throw new TransformationFailedException('Expected an array.');
        }

        foreach ($array as &$value) {
            $value = sprintf('%s%s%s',
                str_repeat(' ', $this->paddingLeft),
                $value,
                str_repeat(' ', $this->paddingRight)
            );
        }

        $string = trim(implode($this->delimiter, $array));

        return $string;
    }
public function transform ( $ array ) { if ( null === $ array ) { return '' ; } if ( ! is_array ( $ array ) ) { throw new TransformationFailedException ( 'Expected an array.' ) ; } foreach ( $ array as & $ value ) { $ value = sprintf ( '%s%s%s' , str_repeat ( ' ' , $ this -> paddingLeft ) , $ value , str_repeat ( ' ' , $ this -> paddingRight ) ) ; } $ string = trim ( implode ( $ this -> delimiter , $ array ) ) ; return $ string ; }
Transforms an array into a delimited string

@param array $array Array to transform

@return string

@throws TransformationFailedException If the given value is not an array
Transforms an array into a delimited string