Code Duplication    Length = 14-14 lines in 2 locations

PHPDaemon/Thread/Worker.php 2 locations

@@ 404-417 (lines=14) @@
401
			$flushCache = true;
402
		}
403
404
		if (isset(Daemon::$config->group->value)) {
405
			if ($sg === FALSE) {
406
				Daemon::log('Couldn\'t change group to \'' . Daemon::$config->group->value . '\'. You must replace config-variable \'group\' with existing group.');
407
				exit(0);
408
			}
409
			elseif (
410
					($sg['gid'] != posix_getgid())
411
					&& (!posix_setgid($sg['gid']))
412
			) {
413
				Daemon::log('Couldn\'t change group to \'' . Daemon::$config->group->value . "'. Error (" . ($errno = posix_get_last_error()) . '): ' . posix_strerror($errno));
414
				exit(0);
415
			}
416
			$flushCache = true;
417
		}
418
419
		if (isset(Daemon::$config->user->value)) {
420
			if ($su === FALSE) {
@@ 419-432 (lines=14) @@
416
			$flushCache = true;
417
		}
418
419
		if (isset(Daemon::$config->user->value)) {
420
			if ($su === FALSE) {
421
				Daemon::log('Couldn\'t change user to \'' . Daemon::$config->user->value . '\', user not found. You must replace config-variable \'user\' with existing username.');
422
				exit(0);
423
			}
424
			elseif (
425
					($su['uid'] != posix_getuid())
426
					&& (!posix_setuid($su['uid']))
427
			) {
428
				Daemon::log('Couldn\'t change user to \'' . Daemon::$config->user->value . "'. Error (" . ($errno = posix_get_last_error()) . '): ' . posix_strerror($errno));
429
				exit(0);
430
			}
431
			$flushCache = true;
432
		}
433
		if ($flushCache) {
434
			clearstatcache(true);
435
		}