create menu
@param string $str
@return boolean
@throws Exception
779695
public function createMenu($str)
    {
        $url    = sprintf(self::MENU_CREATE_URL, $this->getAccessTokenString());
        $client = $this->getHttpClient();
        $client->setUrl($url);
        $client->setHeaderArray(['Content-Type: application/json']);
        $client->setMethod(Client::METHOD_POST);
        $client->setPostFields($str);
        if (!$client->exec()) {
            throw new Exception("call createMenu fail");
        }

        $result = json_decode($client->getResponse(), true);
        if (isset($result['errcode']) && isset($result['errmsg'])) {
            return (0 == $result['errcode']);
        }

        throw new Exception("error response for create menu");
    }
253907
public function appendPageContent(string $str): PdfInterface
    {
        $this->setProperty('pageContent', $str);
        $this->mpdf->WriteHTML($this->pageContent);

        return $this;
    }
994910
public function parseString($str) {
        $parser = (new \PhpParser\ParserFactory())->create(\PhpParser\ParserFactory::PREFER_PHP7);
        $this->ast = $parser->parse($str);
        return $this;
    }
473113
public function set(string $str): self
    {
        $this->str = $this->inputConv($str);

        return $this;
    }
1162195
static function cli_write($str)
    {
        if (gettype($str) != 'string') {
            return false;
        }

        $stdout = fopen('php://stdout', 'w');

        return fwrite($stdout, $str);
    }
1298924
public function setLang($str)
    {
        $str = strtolower($str);
        
        if ($str == 'ar' || $str == 'en') {
            $this->_lang = $str;
        }
        
        return $this;
    }
1310170
public static function fromName($str){
		
		$strName = \strtoupper(\trim($str));
		
		foreach(static::getConstants() as $name => $value){
			if($strName === \strtoupper($name)){
				return new static($value);
			}
		}
		
		return null;
		
	}
818818
public static function constructFromString($str) {
		$str = strtoupper($str);
		$i = substr($str, -1) == 'I';

		preg_match('/^T[0-9]{1,}/', $str, $matches);
//		print_r($matches);
		$r = $matches[0];

		return new PitchClassSetTransformation($r, $i);
	}
893783
public static function fromString(string $str): self
    {
        if (!preg_match(self::PEM_REGEX, $str, $match)) {
            throw new \UnexpectedValueException("Not a PEM formatted string.");
        }
        $payload = preg_replace('/\s+/', "", $match[2]);
        $data = base64_decode($payload, true);
        if (false === $data) {
            throw new \UnexpectedValueException("Failed to decode PEM data.");
        }
        return new self($match[1], $data);
    }
1290923
private function string(string $str): void
    {
        $this->sql = $str;
        $this->prepare = $str;
        $this->param = [];
    }
833301
public function loadStr(string $str, array $option = []): Dom
    {
        $this->options = new Options;
        $this->options->setOptions($this->globalOptions)
                      ->setOptions($option);

        $this->rawSize = strlen($str);
        $this->raw     = $str;

        $html = $this->clean($str);

        $this->size    = strlen($str);
        $this->content = new Content($html);

        $this->parse();
        $this->detectCharset();

        return $this;
    }
1272329
public static function fromString(string $str): self
    {
        if (!preg_match_all(PEM::PEM_REGEX, $str, $matches, PREG_SET_ORDER)) {
            throw new \UnexpectedValueException("No PEM blocks.");
        }
        $pems = array_map(
            function ($match) {
                $payload = preg_replace('/\s+/', "", $match[2]);
                $data = base64_decode($payload, true);
                if (false === $data) {
                    throw new \UnexpectedValueException(
                        "Failed to decode PEM data.");
                }
                return new PEM($match[1], $data);
            }, $matches);
        return new self(...$pems);
    }
201133
protected function write($str)
    {
        $file = $this->getLogPath() . $this->getFilename();
        $dir = \dirname($file);

        if (!is_dir($dir) && !@mkdir($dir, 0775, true)) {
            throw new FileSystemException("Create log directory failed. $dir");
        }

        // check file size
        if (is_file($file) && filesize($file) > $this->maxSize * 1000 * 1000) {
            rename($file, substr($file, 0, -3) . time() . '.log');
        }

        // return error_log($str, 3, $file);
        return file_put_contents($file, $str, FILE_APPEND);
    }
1083420
private static function dealStr($str){
		$res = explode(self::$separate,$str);//空格分隔
        $str_time = preg_replace(self::$timeRegx,'',$res[self::$timeLine-1]);
        $date_time = \DateTime::createFromFormat(self::$timeFromat,$str_time,(new \DateTimeZone('Asia/Shanghai')));
        if ($date_time){
            $timestamp  = $date_time->getTimestamp();
        }else{
            throw new Exception("时间格式化有问题");
        }
        $t = $timestamp;
		$flow = $res[self::$flowLine-1]??0;//流量
		self::compareTime($t,$flow);
	}
1166296
public static function fromString(string $str): self
    {
        $rdns = array();
        foreach (DNParser::parseString($str) as $nameComponent) {
            $attribs = array();
            foreach ($nameComponent as list($name, $val)) {
                $type = AttributeType::fromName($name);
                // hexstrings are parsed to ASN.1 elements
                if ($val instanceof Element) {
                    $el = $val;
                } else {
                    $el = AttributeType::asn1StringForType($type->oid(), $val);
                }
                $value = AttributeValue::fromASN1ByOID($type->oid(),
                    $el->asUnspecified());
                $attribs[] = new AttributeTypeAndValue($type, $value);
            }
            $rdns[] = new RDN(...$attribs);
        }
        return new self(...$rdns);
    }
858527
public function create($postArr)
    {
        $userId = null;
        if (Auth::check()) {
            $userId = Auth::user()->id;
        }

        $default = [
            'post_author'    => $userId,
            'post_content'   => '',
            'post_title'     => '',
            'post_excerpt'   => '',
            'post_status'    => 'draft',
            'post_type'      => 'post',
            'comment_status' => '',
            'post_parent'    => 0,
            'menu_order'     => 0,
        ];

        $postArr = array_unique(array_merge($default, $postArr));

        $postArr[ 'guid' ] = sha1(time());

        if (empty($postArr[ 'post_title' ])) {
            return new EtherError('Post title must be provided');
        }

        if (isset($postArr[ 'post_slug' ]) && ! empty($postArr[ 'post_slug' ])) {
            $postArr[ 'post_slug' ] = $this->postRepository->sluggable($postArr[ 'post_slug' ], 'post_slug');
        } else {
            $postArr[ 'post_slug' ] = $this->postRepository->sluggable($postArr[ 'post_title' ], 'post_slug');
        }
        try {
            $post = $this->postRepository->create($postArr);
        } catch (\Exception $e) {
            return new EtherError($e);
        }

        return $post;
    }
469341
public function create($options = [])
    {
        $capsule = $this->_database->getCapsule();
        if (empty($options) || !is_array($options)) {
            throw new \Exception('Create options must not be empty and must be an instance of an array!');
        }

        // filter out options not given in fillable array
        $this->filter($options);

        $options['created_at'] = date('Y-m-d h:i:s');
        $options['updated_at'] = $options['created_at'];

        if ($capsule->table($this->table)->insert($options)) {
            return true;
        } else {
            return false;
        }
    }