Implodes an array with ',' and 'and' before last element

@param array  $pieces Array to be imploded
@param string $last   String to join the last item
@param string $glue   String to join the other items

@return string
966625
public static function naturalLanguageJoin(
        array $arr,
        string $last = null,
        string $glue = null
    ) {
        $last_item = array_pop($arr);
        if ($arr) {
            return implode($glue ?? ', ', $arr)
                . ' ' . ($last ?? 'and') . ' '
                . $last_item;
        }
        return $last_item;
    }
590183
public function fullMessages($glue = null)
    {
        $fullMessages = array();
        
        foreach ($this->errors as $attr => $errors) {
            foreach ($errors as $msg) {
                if ($attr == self::BASE_ERRORS_INDEX)
                    $fullMessages[] = $msg;
                else
                    $fullMessages[] = $this->_propper_attr($attr) . ' ' . $msg;
            }
        }
        
        if ($glue !== null)
            return implode($glue, $fullMessages);
        else
            return $fullMessages;
    }
526710
public function implode($column, $glue = '')
    {
        $result = $this->getBuilder()->implode($column, $glue);

        // Reset query builder
        $this->resetBuilder();

        return $result;
    }
1063328
public function implodeSqlClauses($clauses, $glue = ',')
    {
        $statements = [];

        foreach($clauses as $clause){
            $statements[] = $clause->getSql($this);
        }

        return implode($statements, $glue);
    }
646753
public static function implode($segments, $separator = self::SEPARATOR)
	{
		return (string) Uzi::join($separator, $segments, true);
	}
878533
public function implode($value, $glue = null): string
    {
        return $this->reduce(function ($carry, $item) use ($value, $glue) {
            $currentGlue = $glue;
            if (is_string($item) && $currentGlue === null) {
                $currentGlue = $value;
            }
            if ($carry) {
                $carry .= $currentGlue;
            }

            if ($value && ($item instanceof ArrayAccess || is_array($item))) {
                $item = $item[$value];
            }

            return $carry . $item;
        }, '');
    }
1364951
private function implodePregQuote($glue, array $pieces, $delimiter = null)
    {
        foreach ($pieces as &$p) {
            $p = preg_quote($p, $delimiter);
        }
        return implode($glue, $pieces);
    }
1237564
private static function recursiveImplode($glue, $pieces)
    {
        if (is_array($pieces)) {
            $strings = array();
            foreach ($pieces as $key => $piece) {
                if (is_int($key) || $key !== self::ATTRIBUTES) {
                    if (is_array($piece)) {
                        $strings[$key] = static::recursiveImplode($glue, $piece);
                    } else {
                        $strings[$key] = (string) $piece;
                    }
                }
            }
            return implode($glue, $strings);
        } else {
            return (string) $pieces;
        }
    }
699750
public function fullMessages($glue = null)
    {
        $fullMessages = array();
        
        foreach ($this->errors as $attr => $errors) {
            if ($attr == self::BASE_ERRORS_INDEX) {
                $fullMessages = array_merge($fullMessages, $errors);
            } else {
                foreach ($errors as $message) {
                    $fullMessages[] = $this->fullMessage($attr, $message);
                }
            }
        }
        
        if ($glue !== null) {
            return implode($glue, $fullMessages);
        } else {
            return $fullMessages;
        }
    }
1174276
protected function _implodeRecursive(array $pieces)
    {
        $values = array();
        foreach ($pieces as $item) {
            if (is_array($item)) {
                $values[] = $this->_implodeRecursive($item);
            } else {
                $values[] = $item;
            }
        }

        return implode(', ', $values);
    }
204683
public static function __string($value, $glue = ', ')
    {
        if (is_object($value)) {
            if (method_exists($value, '__toString')) {
                return $value->__toString();
            }
            if ($value instanceof ArrayAccess) {
                return implode($glue, $value);
            }
            return get_class($value);
        } elseif (is_array($value)) {
            return implode($glue, $value);
        } elseif (is_bool($value)) {
            return (true===$value ? 'true' : 'false');
        } elseif (is_callable($value)) {
            return self::__closurable($value);
        }
        return (string) $value;
    }
828604
public function implode($value, $glue = ', ')
    {
        $first = $this->first();

        if (is_array($first) || is_object($first)) {
            return implode($glue, $this->pluck($value)->all());
        }

        return implode($value, $this->items);
    }
549832
public function joinString($join=null, $glue=", ")
    {
        $join = LambdaUtils::toSelectCallable($join);
        $temp = $this->select($join)->toArray();
        return implode($glue, $temp);
    }
1184301
protected function implodeAssociative($glue, array $array)
    {
        $result = '';

        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $value = implode('|', $value);
            }

            $result .= $key . $glue . $value . PHP_EOL;
        }

        return $result;
    }
861464
public function implode($glue = '', callable $callback = null)
    {
        return implode($glue, $callback ? array_map($callback, $this->items) : $this->items);
    }
1271234
private function splitToLast($key)
    {
        $split = explode($this->delimiter, $key);
        $key = implode($this->delimiter, array_slice($split, 0, -1));
        $last = end($split);

        return [$key, $last];
    }
383875
public static function splitCamelCase(string $string, string $glue = ' '): string
    {
        $expression = '/(?#! splitCamelCase Rev:20140412)
                        # Split camelCase "words". Two global alternatives. Either g1of2:
                          (?<=[a-z])      # Position is after a lowercase,
                          (?=[A-Z])       # and before an uppercase letter.
                        | (?<=[A-Z])      # Or g2of2; Position is after uppercase,
                          (?=[A-Z][a-z])  # and before upper-then-lower case.
                        /x';
        $split = preg_split($expression, $string);
        $output = [];
        $count = count($split);
        for ($i = 0; $i < $count; ++$i) { // @todo: rework me with foreach() cycle
            $word = strtolower($split[$i]);
            if ($i === 0) {
                $word = ucfirst($word);
            }
            $output[] = $word;
        }

        return implode($glue, $output);
    }