public static function fetch($emulator = NULL) { if (is_null($emulator) == true) { $app = \application\library\Configuration::get('app'); $emulator = $app['emu']; } $data = NULL; if (file_exists($data = sprintf('%s/data/%.json', dirname(__FILE__), $emulator))) { $data = \application\input\JSON::jsonToArray(file_get_contents($data)); } return $data; }
public function formatDNS($type = 'mysql') { $type = strtoupper($type); $con = Configuration::get('connect'); $dns = Configuration::get('dns'); if (array_key_exists($type, $dns)) { $dnsString = $dns[$type]['dns']; } else { $type = 'MYSQL'; $dnsString = $dns[$type]['dns']; } $rules = ['{hostname}' => $con['hostname'], '{username}' => $con['username'], '{password}' => $con['password'], '{database}' => $con['database']]; foreach ($rules as $key => $value) { $dnsString = str_replace($key, $value, $dnsString); } $data = str_replace('{port}', $dns[$type]['port'], $dnsString); return $data; }