Identify Generic Functions

@param mixed $prefix

@return array
547851
private static function identifyMethods($prefix)
    {
        //====================================================================//
        // Prepare List of Available Methods
        $result = array();
        foreach (get_class_methods(__CLASS__) as $method) {
            if (0 !== strpos($method, $prefix)) {
                continue;
            }
            if (false === strpos($method, "Fields")) {
                continue;
            }
            $result[] = $method;
        }

        return $result;
    }
712378
public function deletePrefix($prefix)
    {
        if ($this->startWith($prefix) === true) {
            return substr($this->str, strlen($prefix));
        }

        return $this->str;
    }
772920
public function find_by_prefix($prefix) {
        $this->ensure_path_exists();
        $prefix = preg_replace('#(\*|\?|\[)#', '[$1]', $prefix);
        $files = glob($this->glob_keys_pattern($prefix), GLOB_MARK | GLOB_NOSORT);
        $return = array();
        if ($files === false) {
            return $return;
        }
        foreach ($files as $file) {
            // Trim off ".cache" from the end.
            $return[] = substr(basename($file), 0, -6);
        }
        return $return;
    }
31254
protected function getPropertyBuilder($prefix)
    {
        $build = function ($value, $key, $sub = null) use (&$prefix, &$build) {
            $sub = ($sub ? $sub : $prefix);

            if (!is_numeric($key)) {
                $sub .= static::SEP_MAJOR . $this->fixString($key);
            }

            if (is_array($value)) {
                return array_map(
                    $build,
                    $value,
                    array_keys($value),
                    array_fill(0, count($value), $sub)
                );
            }

            $sep = (
                $prefix === $sub
                ? static::SEP_MINOR
                : str_repeat(static::SEP_MAJOR, static::SEP_MULTI)
            );

            return $sub . $sep . $this->fixString($value);
        };

        return $build;
    }
426254
public function getPaths($prefix = null)
    {
        if ((null !== $prefix) && is_string($prefix)) {
            $prefix = $this->_formatPrefix($prefix);
            if ($this->_useStaticRegistry) {
                if (isset(self::$_staticPrefixToPaths[$this->_useStaticRegistry][$prefix])) {
                    return self::$_staticPrefixToPaths[$this->_useStaticRegistry][$prefix];
                }

                return false;
            }

            if (isset($this->_prefixToPaths[$prefix])) {
                return $this->_prefixToPaths[$prefix];
            }

            return false;
        }

        if ($this->_useStaticRegistry) {
            return self::$_staticPrefixToPaths[$this->_useStaticRegistry];
        }

        return $this->_prefixToPaths;
    }
1220158
private function handleTypes( $node, $prefix )
	{
		switch ( $node->getName() )
		{
			case 'simpleType':

				return $this->getSimpleType( $node, $prefix );

				break;

			case 'complexType':

				return $this->getComplexType( $node, $prefix );

				break;

		}

		return false;
	}
79723
private function fetchPrefix(): array
    {
        $prefixLength = socket_recv($this->socket, $prefixBody, 17, MSG_WAITALL);
        if ($prefixBody === false || $prefixLength !== 17) {
            throw new PrefixException(sprintf(
                "unable to read prefix from socket: %s",
                socket_strerror(socket_last_error($this->socket))
            ));
        }

        $result = unpack("Cflags/Psize/Jrevs", $prefixBody);
        if (!is_array($result)) {
            throw new Exceptions\PrefixException("invalid prefix");
        }

        if ($result['size'] != $result['revs']) {
            throw new Exceptions\PrefixException("invalid prefix (checksum)");
        }

        return $result;
    }
998757
public function hasType( $name, $prefix = null )
	{
		return isset( $this->types[ is_null( $prefix ) ? $name : "$prefix:$name" ] );
	}
766662
public function getFunctions()
    {
        return [
            new \Twig_SimpleFunction('isEager', function($stuff) {
                return AgnosticFetchHelper::isEager($stuff);
            }),
            new \Twig_SimpleFunction('all', function($stuff) {
                return AgnosticFetchHelper::all($stuff);
            }),
            new \Twig_SimpleFunction('one', function($stuff) {
                return AgnosticFetchHelper::one($stuff);
            }),
            new \Twig_SimpleFunction('nth', function($stuff, $n) {
                return AgnosticFetchHelper::nth($stuff, $n);
            }),
            new \Twig_SimpleFunction('ids', function($stuff) {
                return AgnosticFetchHelper::ids($stuff);
            }),
            new \Twig_SimpleFunction('count', function($stuff) {
                return AgnosticFetchHelper::count($stuff);
            }),
        ];
    }
1060354
public static function normalizePrefetchLookup($lookups, $prefix = null): array
    {
        $results = [];
        foreach ($lookups as $lookup) {
            if (!$lookup instanceof Prefetch) {
                $lookup = new Prefetch($lookup);
            }
            if ($prefix) {
                $lookup->addPrefix($prefix);
            }
            $results[] = $lookup;
        }

        return $results;
    }
50141
public static function getAll( $prefix = NULL, $excludePrefix = NULL )
	{
		$prefix	= strtoupper( $prefix );
		$length	= strlen( $prefix );
		if( $length	< 2 )
			throw new InvalidArgumentException( 'Prefix "'.$prefix.'" is to short.' );
		$map	= get_defined_constants();
		if( $prefix ){
			foreach( $map as $key => $value )
			{
				if( $key[0] !== $prefix[0] )
					unset( $map[$key] );
				else if( $key[1] !== $prefix[1] )
					unset( $map[$key] );
				else if( substr( $key, 0, $length ) !== $prefix )
					unset( $map[$key] );
#				remark( $prefix." - ".$key." - ".(int)isset( $map[$key] ) );
			}
		}
		if( $excludePrefix ){
			if( substr( $excludePrefix, 0, $length ) !== $prefix )
				$excludePrefix	= $prefix.$excludePrefix;
			foreach( $map as $key => $value ){
				if( substr( $key, 0, strlen( $excludePrefix ) ) === $excludePrefix )
					unset( $map[$key] );
			}
		}
		return $map;
	}
1364719
protected function getHttpHeaders(string $prefix = null): array
    {
        $headers = [];

        // Get all headers
        if (function_exists('\getallheaders')) {
            $headers = \getallheaders() ?: [];
        } else {
            foreach ($_SERVER as $name => $value) {
                if (substr($name, 0, 5) == 'HTTP_') {
                    $headers[str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))))] = $value;
                } else {
                    if ($name === 'CONTENT_TYPE') {
                        $headers['Content-Type'] = $value;
                    }
                }
            }
        }

        // Headers filter
        if (!empty($prefix)) {
            $prefixLength = mb_strlen($prefix);

            $headers =
                array_filter(
                    $headers,
                    function ($key) use ($prefix, $prefixLength) {
                        return substr($key, 0, $prefixLength) == $prefix;
                    }, ARRAY_FILTER_USE_KEY);
        }

        return $headers;
    }
345202
protected function getNamespaceURI($prefix)
    {
        $namespaces = $this->owner->config()->open_graph_namespaces;
        
        if (isset($namespaces[$prefix])) {
            return $namespaces[$prefix];
        }
    }
959644
public function prefix($prefix = '') {
        if (empty($prefix) && null !== $prefix) {
            return $this->prefix;
        }
        else {
            $this->prefix = $prefix;
        }
    }
1235060
public function getNamespaceForPrefix( $prefix )
	{
		if ( ! isset( $this->instance_namespaces[ $prefix ] ) ) return null;
		return $this->instance_namespaces[ $prefix ];
	}
162174
public function getFunctions()
    {
        $result = [];
        foreach ($this->extension->getFunctions() as $function) {
            $callable = $function->getCallable();
            $name = $function->getName();

            $result[] = new \Twig_SimpleFunction(
                $name,
                function() use ($callable, $name) {
                    return $this->memoizeCache->memoizeById($name, func_get_args(), $callable, $this->lifeTime);
                }
            );
        }

        return $result;
    }
1112174
protected function parseOutputParams($params, $prefix = '')
    {
        $retval = array();
        foreach ($params as $key => $val) {
            if (is_array($val)) {
                $retval = array_merge($retval, $this->parseOutputParams($val, $prefix . $key . '.'));
            } else {
                $retval[$prefix . $key] = $val;
            }
        }
        return $retval;
    }