| Server IP : 116.202.121.150 / Your IP : 216.73.217.174 Web Server : Apache System : Linux server5.febas.net 6.1.0-51-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.177-1 (2026-07-16) x86_64 User : k9887-1 ( 1171) PHP Version : 8.2.32 Disable Function : show_source, highlight_file, apache_child_terminate, apache_get_modules, apache_note, apache_setenv, virtual, dl, posix_getpwnam, posix_getpwuid, posix_mkfifo, posix_mknod, posix_setpgid, posix_setsid, posix_setuid, posix_uname, proc_nice, openlog, syslog, pfsockopen, system, shell_exec, passthru, popen, proc_open, exec MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/k9887-1/htdocs/_fisch/wp-content/plugins/duplicator/src/Libs/Snap/ |
Upload File : |
<?php
/**
*
* @package Duplicator
* @copyright (c) 2021, Snapcreek LLC
*
*/
namespace Duplicator\Libs\Snap;
/**
* Snap code generator utils
*/
class SnapCode
{
/**
* Get class code from file
*
* @param string $file file path
* @param bool $wrapNamespace if true wrap name space with brackets
* @param bool $removeBalnkLines if treu remove balnk lines
* @param bool $removeComments if true remove comments
*
* @return string
*/
public static function getSrcClassCode(
$file,
$wrapNamespace = true,
$removeBalnkLines = true,
$removeComments = true
) {
if (!is_file($file) || !is_readable($file)) {
return '';
}
if (($src = file_get_contents($file)) === false) {
return '';
}
if ($wrapNamespace) {
$src = preg_replace('/(.*^\s*)(namespace.*?)(;)(.*)/sm', "$2 {\n$4}", $src);
}
if ($removeComments) {
$src = preg_replace('/^\s*\/\*.*?\*\//sm', '', $src);
$src = preg_replace('/^\s*\/\/.*$/m', '', $src);
}
if ($removeBalnkLines) {
$src = preg_replace('/\n\s*\n/s', "\n", $src);
}
return $src;
}
}