Return the names of all constants that match a given value.

@param $value
@return array
@since 1.3.0
164654
public static function getAllMatchingNames($value): array
    {
        $enumerables = self::getCache();
        $result = array_keys($enumerables, $value, true);
    
        if ([] === $result) {
            throw EnumerableException::valueNotFound();
        }
    
        return $result;
    }
166608
public function transform($value)
    {
        if (!$value instanceof Value) {
            return null;
        }

        return array(
            'title' => $value->title,
            'description' => $value->description,
            'keywords' => implode(',', $value->keywords),
            'priority' => $value->priority,
            'change' => $value->change,
            'sitemap_use' => !empty($value->sitemap_use),
        );
    }
292283
public static function fromString($value)
    {
        $parts = array_filter(array_map('trim', explode(';', $value)));

        if (empty($parts) || !strpos($parts[0], '=')) {
            return [];
        }
        $config = [];

        $pieces = explode('=', array_shift($parts), 2);

        if (count($pieces) !== 2) {
            return [];
        }
        $config['name'] = trim($pieces[0]);
        $config['value'] = urldecode(trim($pieces[1], " \n\r\t\0\x0B"));

        foreach ($parts as $item) {
            $pieces = explode('=', trim($item), 2);
            $pieces[0] = strtolower($pieces[0]);
            if (count($pieces) !== 2) {
                $config[$pieces[0]] = true;
            } else {
                $config[$pieces[0]] = $pieces[1];
            }
        }
        return new static($config);
    }
1237089
public function getPatterned($value)
    {
        if (!is_array($value)) {
            return str_replace('%value', ucfirst($value), $this->pattern);
        } else {
            $return = $this->pattern;
            foreach ($value as $field) {
                if (!isset($field['name']) and ! isset($field['value'])) {
                    continue;
                }
                if (isset($field['value']) && is_array($field['value'])) {
                    $field['value'] = implode(',', $field['value']);
                }
                $return = str_replace('%' . $field['name'], $field['value'], $return);
            }
            return $return;
        }
    }
1210640
protected function _getCompoundIdColumnValues($value)
        {
            $filtered = [];

            foreach($this->_getIdColumnName() as $key) {
                $filtered[$key] = isset($value[$key]) ? $value[$key] : null;
            }

            return $filtered;
        }
917011
public function cast($value): array
    {
        $result = [];
        $config = $this->config;
        foreach ((array)$value as $key => $itemValue) {
            if (isset($config[$key])) {
                $result[$key] = $config[$key]->cast($itemValue);
                unset($config[$key]);
            } elseif (!$this->strict) {
                $result[$key] = $itemValue;
            }
        }

        if ($this->strict) {
            foreach ($config as $key => $type) {
                $result[$key] = $type->cast(null);
            }
        }

        return $result;
    }
647012
public static function nameOf($value)
    {
        $values = static::getValues();
        return isset($values[$value]) ? $values[$value] : null;
    }
40195
protected function getConstantName($value)
    {
        switch ($value) {
            case Base::ACTION_ADD:
                return 'ACTION_ADD';
            case Base::ACTION_MODIFY:
                return 'ACTION_MODIFY';
            case Base::ACTION_REMOVE:
                return 'ACTION_REMOVE';
        }

        return $value;
    }
1344641
private function parse($value): array
    {
        if (is_array($value)) {
            if ($value[0] !== $value[1]) {
                return $this->error('PASSWORDS_NOT_EQUAL');
            }

            $value = $value[0];
        }

        if (empty($value) === 0) {
            return [null, []];
        }

        return [Secret::create($value), []];
    }
887063
public static function determineComparison($value)
    {
        switch (true) {
            case is_scalar($value): {
                return static::EQ;
            }
            case is_array($value): {
                return static::IN;
            }
            case null === $value: {
                return static::IS_NULL;
            }
            default: {
                return static::RAW;
            }
        }
    }
804051
public static function getKey(string $value): string
    {
        self::assertIsValidValue($value);

        return (string) array_search($value, static::toArray(), true);
    }
568142
public function getValidationErrors($value)
	{
		$errors = array();
		if($this->required===true and !isset($value))
		{
			$errors['required'] = 'this element is required';
		}
		if(isset($this->min) and $this->min>0 and mb_strlen($value)<$this->min)
		{
			$errors['min'] = json_encode(array(
				'msg' => "at least %s characters is required",
				'arguments' => array($this->min)
			));
		}
		if(isset($this->max) and $this->max>0 and mb_strlen($value)>$this->max)
		{
			$errors['max'] = json_encode(array(
				'msg' => "maximum characters length is %s",
				'arguments' => array($this->max)
			));
		}
		if(!empty($this->value))
		{
			if(isset($this->regex))
			{
				if(substr($this->regex, 0, 1)!==substr($this->regex, -1, 1))
				{
					if(strpos($this->regex, '/')===false)
						$this->regex = '/'.$this->regex.'/';
					elseif(strpos($this->regex, '~')===false)
						$this->regex = '~'.$this->regex.'~';

				}
			}
			if(isset($this->regex) and !preg_match($this->regex, $value))
			{
				$errors['pattern'] = 'value does not match the pattern';
			}
		}
		if(isset($this->defaultValue) and !empty($this->readonly) and $value!=$this->defaultValue)
		{
			$errors['readonly'] = 'this element is readonly';
		}
		return $errors;
	}
963875
public function getLabelForValue($value) {
    $settings = $this->getFieldSettings();
    $allowed_values = $settings['allowed_values'];

    foreach ($allowed_values as $allowed_value) {
      if (isset($allowed_value['value']) && $allowed_value['value'] === $value) {
        $label = $allowed_value['label'];
        return Html::escape($label);
      }
    }
  }
744665
public static function equalTo($value): Matcher
    {
        $container = self::$globals::$container;

        return $container->matcherFactory->equalTo($value, false);
    }
204211
public function _prepValues($value)
    {
        if (is_array($value)) {
            if (isset($value["func"])) {
                return $value["func"];
            }
            foreach ($value as &$param) {
                $this->params[] = $param;
                $param = "?";
            }
            unset($param);
            return $value;
        }
        if (in_array(is_string($value) ? strtolower($value) : $value, [null, "null"]) === false) {
            $this->params[] = $value;
            $value = "?";
        }
        return $value;
    }
628416
public function match($value)
    {
        usort($this->rules, array($this, 'sort'));

        foreach ($this->rules as $rule) {
            $match = $rule->match($value);

            if ($match === false) {
                continue;
            }

            $this->matchParams = $match;

            return $this->dependencyManager->get($rule->getController());
        }

        return $this->dependencyManager->get($this->catchallController);
    }
922897
public static function sanitize( $value ) {
		if ( ! is_array( $value ) ) {
			return [];
		}
		foreach ( $value as $key => $val ) {
			$value[ $key ] = Color::sanitize( $val );
		}
		return $value;
	}