Get list of prefixed class constants OR all if $prefix not set

@param string $prefix
@return array
@throws \ReflectionException
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;
	}
694258
protected function getLinksListRepresentation(?string $prefix, iterable $links): array
    {
        $result = [];

        foreach ($links as $link) {
            \assert($link instanceof BaseLinkInterface);
            $result[] = $link->canBeShownAsString() === true ?
                $link->getStringRepresentation($prefix) : $link->getArrayRepresentation($prefix);
        }

        return $result;
    }
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;
    }
647442
protected function getLinksRepresentation(?string $prefix, iterable $links): array
    {
        $result = [];

        foreach ($links as $name => $link) {
            \assert($link instanceof LinkInterface);
            $result[$name] = $link->canBeShownAsString() === true ?
                $link->getStringRepresentation($prefix) : $link->getArrayRepresentation($prefix);
        }

        return $result;
    }
1164833
public function getTables( $prefix = NULL ){
		$query		= "SHOW TABLES" . ( $prefix ? " LIKE '".$prefix."%'" : "" );
		return parent::query( $query )->fetchAll( PDO::FETCH_COLUMN );
	}
800896
public function prefix( $prefix )
    {
        // Detect the Regexp delimiter
        $patternDelim = $this->pattern[0];

        // Add the Regexp delimiter to the prefix
        $prefix = $patternDelim . $prefix . $patternDelim;
        parent::prefix( $prefix );
    }
43701
private static function getClassConstants(string $className): array
    {
        return self::$constantCache[$className]
            ?? self::$constantCache[$className] = (new \ReflectionClass($className))->getConstants();
    }
1118946
public static function getConstants($class, string $prefix = ''): array
    {
        static $constants = [];

        if (is_object($class)) {
            $class = get_class($class);
        }

        if (!isset($constants[$class])) {
            $constants[$class][''] = (new \ReflectionClass($class))->getConstants();
        }

        if (!isset($constants[$class][$prefix])) {
            $constants[$class][$prefix] = [];

            foreach ($constants[$class][''] as $name => $value) {
                if (Strings::startsWith($name, $prefix)) {
                    $constants[$class][$prefix][$name] = $value;
                }
            }
        }

        return $constants[$class][$prefix];
    }
1137765
protected function dataForPrefix($namespace, $prefix)
    {
        if (!isset($this->cachedData[$namespace][$prefix])) {
            $this->loadDataForPrefix($namespace, $prefix);

        }

        // If no custom data was setted using offsetSet() just return that
        if (!isset($this->customData[$namespace][$prefix])) {
            return $this->cachedData[$namespace][$prefix];
        }

        $data = $this->cachedData[$namespace][$prefix];

        array_unshift($data, $this->customData[$namespace][$prefix]);

        return $data;

    }
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;
    }
965074
private function getResourceFromParameter($prefix = '--unique-prefix')
    {
        $resource = null;
        $hasParameter = false;

        $val = $this->getParameterValue($prefix);
        if ($val) {
            $hasParameter = true;
            $resource = $this->getResource($val);
            if (!$resource->exists()) {
                $resource = null;
            }
        }

        return $hasParameter ? $resource : false;
    }
1198081
private function getBodyParams($prefix)
    {
        return array_diff_key($this->params, array_flip($this->addPrefix($this->auth, $prefix)));
    }
570743
protected function get_protected_field(string $prefix = '') : \stdClass {
        $fieldname = "{$prefix}protected";

        return (object) [
            'fields' => [
                $this->_form->createElement(
                        'advcheckbox',
                        $fieldname,
                        get_string('protected', 'tool_dataprivacy'),
                        get_string('protectedlabel', 'tool_dataprivacy')
                    ),
            ],
        ];
    }
897106
public static function getAll($prefix = '')
		{

			// Make backend load all
			$backend = static::getBackend();
			$backend->loadAll($prefix);

			// Now return requested translations
			return $backend->translations($prefix);

		}
955777
protected function getConstNameToIds($prefix)
    {
        if (!isset(self::$constNameToIds[$prefix])) {
            foreach ($this->getConsts($prefix) as $const) {
                self::$constNameToIds[$prefix][$const['name']] = $const['id'];
            }
        }

        return self::$constNameToIds[$prefix];
    }
700098
protected function getClassMeta(ReflectionClass $reflection): array
    {
        $doc = $reflection->getDocComment();
        $notations = $this->parser->parse($doc);

        return $notations;
    }
615516
public function getNextTag($prefix = null)
    {
        $existingTags = $this->listPrefixedTags($prefix);

        $lastTag = array_pop($existingTags);

        if (0 >= preg_match('/^[0-9]+\.[0-9]+\.[0-9]+$/', $lastTag, $matches)) {
            throw new \RuntimeException(sprintf("Unable to parse latest tag, expected pattern X.X.X, found: %s", $lastTag), 22);
        }

        list ($major, $minor, $release) = explode('.', $lastTag, 3);

        return sprintf('%s.%s.%s', $major, $minor, (((int) $release) + 1));
    }