If the prefix is a JSON string with key-value data, extract it as an
associative array. Otherwise return null.

@param mixed $prefix The raw prefix string.
@return null|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;
    }
1304505
public static function filter_prefixed($array, $prefix, $removePrefix = true)
    {
        $return =[];
        foreach ($array as $key => $val) {
            if (preg_match('/^'.$prefix.'/', $key)) {
                if ($removePrefix === true) {
                    $key = preg_replace('/^'.$prefix.'/','',$key);
                }
                $return[$key] = $val;
            }
        }
        return $return;
    }
552180
private function extractValues(array $values, $prefix, $removePrefixFromKeys = true)
    {
        if (empty($values)) {
            return array();
        }

        $validKeys = array_filter(array_keys($values), function($name) use ($prefix) {
            return (0 === strpos($name, $prefix));
        });

        $results = array_intersect_key($values, array_flip($validKeys));
        if (!$removePrefixFromKeys) {
            return $results;
        }

        return array_combine(
            array_map(function($key) use ($prefix) {
                return str_replace($prefix, '', $key);
            }, array_keys($results)), $results
        );
    }
692514
protected function buildUrl(string $prefix): string
    {
        return $this->isSubUrl ? $prefix . $this->value : $this->value;
    }
978687
public static function prefix($prefix = null)
	{
		if(null !== $prefix)
		{
			self::$prefix = $prefix;
		}
		return self::$prefix;
	}
988744
public function getKey(string $prefix = ''): string
    {
        $value = $this->getData();
        if (!is_array($value)) {
            $key = $value ?: '';
        } else {
            if (!empty($this->getAttributes())) {
                $flipped = array_flip($this->getAttributes());
                $value = array_intersect_key($value, $flipped);
            }

            $key = str_replace('=', '_', http_build_query($value, '', '_'));
        }

        return hash(self::ALGORITHM, $prefix.'_'.$key);
    }
911527
public function prefixKey($prefix)
    {
        if (empty($this->key)) {
            $this->key = $prefix;
        } else {
            $this->key = $prefix . '.' . $this->key;
        }

        return $this;
    }
418503
private static function arrayFlatten($array, $prefix = '')
    {
        $result = array();
        foreach ($array as $key => $value) {
            if (is_array($value)) {
                $result = $result + self::arrayFlatten($value, $prefix . $key . '.');
            } else {
                $result[$prefix . $key] = trim(preg_replace('/\s+/', ' ', $value));
            }
        }
        return $result;
    }
1253187
private function getValue($field, $prefix = null) {

		foreach($this -> combine as $combine) {
			
			if($combine -> getName() === $field) {
				return $combine -> combine();
			}
		}

		//Prefix
		if(null !== $prefix) {
			$field = $prefix . '[' . $field . ']';
		}

		//Get the value
		$helper = new StringToArray();
		$data 	= $helper -> execute($field, null, $this -> getData());

		return $data;
	}
276431
private function getNamespace($prefix)
    {
        $namespaces = $this->getExtensions()->getNamespaces();
        if (!array_key_exists($prefix, $namespaces)) {
            throw new \InvalidArgumentException(sprintf('Unknown NS prefix "%s"', $prefix));
        }

        return $namespaces[$prefix];
    }
119200
protected static function extract_record($record, $prefix) {
        $result = [];
        $prefixlength = strlen($prefix);
        foreach ($record as $key => $value) {
            if (strpos($key, $prefix) === 0) {
                $result[substr($key, $prefixlength)] = $value;
            }
        }
        return (object) $result;
    }
1168265
public function setPrefix($prefix)
    {
        if (!is_string($prefix)) {
            throw new InvalidArgumentException(
                'Prefix must be a string'
            );
        }

        /** @see \Stash\Pool\::setNamespace */
        if (!ctype_alnum($prefix)) {
            throw new InvalidArgumentException(
                'Prefix must be alphanumeric'
            );
        }

        $this->prefix = $prefix;
        return $this;
    }
78739
public function offsetGet($offset)
    {
        if (!isset($this->session[$this->prefix][$offset])) {
            return null;
        }

        $result = $this->session[$this->prefix][$offset];
        unset($this->session[$this->prefix][$offset]);

        return $result;
    }
662554
public function filterPrefix($prefix)
    {
        $names = [];

        foreach ($this->getMethods() as $method) {
            if ($method->isPublic() && substr_count($method->getName(), $prefix, null, strlen($prefix))) {
                $names[] = $method->getName();
            }
        }

        return $names;
    }
411212
public static function prefixKeys( $prefix, array $data = array() )
    {
        foreach ( static::clean( $data ) as $_key => $_value )
        {
            if ( is_numeric( $_key ) )
            {
                continue;
            }

            if ( is_array( $_value ) )
            {
                $_value = static::prefixKeys( $prefix, $_value );
            }

            $data[$prefix . $_key] = $_value;
            unset( $data[$_key] );
        }

        return $data;
    }
1236148
public function prefixToNamespaceURI($prefix)
    {
        return isset($this->prefix_to_uri[$prefix]) ? $this->prefix_to_uri[$prefix] : false;
    }
810389
protected function normalize(array $data, string $prefix = null): array
    {
        if ($prefix) {
            $prefix .= '.';
        }

        $result = [];
        foreach ($data as $item) {
            $value = [
                'label' => (string)$item['label'],
                'inactive' => (bool)$item['inactive']
            ];

            if (! empty($item['children'])) {
                $value['children'] = $this->normalize($item['children'], $prefix . $item['value']);
            }
            $result[$prefix . $item['value']] = $value;
        }

        return $result;
    }