private function readProjectConfig($project) { if (!file_exists($this->projects_root . '/projects/' . $project . '/config.ini')) { $this->projectConfig = array(); } else { $this->projectConfig = parse_ini_file($this->projects_root . '/projects/' . $project . '/config.ini'); } // removing empty values in the INI file foreach ($this->projectConfig as &$value) { if (is_array($value) && empty($value[0])) { unset($value[0]); } } unset($value); $other_php_versions = array(); foreach (array('52', '53', '54', '55', '56', '70', '71', '72') as $version) { if (empty($this->configFile['php' . $version])) { continue; } $php = new Phpexec($version[0] . '.' . $version[1]); if ($php->isValid()) { $other_php_versions[] = $version; } } // check and default values $defaults = array('ignore_dirs' => array('/test', '/tests', '/Tests', '/Test', '/example', '/examples', '/docs', '/doc', '/tmp', '/version', '/vendor', '/js', '/lang', '/data', '/css', '/cache', '/vendor', '/assets', '/spec', '/sql'), 'other_php_versions' => $other_php_versions, 'phpversion' => PHP_VERSION, 'file_extensions' => array('php', 'php3', 'inc', 'tpl', 'phtml', 'tmpl', 'phps', 'ctp')); foreach ($defaults as $name => $value) { if (empty($this->projectConfig[$name])) { $this->projectConfig[$name] = $value; } } if (is_string($this->projectConfig['other_php_versions'])) { $this->projectConfig['other_php_versions'] = explode(',', $this->projectConfig['other_php_versions']); foreach ($this->projectConfig['other_php_versions'] as &$version) { $version = str_replace('.', '', trim($version)); } unset($version); } if (is_string($this->projectConfig['file_extensions'])) { $this->projectConfig['file_extensions'] = explode(',', $this->projectConfig['file_extensions']); foreach ($this->projectConfig['file_extensions'] as &$ext) { $ext = trim($ext, '. '); } unset($ext); } }