Begin current span

@param string $result

@return void
342486
public static function beginCurrentSpan(&$result): void
    {
        if (self::$currentState === 'LTR') {
            $result .= self::START_LTR;
        }
        if (self::$currentState === 'RTL') {
            $result .= self::START_RTL;
        }

        self::$posSpanStart = strlen($result);
    }
221126
public function run(TestResult $result)
    {
        $this->applyFocus($result);

        $this->eventEmitter->on('test.failed', function () {
            if ($this->configuration->shouldStopOnFailure()) {
                $this->eventEmitter->emit('suite.halt');
            }
        });

        $this->eventEmitter->emit('runner.start');
        $this->suite->setEventEmitter($this->eventEmitter);
        $start = microtime(true);
        $this->suite->run($result);
        $this->eventEmitter->emit('runner.end', [microtime(true) - $start, $result]);
    }
521807
public function onResult(\pq\Result $result = null) {
		if ($result && $result->status != \pq\Result::TUPLES_OK) {
			return $result;
		}
		
		$rowset = $this->getRowsetPrototype();
		if (is_callable($rowset)) {
			return $rowset($result);
		} elseif ($rowset) {
			return new $rowset($this, $result);
		}
		
		return $result;
	}
1172915
private function checkResult($result, $vars = []) {
        if (!$result) {
            $this->isValidate = false;
            $vars[ 'attribute' ] = $this->as_name;
            $vars[ '1' ] = $this->p1;
            $vars[ '2' ] = $this->p2;
            $vars[ 'rule' ] = $this->rule;
            if ($this->msg_check) {
                $msg = Lang::get('validate', $this->msg_check, $vars);
                if (!$msg) {
                    $msg = $this->msg_check;
                }
            } else {
                $msg = Lang::get('validate', $this->check_role, $vars);
            }
            if ($this->is_throw) {
                throw new ValidateException($msg, 100010, null);
            } else {
                $this->msg = $msg;
            }
        }
        $this->p1 = null;
        $this->p2 = null;
        $this->rule = null;
    }
748632
public function run(TestResult $result)
    {
        $this->result = $result;
        $start = microtime(true);
        $command = realpath(__DIR__ . '/../../../bin/select-runner');
        $this->pool->start($command);
        $this->eventEmitter->emit('runner.end', [microtime(true) - $start]);
        $this->eventEmitter->emit('peridot.concurrency.runner.end', [$this->errors]);
    }
1175329
protected function succeed($result = null)
    {
        $this->isFinished = true;
        $this->isSuccess = true;
        $this->result = $result;
    }
85063
function setResult( $result )
    {
        $this->Parameters['result'] = $result;
        $http = eZHTTPTool::instance();
        $http->setSessionVariable( 'ContentUploadParameters', $this->Parameters );
    }
1209309
protected function journalInfo($result)
    {
        $outputElement = $this->doc->createElement('span');
        $outputElement->setAttribute('class', 'pz2-journal');

        $journalTitle = $this->appendMarkupForFieldToContainer('journal-title', $result, $outputElement, ' – ' . LocalizationUtility::translate('In', 'Pazpar2') . ': ');
        if ($journalTitle) {
            $this->appendMarkupForFieldToContainer('journal-subpart', $result, $journalTitle, ', ');
            $journalTitle->appendChild($this->doc->createTextNode('.'));
        } else {
            $outputElement = null;
        }

        return $outputElement;
    }
137631
public function initialise()
	{
		if (is_null($this->editor))
		{
			return;
		}

		$return = '';
		$results[] = $this->editor->onInit();

		foreach ($results as $result)
		{
			if (trim($result))
			{
				//$return .= $result;
				$return = $result;
			}
		}

		$document = \App::get('document');
		if ($document->getType() != 'html')
		{
			return;
		}
		$document->addCustomTag($return);
	}
968458
protected function indent(&$result) {
        /// Replace tabs with the correct number of spaces
        if (false !== strpos($result, "\t")) {
            $lines = explode("\n", $result);
            $result = null;//Save memory while we process the lines individually
            $tab_width = $this->get_real_tab_width();
            $tab_string = '&nbsp;' . str_repeat(' ', $tab_width);

            for ($key = 0, $n = count($lines); $key < $n; $key++) {
                $line = $lines[$key];
                if (false === strpos($line, "\t")) {
                    continue;
                }

                $pos = 0;
                $length = strlen($line);
                $lines[$key] = ''; // reduce memory

                $IN_TAG = false;
                for ($i = 0; $i < $length; ++$i) {
                    $char = $line[$i];
                    // Simple engine to work out whether we're in a tag.
                    // If we are we modify $pos. This is so we ignore HTML
                    // in the line and only workout the tab replacement
                    // via the actual content of the string
                    // This test could be improved to include strings in the
                    // html so that < or > would be allowed in user's styles
                    // (e.g. quotes: '<' '>'; or similar)
                    if ($IN_TAG) {
                        if ('>' == $char) {
                            $IN_TAG = false;
                        }
                        $lines[$key] .= $char;
                    } elseif ('<' == $char) {
                        $IN_TAG = true;
                        $lines[$key] .= '<';
                    } elseif ('&' == $char) {
                        $substr = substr($line, $i + 3, 5);
                        $posi = strpos($substr, ';');
                        if (false === $posi) {
                            ++$pos;
                        } else {
                            $pos -= $posi+2;
                        }
                        $lines[$key] .= $char;
                    } elseif ("\t" == $char) {
                        $str = '';
                        // OPTIMISE - move $strs out. Make an array:
                        // $tabs = array(
                        //  1 => '&nbsp;',
                        //  2 => '&nbsp; ',
                        //  3 => '&nbsp; &nbsp;' etc etc
                        // to use instead of building a string every time
                        $tab_end_width = $tab_width - ($pos % $tab_width); //Moved out of the look as it doesn't change within the loop
                        if (($pos & 1) || 1 == $tab_end_width) {
                            $str .= substr($tab_string, 6, $tab_end_width);
                        } else {
                            $str .= substr($tab_string, 0, $tab_end_width+5);
                        }
                        $lines[$key] .= $str;
                        $pos += $tab_end_width;

                        if (false === strpos($line, "\t", $i + 1)) {
                            $lines[$key] .= substr($line, $i + 1);
                            break;
                        }
                    } elseif (0 == $pos && ' ' == $char) {
                        $lines[$key] .= '&nbsp;';
                        ++$pos;
                    } else {
                        $lines[$key] .= $char;
                        ++$pos;
                    }
                }
            }
            $result = implode("\n", $lines);
            unset($lines);//We don't need the lines separated beyond this --- free them!
        }
        // Other whitespace
        // BenBE: Fix to reduce the number of replacements to be done
        $result = preg_replace('/^ /m', '&nbsp;', $result);
        $result = str_replace('  ', ' &nbsp;', $result);

        if ($this->line_numbers == GESHI_NO_LINE_NUMBERS && $this->header_type != GESHI_HEADER_PRE_TABLE) {
            if ($this->line_ending === null) {
                $result = nl2br($result);
            } else {
                $result = str_replace("\n", $this->line_ending, $result);
            }
        }
    }
590530
protected function processResult($result)
    {
        $output = Helper::objectToArray($result);

        if (! is_array($output)) {
            throw new Error\Api($output);
        }

        if (isset($output['result'])) {
            return $output;
        }

        if (
            isset($output['request']) &&
            $output['request']['result'] != 1 &&
            $output['request']['result'] !== 'TRUE') {
            throw new Error\Api($output['request']['errorId'] . ' - ' . $output['request']['errorMessage']);
        }

        return $output;
    }
537093
private function start()
    {
        $annotation = (object) array(
            'name' => $this->tokens->getValue($this->tokens->key() + 1),
            'values' => new ArrayObject(),
        );

        // skip the name token
        $this->tokens->next();

        $offset = $this->tokens->key();

        // nest, if necessary
        if ($this->current) {
            if (null === ($key = $this->tokens->getKey($offset - 1))) {
                $this->current[] = $annotation;
            } else {
                $this->current[$key] = $annotation;
            }

            $this->stack[] = $this->current;

            // add to root
        } else {
            $this->result[] = $annotation;
        }

        if (DocLexer::T_OPEN_PARENTHESIS
            === $this->tokens->getId($offset + 1)) {
            $this->current = $annotation->values;
        }
    }
850306
protected function result($result)
    {
        $this->result =
            $result instanceof Result
                ? $result
                : new Result($result['healthy'], $result['exception_message']);

        return $this->result;
    }
370878
public function sendResponse($result)
    {
        if (!($this->framework->getRequest() instanceof WebRequest)) {
            return;
        }
        
        return $this->restHelper->sendResponse($this->framework->getRequest(), $this->framework->getResponse(), $result);
    }
357344
public function addNextPage(Result $result): ? string
    {
        $query = $result->getQuery();
        $urlParameters = $this->generateQueryUrlParameters($result);
        $page = $query->getPage();
        $nextPage = $page + 1;

        if ((($nextPage - 1) * $query->getSize()) > $result->getTotalHits()) {
            return null;
        }

        $urlParameters['page'] = $nextPage;

        return $this->createUrlByUrlParameters(
            $result,
            $urlParameters
        )['route'];
    }
1100833
public function add($result)
    {
        $this->sets[] = $result;

        if ($result->count()) {
            $this->append_result($result);
        }
        else if ($result->incomplete) {
            $this->incomplete = true;
        }
    }
1112981
protected function after_update($result) {
        global $DB;

        if (!$result) {
            $this->beforeupdate = null;
            return;
        }

        // The parent ID has changed, we need to fix all the paths of the children.
        if ($this->beforeupdate->get('parentid') != $this->get('parentid')) {
            $beforepath = $this->beforeupdate->get('path') . $this->get('id') . '/';

            $like = $DB->sql_like('path', '?');
            $likesearch = $DB->sql_like_escape($beforepath) . '%';

            $table = '{' . self::TABLE . '}';
            $sql = "UPDATE $table SET path = REPLACE(path, ?, ?) WHERE " . $like;
            $DB->execute($sql, array(
                $beforepath,
                $this->get('path') . $this->get('id') . '/',
                $likesearch
            ));

            // Resolving sortorder holes left after changing parent.
            $table = '{' . self::TABLE . '}';
            $sql = "UPDATE $table SET sortorder = sortorder -1 "
                    . " WHERE  competencyframeworkid = ? AND parentid = ? AND sortorder > ?";
            $DB->execute($sql, array($this->get('competencyframeworkid'),
                                        $this->beforeupdate->get('parentid'),
                                        $this->beforeupdate->get('sortorder')
                                    ));
        }

        $this->beforeupdate = null;
    }