PAGI\CallSpool\CallFile::unserialize PHP 메소드

unserialize() 공개 메소드

Deconstructs a call file from the given text.
public unserialize ( string $text ) : void
$text string A call file (intended to be pre-loaded, with file_get_contents() or similar).
리턴 void
    public function unserialize($text)
    {
        $lines = explode("\n", $text);
        foreach ($lines as $line) {
            $data = explode(':', $line);
            if (count($data) < 2) {
                continue;
            }
            $key = trim($data[0]);
            if (isset($data[1]) && strlen($data[1]) > 0) {
                $value = trim($data[1]);
            } else {
                $value = '?';
            }
            if (strcasecmp($key, 'set') === 0) {
                $data = explode('=', $value);
                $key = trim($data[0]);
                if (isset($data[1]) && strlen($data[1]) > 0) {
                    $value = trim($data[1]);
                } else {
                    $value = '?';
                }
                $this->setVariable($key, $value);
            } else {
                $this->setParameter($key, $value);
            }
        }
    }