
| Current Path : /var/www/html/ift/vendor/chi-teck/drupal-code-generator/src/Box/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/ift/vendor/chi-teck/drupal-code-generator/src/Box/PhpCompactor.php |
<?php
namespace DrupalCodeGenerator\Box;
use Herrera\Box\Compactor\Compactor;
/**
* A PHP source code compactor.
*/
class PhpCompactor extends Compactor {
/**
* {@inheritdoc}
*/
protected $extensions = ['php'];
/**
* {@inheritdoc}
*/
public function compact($contents) {
// php_strip_whitespace() takes file name as argument so we have to save the
// contents to a temporary file.
$temp_file = tempnam(sys_get_temp_dir(), 'dcg-');
file_put_contents($temp_file, $contents);
$contents = php_strip_whitespace($temp_file);
unlink($temp_file);
return $contents;
}
}