Generate foreign key rule value.

@param string $value

@return string
977816
protected function getForeignKeyRuleValue(string $value): string
    {
        $value = strtolower($value);
        if ($value == 'no action') {
            return 'NO_ACTION';
        }
        if ($value == 'cascade') {
            return 'CASCADE';
        }
        if ($value == 'restrict') {
            return 'RESTRICT';
        }
        if ($value == 'set null') {
            return 'SET_NULL';
        }

        return 'NO_ACTION';
    }
399215
public function lt($value) {
        $this->rule = $value;
        $this->check_role = 'lt';
        $result = !is_null($this->value) && $this->value < $value;
        $this->checkResult($result);
        return $this;
    }
428391
private function getTypedValue(string $value)
    {
        if (\in_array($value, self::$boolValues, true)) {
            return \in_array($value, self::$truthlyValues, true);
        }

        if (\is_numeric($value)) {
            return $this->getNumericValue($value);
        }

        return $value;
    }
1113923
public function getSqlType($value)
    {
        if ('boolean' === gettype($value)) {
            return $this->connection->getDatabasePlatform()->convertBooleans($value);
        } elseif (null === $value || 'null' === $value) {
            return 'NULL';
        }

        return $this->connection->quote($value);
    }
817381
public static function getTypeForValue($value): string
    {
        if (is_object($value)) {
            if ($value instanceof Proxy) {
                $type = get_parent_class($value);
            } else {
                $type = get_class($value);
            }
        } else {
            $type = gettype($value);
        }
        return $type;
    }
1348054
protected function getValueTypeDescription($value): string
    {
        if (is_resource($value)) {
            $valueType = get_resource_type($value) . " resource";
        } elseif (is_object($value)) {
            $valueType = get_class($value) . " object";
        } elseif (is_string($value)) {
            $valueType = "string \"{$value}\"";
        } else {
            $valueType = gettype($value);
        }

        return $valueType;
    }
1328429
public function prepareValue($value)
    {
        return $value === null ? null : Carbon::createFromFormat($this->format, $value)->toDateString();
    }
855428
public function parse_value($value) {
        global $COURSE, $DB;

        if (strpos($value, '$ToolProxyBinding.memberships.url') !== false) {
            if ($COURSE->id === SITEID) {
                $this->params['context_type'] = 'Group';
            } else {
                $this->params['context_type'] = 'CourseSection';
            }
            $this->params['context_id'] = $COURSE->id;

            $id = optional_param('id', 0, PARAM_INT); // Course Module ID.
            if (!empty($id)) {
                $cm = get_coursemodule_from_id('lti', $id, 0, false, IGNORE_MISSING);
                $lti = $DB->get_record('lti', array('id' => $cm->instance), 'typeid', IGNORE_MISSING);
                if ($lti && !empty($lti->typeid)) {
                    $this->params['tool_code'] = $lti->typeid;
                }
            }
            $value = str_replace('$ToolProxyBinding.memberships.url', parent::get_endpoint(), $value);
        }
        return $value;

    }
11290
public function entities($value)
    {
        if (is_array($value)) {
            $newValue = array();
            foreach ($value as $key => $val) {
                $newValue[$key] = htmlentities($val, ENT_QUOTES, 'UTF-8', false);
            }

            return $newValue;
        }

        return htmlentities($value, ENT_QUOTES, 'UTF-8', false);
    }
918166
public function selectButton($value)
    {
        $translate = 'translate(@type, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "abcdefghijklmnopqrstuvwxyz")';
        $xpath = sprintf('descendant-or-self::input[((contains(%s, "submit") or contains(%1$s, "button")) and contains(concat(\' \', normalize-space(string(@value)), \' \'), %s)) ', $translate, static::xpathLiteral(' '.$value.' ')).
                         sprintf('or (contains(%s, "image") and contains(concat(\' \', normalize-space(string(@alt)), \' \'), %s)) or @id=%s or @name=%s] ', $translate, static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value)).
                         sprintf('| descendant-or-self::button[contains(concat(\' \', normalize-space(string(.)), \' \'), %s) or @id=%s or @name=%s]', static::xpathLiteral(' '.$value.' '), static::xpathLiteral($value), static::xpathLiteral($value));

        return $this->filterRelativeXPath($xpath);
    }
1135715
public function gt($value) {
        $this->rule = $value;
        $this->check_role = 'gt';
        $result = !is_null($this->value) && $this->value > $value;
        $this->checkResult($result);
        return $this;
    }
360741
function prepValueForDB($value) {
		if(!$this->nullifyEmpty && $value === '') {
			return DB::getConn()->prepStringForDB($value);
		} else {
			return parent::prepValueForDB($value);
		}
	}
331723
protected function formatValue($value)
    {
        if ($this->formatValue !== NULL) {
            return str_replace(static::VALUE_IDENTIFIER, $value, $this->formatValue);
        } else {
            return $value;
        }
    }
596328
public function reverseTransform($value)
    {
        if ($value === null) {
            return $this->fieldType->getEmptyValue();
        }

        $ids = explode('|#', $value['ids']);
        $parentIds = explode('|#', $value['parent_ids']);
        $keywords = explode('|#', $value['keywords']);
        $locales = explode('|#', $value['locales']);

        $hash = [];
        for ($i = 0, $count = count($ids); $i < $count; ++$i) {
            if (!array_key_exists($i, $parentIds) || !array_key_exists($i, $keywords) || !array_key_exists($i, $locales)) {
                break;
            }

            if ($ids[$i] !== '0') {
                $hash[] = ['id' => (int) $ids[$i]];

                continue;
            }

            $hash[] = [
                'parent_id' => (int) $parentIds[$i],
                'keywords' => [$locales[$i] => $keywords[$i]],
                'main_language_code' => $locales[$i],
            ];
        }

        return $this->fieldType->fromHash($hash);
    }
323495
public function displayValue( $value )
    {
        if ( empty( $value ) )
        {
            return '';
        }

        return $this->view
                    ->htmlTag( 'img', null, array(
                        'data-js-type' => 'js.ui.toolTip',
                        'src'   => $this->view
                                        ->thumbnail( $value,
                                                     $this->getOptions() ),
                        'title' => $this->view
                                        ->htmlTag( 'img', null, array(
                                            'src'   => $value,
                                            'style' => 'max-width: 300px;'
                                                    . ' max-height: 500px;'
                                                    . ' margin-bottom: -3px;',
                                        ) ),
                    ) );
    }
1013787
protected function addValue($value)
    {
        $name                = 'where' . $this->whereContainer->getBindingCount();
        $this->values[$name] = $value;

        return ':' . $name;
    }
659048
protected function transformValue($value)
    {
        // first of all remove any quotation marks
        $value = preg_replace('/("|\')(.+)("|\')/', '$2', $value);

        $this->transformToDate($value);
        $this->transformToFloat($value);
        $this->transformToInt($value);

        return $value;
    }