Construct a single line of the LDIF for a given directive and value.

@param string $directive
@param string $value
@return string
187341
protected function getLdifLine($directive, $value)
    {
        $separator = Ldif::KEY_VALUE_SEPARATOR;

        // Per the RFC, any value starting with a space should be base64 encoded
        if ((substr($value, 0, strlen(' ')) === ' ')) {
            $separator .= Ldif::KEY_VALUE_SEPARATOR;
            $value = base64_encode($value);
        }

        return $directive.$separator.' '.$this->getValueForLine($value).$this->lineEnding;
    }
548714
public function parse_value($value) {
        global $COURSE;

        if (strpos($value, '$LineItems.url') !== false) {
            $this->params['context_id'] = $COURSE->id;
            $value = str_replace('$LineItems.url', parent::get_endpoint(), $value);
        }

        return $value;

    }
723525
protected static function highlightBoundary($value)
    {
        if ($value==='(' || $value===')') return $value;

        if (self::is_cli()) {
            return self::$cli_boundary . $value . "\x1b[0m";
        } else {
            return '<span ' . self::$boundary_attributes . '>' . $value . '</span>';
        }
    }
989357
protected function createItem($value) {
		$item=new HtmlDoubleElement("item-".$this->identifier."-".$this->count());
		$item->setTagName("li");
		$item->setContent($value);
		return $item;
	}
546848
public static function compile_string($value, $view = null)
	{
		foreach (static::$compilers as $compiler)
		{
			$method = "compile_{$compiler}";

			$value = static::$method($value, $view);
		}

		return $value;
	}
1272434
public function asNtext($value)
    {
        if ($value === null) {
            return $this->getNullDisplay();
        }

        return nl2br(Html::encode($value));
    }
549842
public function setValue(string $value = null) : Element
    {
        if ($value && !preg_match("@^(https?|ftp)://@", $value)) {
            $value = "http://$value";
        }
        return parent::setValue($value);
    }
149561
public function setUnsafeInlineAllowed(string $directive = '', bool $allow = false): self
    {
        return $this->setAllowUnsafeInline($directive, $allow);
    }
352280
private function parseLine($line)
    {
        if (($pair = $this->generateRulePair($line, array_keys(self::TOP_LEVEL_DIRECTIVES))) !== false) {
            return $this->handler->{self::TOP_LEVEL_DIRECTIVES[$pair[0]]}->add($pair[1]);
        }
1374713
static function quoteIfNeeded( $value )
    {
        $quote = '';
        if ( strpos( $value, ' ' ) !== false )
        {
            $quote = '"';
            if ( strpos( trim( $value ), '(' ) === 0 )
            {
                $quote = '';
            }
        }
        return $quote . $value . $quote;
    }
1057546
public function toString()
    {
        $ldif = $this->addCommentsToString('');
        if (!is_null($this->version)) {
            $ldif .= $this->getLdifLine(self::DIRECTIVE_VERSION, $this->version);
        }
        foreach ($this->entries as $entry) {
            $this->setupEntry($entry);
            $ldif .= $this->lineEnding.$entry->toString();
        }

        return $ldif;
    }
822059
protected function valueToString($value) : string
    {
        if ($value === null) {
            $def_value = 'null';
        } elseif ($value === false) {
            $def_value = 'false';
        } elseif ($value === true) {
            $def_value = 'true';
        } elseif (is_string($value)) {
            $def_value = '"' . str_replace('"', '\\"', $value) . '"';
        } elseif (is_numeric($value)) {
            $def_value = '' . $value;
        }

        return $def_value;
    }
688181
public static function getDirectiveValue(DirectiveInterface $definition, $directives, $variables)
    {
        $ast = NULL;
        if ($directives) {
            foreach ($directives as $directive) {
                if ($directive->get('name')->get('value') === $definition->getName()) {
                    $ast = $directive;
                    break;
                }
            }
        }
        if ($ast) {
            if (!$definition->getType()) {
                return NULL;
            }

            return self::coerceValueAST($definition->getType(), $ast->get('value'), $variables);
        }
    }
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;',
                                        ) ),
                    ) );
    }
123481
protected static function compile_layouts($value)
	{
		// If the Blade template is not using "layouts", we'll just return it
		// unchanged since there is nothing to do with layouts and we will
		// just let the other Blade compilers handle the rest.
		if ( ! starts_with($value, '@layout'))
		{
			return $value;
		}

		// First we'll split out the lines of the template so we can get the
		// layout from the top of the template. By convention it must be
		// located on the first line of the template contents.
		$lines = preg_split("/(\r?\n)/", $value);

		$pattern = static::matcher('layout');

		$lines[] = preg_replace($pattern, '$1@include$2', $lines[0]);

		// We will add a "render" statement to the end of the templates and
		// then slice off the "@layout" shortcut from the start so the
		// sections register before the parent template renders.
		return implode(CRLF, array_slice($lines, 1));
	}
907470
public static function factory($value): string
    {
        $data = Data::make($value);
        return self::evaluate($data, $value)->isString()->getValue();
    }
124811
protected static function highlightQuote($value)
    {
        if (self::is_cli()) {
            return self::$cli_quote . $value . "\x1b[0m";
        } else {
            return '<span ' . self::$quote_attributes . '>' . $value . '</span>';
        }
    }