protected function printArray(array $value, $level = 1)
    {
        if (count($value) < 1) {
            return "[]";
        }

        // Open bracket.
        $result  = "[" . PHP_EOL;
        // This approach is much faster than the one that uses array_values function.
        // To make it even faster, we cache the value.
        $isAssoc = (array_keys($value) !== range(0, count($value) - 1));
        // We'll need this variable to determine whether we need to omit remaining elements.
        $counter = 0;

        foreach ($value as $key => $element) {
            $counter++;

            // Decide whether to omit the rest of the values in given array
            // depending on array_max_elements value.
            if ($counter > $this->config["array_max_elements"]) {
                $result .= str_repeat($this->config["array_indenting"], $level);
                $result .= "..." . PHP_EOL;

                break;
            }

            if (is_array($element)) {
                $element = $this->printArray($element, $level + 1);
            } elseif (is_object($element)) {
                $element = $this->printObject($element, $level + 1);
            } else {
                $element = $this->dump($element);
            }

            // Maintain the proper indenting.
            $result .= str_repeat($this->config["array_indenting"], $level);

            if ( ! $isAssoc) {
                $result .= $element;
            } else {
                $result .= sprintf("%s => %s", $this->dump($key), $element);
            }

            $result .= "," . PHP_EOL;
        }

        // Maintain proper indenting.
        $result .= str_repeat($this->config["array_indenting"], $level - 1);
        // Closing bracket.
        $result .= "]";

        return $result;
    }