Prepare very simple response with not found error (404)
as plain text response into `\MvcCore\Application::$response`.
@param string $text
@return bool
559860
public function RenderError404PlainText ($text = '') {
		$htmlResponse = FALSE;
		$responseClass = $this->responseClass;
		$configClass = $this->configClass;
		if (!$configClass::IsDevelopment(TRUE)) {
			$text = 'Error 404: Page not found.';
		} else {
			$obContent = ob_get_clean();
			if (mb_strlen($obContent) > 0)
				$htmlResponse = mb_strpos($obContent, '<') !== FALSE && mb_strpos($obContent, '>') !== FALSE;
			if ($htmlResponse) {
				$text = '<pre><big>Error 404</big>: '.PHP_EOL.PHP_EOL.$text.'</pre>'.$obContent;
			} else {
				$text = 'Error 404: '.PHP_EOL.PHP_EOL.$text.$obContent;
			}
		}
		$this->response = $responseClass::CreateInstance(
			\MvcCore\IResponse::NOT_FOUND,
			['Content-Type' => $htmlResponse ? 'text/html' : 'text/plain'],
			$text
		);
		return FALSE;
	}
391546
public function setText(string $text): self
    {
        return $this->addPart(Part::create($text, 'text/plain'), true);
    }
519264
private function createDateFromText($text)
    {
        try {
            $date = new \DateTime($text);
        } catch (\Exception $e) {
            $date = new \DateTime(self::DEFAULT_TO_DATE);
        }

        return $date->format('Y-m-d');
    }
866129
public function renderPlain($text = null)
    {
        if ($this->text !== null and $text === null) {
            $text = $this->text;
        }

        return preg_replace("/\[(.*?)\]/is", '', $text);
    }
239476
public static function toHtml($text)
    {
        $text = htmlspecialchars($text);
        $text = nl2br(str_replace(' ', '&nbsp;', $text));
        return $text; //define in QuickPHP\Libs\CoreFunction.inc.php
    }
1118395
public function format($text)
    {
        preg_match_all(self::REGEX_PLACEHOLDER, $text, $matches, PREG_SET_ORDER);

        foreach ($matches as $match) {
            $uid = (int)$match[1];
            //meh, fix the following lines late
            $parent = $this->findParentFromDataUid($uid);
            $el = $this->findItemFromUid($uid);
            $node = $this->om->getRepository('ClarolineCoreBundle:Resource\ResourceNode')
                ->findOneBy(
                    array(
                        'parent' => $parent,
                        'name' => $el['name'],
                        'resourceType' => $this->resourceManager->getResourceTypeByName($el['type'])
                    )
                );

            if ($node) {
                $toReplace = $this->generateDisplayedUrlForTinyMce($node);
                $text = str_replace($match[0], $toReplace, $text);
            }
        }

        $event = $this->eventDispatcher->dispatch(
            'rich_text_format_event_import',
            'RichTextFormat',
            array($text)
        );

        return $event->getText();
    }
439684
public function setResponse($response)
    {
        $xml = simplexml_load_string($response);
        if (!empty($xml->error)) {
            $this->message = (string) $xml->error;
        }
    }
124890
private function processText($text)
    {
        // verify if content is a string otherwhise just return the original provided content
        if (!is_string($text) || empty($text)) {
            return $text;
        }
        // find all tags based on the REGEX expression
        preg_match_all(static::REGEX, $text, $results, PREG_SET_ORDER);
        // foreach all the results matches the regex
        foreach ($results as $row) {
            // When value is empty (can be caused by using `link[]` we have to skip this item.
            if (empty($row['value'])) {
                continue;
            }
            // extract tag name from regex
            $tag = $row['function'];
            if ($this->hasTag($tag)) {
                $replace = $this->parseTag($tag, $row);
                $text = preg_replace('/'.preg_quote($row[0], '/').'/mi', $replace, $text, 1);
            }
        }
        
        return $text;
    }
681573
public static function plainProcessor($text)
    {
        $text = static::emailToLink($text);
        $text = static::urlToLink($text);
        $text = nl2br($text);

        return $text;
    }
246783
private function handleResponse($response)
    {

        if ($response instanceof View) {
            $content = $response->render();
        } elseif ($response instanceof Response) {
            $content = $response->getContent();
        } elseif ($response instanceof Request) {
            $content = $response->getResponse()->getContent();
        } elseif (is_string($response)) {
            $content = $response;
        } else {
            $content = false;
        }

        return $content;
    }
1192910
public function iWaitUntilISeeText($text){
        $page = $this->getSession()->getPage();
        $session = $this->getSession();
        $this->spin(function($page) use ($page, $session, $text) {
            $element = $page->find(
                'xpath',
                $session->getSelectorsHandler()->selectorToXpath("xpath", ".//*[contains(text(), '$text')]")
            );

            if(empty($element)) {
                return false;
            } else {
                return ($element->isVisible());
            }
        });
    }
174724
public function setText(string $text)
    {
        $this->resource = mailparse_msg_create();
        $eaten = 0;
        $text_length = strlen($text);
        while ($eaten < $text_length) {
            mailparse_msg_parse($this->resource, substr($text, $eaten, 2082));
            $eaten += 2082;
        }

        $this->text = $text;

        return $this;
    }
1077039
protected function prepare(Text $text)
    {
        // Unify line endings
        $text->replaceString("\r\n", "\n");
        $text->replaceString("\r", "\n");

        // Replace tabs by spaces
        $text->replace('/(.*?)\t/', function (Text $whole, Text $string) {
            $tabWidth = 4;
            return $string . str_repeat(' ', $tabWidth - $string->getLength() % $tabWidth);
        });
    }
165215
static public function write($text)
    {

        $text = str_replace('<div>', '', $text);
        $text = str_replace('</div>', '; ', $text);

        $data ['text'] = "\n" . date('Y-m-d H:i') . '; ' . $text;

        $data ['parameters'] = serialize($_REQUEST);

        $tFile = fopen(self::$writeFile, 'a');

        fputs($tFile, $data ['text']);

        fclose($tFile);

        return true;
    }
501495
public function read($text)
    {
        $payload = $this->getPayload($text);

        $handle = $this->getHandle();
        $handle->setUrl($payload->getServiceUrl());
        $handle->setOption(CURLOPT_RETURNTRANSFER, 1);
        $handle->setOption(CURLOPT_POST, true);

        $handle->setOption(CURLOPT_POSTFIELDS, $payload->getPayload());
        $handle->setOption(CURLOPT_HTTPHEADER, $payload->getHeaders());
        $handle->setOption(CURLOPT_SSL_VERIFYPEER, false);

        $response = $handle->execute();
        $this->setHeaders($handle->getInfo());
        return $response;
    }
1310217
private function getTranslatedText($text)
    {
        if ($this->isEnglish($text)) {
            return $text;
        }
        $text = $this->removeSegment($text);
        $url = $this->getTranslateUrl($text);
        $response = $this->http->get($url);

        return $this->getTranslation(json_decode($response->getBody(), true));
    }
1272664
public function parse(string $text) : string
    {
        if ($text === '')
            throw new ParseException($this, $text, 0, self::NO_EMPTY);
        return $text;
    }