获取方法参数定义模版
@param \ReflectionParameter $param
@return string
504961
private static function getMethodParamDefineTpl(\ReflectionParameter $param)
    {
        $result = '';
        // 类型
        $paramType = $param->getType();
        if(null !== $paramType && $param->allowsNull())
        {
            $paramType = '?' . $paramType;
        }
        $result .= null === $paramType ? '' : ((string)$paramType . ' ');
        if($param->isPassedByReference())
        {
            // 引用传参
            $result .= '&';
        }
        else if($param->isVariadic())
        {
            // 可变参数...
            $result .= '...';
        }
        // $参数名
        $result .= '$' . $param->name;
        // 默认值
        if($param->isOptional() && !$param->isVariadic())
        {
            if($param->isDefaultValueAvailable())
            {
                $result .= ' = ' . var_export($param->getDefaultValue(), true);
            }
            else
            {
                $result .= ' = null';
            }
        }
        return $result;
    }
455198
public static function getReturnType($param)
    {
        $lexer = new Lexer($param);

        // A dummy parser is used for error reporting.
        $type = DataType::parse(new Parser(), $lexer->list);

        if ($type === null) {
            return [
                '',
                '',
                '',
                '',
                '',
            ];
        }

        $options = [];
        foreach ($type->options->options as $opt) {
            $options[] = is_string($opt) ? $opt : $opt['value'];
        }

        return [
            '',
            '',
            $type->name,
            implode(',', $type->parameters),
            implode(' ', $options),
        ];
    }
208003
public function get($param)
    {
        if ( ! $this->isOpened()) {
            $this->start();
        }
        return isset($this->attributes[$param]) ? $this->attributes[$param] : null;
    }
25258
public static function getInstance($param = null)
    {
        if (!self::$instance instanceof Cache) {
            $type        = $param->type;
            $credentials = (property_exists($param, 'credentials')) ? $param->credentials : null;

            self::$instance = new Cache($type, $credentials);
        }

        return self::$instance;
    }
337309
public function getParam($param = null)
    {
        if (null === $param) {
            return $this->_params;
        }

        return isset($this->_params[$param]) ? $this->_params[$param] : null;
    }
280695
protected function getParam($param)
    {
        $params = $this->getParams();
        if (! isset($params[$param])) {
            return false;
        }
        return $params[$param];
    }
1086540
private function extractClassName(ReflectionParameter $reflectionParameter)
    {
        if (isset($reflectionParameter->getClass()->name)) {
            return $reflectionParameter->getClass()->name;
        }
        return '';
    }
1222160
public static function parse($param) {
        if (!is_array($param) && !is_object($param)) {
            $compare = trim(strtolower($param));
            if (in_array($compare, array('yes', 'true', 'on', '1'))) {
                return true;
            }
            if (in_array($compare, array('no', 'false', 'off', '0'))) {
                return false;
            }
        }
        return $param;
    }
55829
private static Object getParam(final Object param) {
		final StringBuilder sb = new StringBuilder();
		if(param instanceof String){
			sb.append("'");
			sb.append((String)param);
			sb.append("'");
		}
		else if(param instanceof Boolean){
			sb.append(String.valueOf((Boolean)param));			
		}
        else if(param instanceof Integer){
            sb.append(String.valueOf((Integer)param));
        }
        else if(param instanceof DBRegExp){
            sb.append('/');
            sb.append(((DBRegExp) param).toString());
            sb.append('/');
        }
		
		return sb.toString();
	}
1019462
protected final function getArg(ReflectionParameter $param, CacheInterface $cache = null)
   {
       $match = [];
       $delimiter = "@param";
       $type = "string|int|bool|float|array|callable";
       preg_match(
           '/^.+' . $delimiter . '\s+(?!' . $type
         . ')([A-Za-z0-9\\\]{1,})\s+\$'
         . $param->name . '/m',
           $param->getDeclaringFunction()->getDocComment(),
           $match);
       if (array_key_exists(1, $match)) {
           return $this->resolve($match[1], $cache);
       }
   }
1055138
public function getEnv(string $param): string
    {
        if (preg_match_all('#\{ENV\(([A-Za-z0-9_]+)(?:(,?)([^}]*))\)\}#', $param, $matches)) {
            if (4 !== count($matches)) {
                return $param;
            }

            for ($i = 0; $i < count($matches[0]); ++$i) {
                $param = $this->parseEnv($param, $matches, $i);
            }

            return $param;
        }

        return $param;
    }
1039990
private function createParamString(\ReflectionParameter $parameter, string $type): string
    {
        $message = '';
        if (!in_array($type, [PropertyBinding::TYPE, ConstantBinding::TYPE, ListBinding::TYPE, MapBinding::TYPE])) {
            $message .= $type . ' ';
        } elseif ($parameter->isArray()) {
            $message .= 'array ';
        }

        return $message . '$' . $parameter->getName();
    }
69433
public static function valueView($param)
    {
        if (is_string($param)) {
            return '"' . $param . '"';
        } elseif (is_bool($param)) {
            return $param ? 'true' : 'false';
        } elseif (is_null($param)) {
            return 'null';
        } elseif (is_numeric($param)) {
            return $param;
        }

        throw new InvalidArgumentException('参数格式异常，只接受标量');
    }
225714
public static function getStartEndDate($dateParam)
    {
        if (empty($dateParam) || ! in_array($dateParam, array(
            0,
            1,
            7
        ))) {
            $dateParam = 0;
        } 
        $date = array();
        $today = (new \DateTime("now"))->format("Y-m-d");
        $tomorrow = Utils::getNextDayDate($today);
        $yesterday = Utils::getPreviousDay($today);
        switch ($dateParam) {
            case 0:
                $date['startDate'] = $today;
                $date['endDate'] = $tomorrow;
                break;
            case 1:
                $date['startDate'] = $yesterday;
                $date['endDate'] = $today;
                break;
            case 7:
                $date['endDate'] = $tomorrow;
                $date['startDate'] = Utils::getDateWeekAgo();
                break;
        }
        return $date;
    }
432681
public function get($param) {
        global $CFG, $USER;
        $this->cleanup($this->ttl);
        $filename = 'u'.$USER->id.'_'.md5(serialize($param));
        if(file_exists($this->dir.$filename)) {
            $lasttime = filemtime($this->dir.$filename);
            if (time()-$lasttime > $this->ttl) {
                return false;
            } else {
                $fp = fopen($this->dir.$filename, 'r');
                $size = filesize($this->dir.$filename);
                $content = fread($fp, $size);
                return unserialize($content);
            }
        }
        return false;
    }
50769
public function getMetaData($param) {
        if (!$this->_sock) { throw new SocketClientException("Connection gone!"); }
        $info = stream_get_meta_data($this->_sock);
        return $info[$param];
    }
1105260
protected function getDeclaringFunction(ReflectionParameter $parameter): string
	{
		$declaringFunction = $parameter->getDeclaringFunction();

		if($declaringFunction->isClosure())
		{
			return 'Closure';
		}

		if(($class = $parameter->getDeclaringClass()) === null)
		{
			return $declaringFunction->getName();
		}

		return $class->getName() . '::' . $declaringFunction->getName();
	}