function testGetEncodingName() { ini_set('memory_limit', '1024M'); $dir = __DIR__ . '/../support'; $text_cp1251 = file_get_contents($dir . '/cp1251.txt'); $text_utf8 = file_get_contents($dir . '/utf8.txt'); $cp1251 = DryString::getEncodingName($text_cp1251); $utf8 = DryString::getEncodingName($text_utf8); $this->assertEquals('windows-1251', $cp1251); $this->assertEquals('UTF-8', $utf8); }
public function getAnswer($getAllAnswer = false) { if (!$getAllAnswer) { $answer = array(); $descriptorKey = 0; $descriptorArray = $this->getDescriptorArray(); foreach ($this->answer as $key => $value) { $answer[$key] = $value && is_array($value) ? DryString::getBiggestString($value, $descriptorKey) : false; $this->answerInfo[$key] = $value && is_array($value) ? $descriptorArray[$descriptorKey]['info'] : false; } return $answer; } else { return $this->answer; } }