Display the contents of the file in a pretty formatted way

@param array           $contents
@param array           $rawContents
@param OutputInterface $output
@param string|null     $k
325100
protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
    {
        $origK = $k;
        foreach ($contents as $key => $value) {
            if ($k === null && !in_array($key, array('config', 'repositories'))) {
                continue;
            }

            $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;

            if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
                $k .= preg_replace('{^config\.}', '', $key . '.');
                $this->listConfiguration($value, $rawVal, $output, $k);

                if (substr_count($k, '.') > 1) {
                    $k = str_split($k, strrpos($k, '.', -2));
                    $k = $k[0] . '.';
                } else {
                    $k = $origK;
                }

                continue;
            }

            if (is_array($value)) {
                $value = array_map(function ($val) {
                    return is_array($val) ? json_encode($val) : $val;
                }, $value);

                $value = '['.implode(', ', $value).']';
            }

            if (is_bool($value)) {
                $value = var_export($value, true);
            }

            if (is_string($rawVal) && $rawVal != $value) {
                $this->getIO()->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>');
            } else {
                $this->getIO()->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>');
            }
        }
    }
385884
private function createTempFileWithContents(string $contents) : string
    {
        $filename = sprintf('%s.md', uniqid('KAC', true));
        $path = sprintf('%s/%s', sys_get_temp_dir(), $filename);
        file_put_contents($path, $contents);
        return $path;
    }
399524
protected function printContent(vfsStreamContent $content)
    {
        fwrite($this->out, str_repeat('  ', $this->depth) . '- ' . $content->getName() . "\n");
    }
711543
public function addResponseContent(ResponseContent $content, $key = '')
    {
        if (empty($key)) {
            $this->responseContent[] = $content->toArray();
        } else {
            $this->responseContent[$key] = $content->toArray();
        }

        return $this;
    }
1082924
public function putString($remote, $contents)
    {
        foreach ($this->connections as $connection) {
            $connection->putString($remote, $contents);
        }
    }
996958
public void writeContent(final OutputStream result) throws IOException
    {
        if(this.mode == MODE_SINGLE) {
        	headerAll.writeContent(result);
        } else if(this.mode == MODE_MULTIPLE) {
            if(headerFirst != null) {
            	headerFirst.writeContent(result);
            }
            if(headerLeft != null) {
                headerLeft.writeContent(result);
            }
            if(headerRight != null) {
                headerRight.writeContent(result);
            }
            if(headerAll != null) {
                headerAll.writeContent(result);
            }
        }
    }
1105272
public function putContents($file, $contents)
    {
        $dir = dirname($file);
        if (! file_exists($dir)) throw new Exception("Can not put contents, not exists dirctory. -> {$dir}");
        file_put_contents($file, $contents);
    }
896202
public function compactContents($file, $contents)
    {
        foreach ($this->compactors as $compactor) {
            /** @var $compactor CompactorInterface */
            if ($compactor->supports($file)) {
                $contents = $compactor->compact($contents);
            }
        }

        return $contents;
    }
114882
public static function filePutContents($filepath, $contents, $message, $usedate = true)
    {
        $suffix = '';

        // Check date
        if ($usedate) {
            $suffix = ' on '.date('l jS \of F Y h:i:s A');
        }

        // Update contents
        $contents = !empty($contents) ? $contents."\n" : $contents;

        // Copy file contents
        file_put_contents($filepath, "/**\n * ".$message.$suffix.".\n */\n\n".$contents);
    }
909643
private static function updateIdxSiteContents(array $contents_inserted, array $contents_removed)
    {
        if (null === $site = self::$_application->getSite()) {
            return;
        }

        self::$em->getRepository('BackBee\ClassContent\Indexes\IdxContentContent')
                ->replaceIdxSiteContents($site, array_diff($contents_inserted, self::$_site_content_done))
                ->removeIdxSiteContents($site, $contents_removed);

        self::$_site_content_done = array_merge(self::$_site_content_done, $contents_inserted);
    }
427146
public function toContent($contents, $format, $options = array())
	{
		if (!($contents instanceof Registry))
		{
			$contents = new Registry($contents);
		}

		return $contents->toString($format, $options);
	}
502962
private function writeToOutputNow($output, $handlerContentType)
    {
        /** @var Response $Response */
        $Response = $this->system->ResIns();
        // If can do browser output
        if ($Response instanceof Response) {
            if ($this->sendHttpCode()) {
                $Response->withStatus($this->sendHttpCode());
            }
            $Response->withHeader('Content-Type', $handlerContentType);
            $Response->write($output);
            $Response->response();
            $Response->end(true);
        } else {
            Logger::getInstance()->console($output);
        }
    }
80433
protected function setDefaultConfiguration($rawContent)
    {
        $resolvedContent = strtr($rawContent, $this->unresolveableReplacementPairs);

        $cacheFile = tempnam($this->cacheDir, 'tmp');

        $fh = fopen($cacheFile, 'w');

        fwrite($fh, $resolvedContent);

        fclose($fh);

        $this->defaultConfiguration = include($cacheFile);

        unlink($cacheFile);
    }
697344
public function addContent(\Coral\ContentBundle\Entity\Content $contents)
    {
        $this->contents[] = $contents;

        return $this;
    }
356338
protected function saveContents($contents)
    {
        $this->contents = $contents;

        try {
            $this->getFilesystem()->put($this->getFilepath(), json_encode($contents));
        } catch (Exception $e) {
            // ...
        }
    }
788377
public function parseArray(array $rawContents)
    {
        $parsedContents = [];
        foreach ($rawContents as $sectionFullName => $sectionContents)
        {
            $pieces = explode(self::SECTION_INHERITANCE_OPERATOR, $sectionFullName, 2);
            $sectionName = trim($pieces[0]);
            if (!is_array($sectionContents))
            {
                throw new InvalidDataException(sprintf('Orphan fields are not allowed! ' .
                                                       'Please define a section for field "%s".',
                                                       $sectionName));
            }
            $parsedContents[$sectionName] = new IniSection($sectionName);
            $parsedContents[$sectionName]->setContents($sectionContents);
            $parentName = isset($pieces[1]) ? trim($pieces[1]) : null;
            if (!is_null($parentName))
            {
                if (!isset($parsedContents[$parentName]))
                {
                    throw new InvalidDataException(sprintf('Parent section not found! ' .
                                                           'Define "%s" section before "%s" section.',
                                                           $parentName, $sectionName));
                }
                $parsedContents[$sectionName]->setParent($parsedContents[$parentName]);
            }
        }

        return $parsedContents;
    }
607657
public function printSummary(OutputInterface $output, array $dumped_files) {

    if (count($dumped_files) > 0) {
      // Multiple hooks can be dumped to the same file.
      $dumped_files = array_unique($dumped_files);

      usort($dumped_files, function ($a, $b) {
        $depth_a = substr_count($a, '/');
        $depth_b = substr_count($b, '/');
        // Top level files should be printed first.
        return $depth_a == $depth_b || ($depth_a > 1 && $depth_b > 1) ?
          strcmp($a, $b) : ($depth_a > $depth_b ? 1 : -1);
      });

      $output->writeln('');
      $output->writeln(' The following directories and files have been created or updated:');
      $output->writeln('<fg=cyan;options=bold>–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––</>');
      foreach ($dumped_files as $file) {
        $output->writeln(" • $file");
      }
      $output->writeln('');
    }

  }