Retrieves an array of constant key, and value based on Prefix

@param array $configs
@param       $prefix
@return array
160798
public function getHttpConstantsFromConfigs($configs = array(), $prefix)
    {
        $arr = array();
        if ($prefix != null && is_array($configs)) {
            foreach ($configs as $k => $v) {
                // Check if it startsWith
                if (substr($k, 0, strlen($prefix)) === $prefix) {
                    $newKey = ltrim($k, $prefix);
                    if (defined($newKey)) {
                        $arr[constant($newKey)] = $v;
                    }
                }
            }
        }
        return $arr;
    }
248986
public function prefixArrayKeys($prefix, $array)
    {
        return array_combine(array_map(function ($key) use ($prefix) {
            return $prefix.$key;
        }, array_keys($array)), array_values($array));
    }
354824
public static function getConstants( $prefix = '', $combineValues = false )
	{
		$list = ( new \ReflectionClass( static::class ) )->getConstants();
		
		foreach( $list as $key => $const ) {
			if( strpos( $key, $prefix ) !== 0 ) {
				unset( $list[ $key ] );
			}
		}
		
		return $combineValues
			? array_combine( $list, $list )
			: $list;
	}
399654
public static function prefix($prefix = '') {
        $that = self::driver();
        $that->prefix($prefix);
        if (empty($prefix)) {
            return $that->config['prefix'];
        }
        $that->config['prefix'] = $prefix;
    }
1108007
private function loadValues(\DOMXPath $xpath, \DOMNode $node, $keys, $prefix = '@')
    {
        $result = [];

        foreach ($keys as $key) {
            $result[$key] = $this->getValueFromXPath($prefix . $key, $xpath, $node);
        }

        return $result;
    }
496325
public function appendToEachKey($prefix): self
    {
        // init
        $result = [];

        foreach ($this->getGenerator() as $key => $item) {
            if ($item instanceof self) {
                $result[$prefix . $key] = $item->appendToEachKey($prefix);
            } elseif (\is_array($item)) {
                $result[$prefix . $key] = self::create($item, $this->iteratorClass, false)
                    ->appendToEachKey($prefix)
                    ->toArray();
            } else {
                $result[$prefix . $key] = $item;
            }
        }

        return self::create($result, $this->iteratorClass, false);
    }
1005186
public static function getConstants($className, $prefix=null)
    {
        $reflection = new \ReflectionClass($className);
        $arr = $reflection->getConstants();

        $r = [];
        foreach($arr as $k=>$v){
            $k = strtolower($k);
            if (is_null($prefix) || 0 === $pos=strpos($k, $prefix)){
                $r[$v] = self::parseConstantName($k);
            }
        }
        return $r;
    }
434859
private function getImportFilters($prefix = 'filter')
    {
        $filters = [];
        try {
            $methods = (new \ReflectionClass(static::class))->getMethods();
            foreach ($methods as $methodDetails) {
                $methodName = $methodDetails->name;
                if (stripos($methodName, $prefix) === 0) {
                    $filters[] = [$this, $methodName];
                }
            }

        } catch (\ReflectionException $ex) {

        }
        return $filters;
    }
21804
public function get($name, $prefix = null) {
        $prefix = !is_null($prefix) ? $prefix : $this->config['prefix'];
        $name = $prefix . $name;
        if (isset($_COOKIE[$name])) {
            $value = $_COOKIE[$name];
            if (0 === strpos($value, 'nb:')) {
                $value = substr($value, 6);
                $value = json_decode($value, true);
                array_walk_recursive($value, 'self::jsonFormatProtect', 'decode');
            }
            return $value;
        }
        return null;
    }
1198081
private function getBodyParams($prefix)
    {
        return array_diff_key($this->params, array_flip($this->addPrefix($this->auth, $prefix)));
    }
984339
private function prefixWithHelperName($array, $prefix = true)
    {
        if ($prefix) {
            $newArray = [];
            foreach ($array as $key => $value) {
                $newArray['date.'.$key] = $value;
            }
            $array = $newArray;
        }

        return $array;
    }
857
private function extractPrefixKeyValueData($prefix)
    {
        $result = null;
        
        // If it has key-value data, as evidenced by the raw prefix string
        // being a JSON object (not JSON array), use it.
        if (substr($prefix, 0, 1) === '{') {
            if ($this->isJsonString($prefix)) {
                $result = Json::decode($prefix);
            }
        }
        
        return $result;
    }
1112302
public function resolveMessageArrayToMessageKeys(array $messages, $prefix="")
    {
        $flatArray = [];

        foreach ($messages as $key=>$message) {
            $this->resolveMessageToKeys($message, $key, function($qualifiedKey) use(&$flatArray)
                {
                    $flatArray[] = $qualifiedKey;
                }, $prefix);
        }

        return $flatArray;
    }
1039860
public static function keys($array, $prefix = null)
    {
        $keys = array_keys($array);

        if (! empty($prefix)) {
            $keys = static::prefix($keys, $prefix);
        }

        return $keys;
    }
176962
public function nestArray($prefix, $array)
    {
        $data = [];
        foreach($array as $key => $value) {
            array_set($data, $prefix.$key, $value);
        }
        return $data;
    }
1094411
public static function getClassConstants(
        string $class,
        string $prefix = null
    ): array {
        $result = [];

        try {
            $reflection = new ReflectionClass($class);

            foreach ($reflection->getConstants() as $key => $value) {
                if (null === $prefix || 0 === strpos($key, $prefix)) {
                    $result[] = $value;
                }
            }
        } catch (ReflectionException $e) {
        }

        return $result;
    }
959644
public function prefix($prefix = '') {
        if (empty($prefix) && null !== $prefix) {
            return $this->prefix;
        }
        else {
            $this->prefix = $prefix;
        }
    }