From d6cf6313b9bd3df68b86eb4f7041088090fefeaf Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 23 Sep 2015 15:53:10 +0200 Subject: [PATCH] Split complex if statements --- library/Icinga/Application/Version.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/library/Icinga/Application/Version.php b/library/Icinga/Application/Version.php index 70ad6cd63..85495966b 100644 --- a/library/Icinga/Application/Version.php +++ b/library/Icinga/Application/Version.php @@ -15,14 +15,21 @@ class Version */ public static function get() { - if (false !== ($gitHead = @file_get_contents(( - $gitDir = Icinga::app()->getBaseDir('.git') - ) . DIRECTORY_SEPARATOR . 'HEAD'))) { + $gitDir = Icinga::app()->getBaseDir('.git'); + $gitHead = @file_get_contents($gitDir . DIRECTORY_SEPARATOR . 'HEAD'); + if (false !== $gitHead) { $matches = array(); - if ((1 !== @preg_match('/(?.+?)$/ms', $gitHead, $matches) || false !== ( - $gitHead = @file_get_contents($gitDir . DIRECTORY_SEPARATOR . $matches['gitCommitID']) - )) && 1 === @preg_match('/(?[0-9a-f]+)$/ms', $gitHead, $matches)) { - return $matches; + if (@preg_match('/(?[0-9a-f]+)$/ms', $gitCommitID, $matches)) { + return $matches; + } } }