src/Analyse/Routing/Process/ProcessString.php
public function process(Model $model)
    {
        $data = $model->getData();

        // Check if this is a possible callback.
        // We are not going to analyse this further, because modern systems
        // do not use these anymore.
        if (function_exists($data) === true) {
            $model->setIsCallback(true);
        }

        // Checking the encoding.
        $encoding = $this->pool->encodingService->mbDetectEncoding($data);
        if ($encoding === false) {
            // Looks like we have a mixed encoded string.
            // We need to tell the dev!
            $length = $this->pool->encodingService->mbStrLen($data);
            $strlen = 'broken encoding ' . $length;
            $model->addToJson(static::META_ENCODING, 'broken');
        } else {
            // Normal encoding, nothing special here.
            $length = $strlen = $this->pool->encodingService->mbStrLen($data, $encoding);
        }

        if ($length > 20) {
            // Getting mime type from the string.
            // With larger strings, there is a good chance that there is
            // something interesting in there.
            $model->addToJson(static::META_MIME_TYPE, $this->bufferInfo->buffer($data));
        }

        // Check, if we are handling large string, and if we need to use a
        // preview (which we call "extra").
        // We also need to check for linebreaks, because the preview can not
        // display those.
        if ($length > 50 || strstr($data, PHP_EOL) !== false) {
            $cut = $this->pool->encodingService->encodeString(
                $this->pool->encodingService->mbSubStr($data, 0, 50)
            ) . static::UNKNOWN_VALUE;

            $data = $this->pool->encodingService->encodeString($data);

            $model->setHasExtra(true)
                ->setNormal($cut)
                ->setData($data);
        } else {
            $model->setNormal($this->pool->encodingService->encodeString($data));
        }

        return $this->pool->render->renderSingleChild(
            $model->setType(static::TYPE_STRING . $strlen)
                ->addToJson(static::META_LENGTH, $length)
        );
    }
public function process(Model $model)
    {
        $data = $model->getData();

        // Check if this is a possible callback.
        // We are not going to analyse this further, because modern systems
        // do not use these anymore.
        if (function_exists($data) === true) {
            $model->setIsCallback(true);
        }

        // Checking the encoding.
        $encoding = $this->pool->encodingService->mbDetectEncoding($data);
        if ($encoding === false) {
            // Looks like we have a mixed encoded string.
            // We need to tell the dev!
            $length = $this->pool->encodingService->mbStrLen($data);
            $strlen = 'broken encoding ' . $length;
            $model->addToJson(static::META_ENCODING, 'broken');
        } else {
            // Normal encoding, nothing special here.
            $length = $strlen = $this->pool->encodingService->mbStrLen($data, $encoding);
        }

        if ($length > 20) {
            // Getting mime type from the string.
            // With larger strings, there is a good chance that there is
            // something interesting in there.
            $model->addToJson(static::META_MIME_TYPE, $this->bufferInfo->buffer($data));
        }

        // Check, if we are handling large string, and if we need to use a
        // preview (which we call "extra").
        // We also need to check for linebreaks, because the preview can not
        // display those.
        if ($length > 50 || strstr($data, PHP_EOL) !== false) {
            $cut = $this->pool->encodingService->encodeString(
                $this->pool->encodingService->mbSubStr($data, 0, 50)
            ) . static::UNKNOWN_VALUE;

            $data = $this->pool->encodingService->encodeString($data);

            $model->setHasExtra(true)
                ->setNormal($cut)
                ->setData($data);
        } else {
            $model->setNormal($this->pool->encodingService->encodeString($data));
        }

        return $this->pool->render->renderSingleChild(
            $model->setType(static::TYPE_STRING . $strlen)
                ->addToJson(static::META_LENGTH, $length)
        );
    }
public function process ( Model $ model ) { $ data = $ model -> getData ( ) ; // Check if this is a possible callback. // We are not going to analyse this further, because modern systems // do not use these anymore. if ( function_exists ( $ data ) === true ) { $ model -> setIsCallback ( true ) ; } // Checking the encoding. $ encoding = $ this -> pool -> encodingService -> mbDetectEncoding ( $ data ) ; if ( $ encoding === false ) { // Looks like we have a mixed encoded string. // We need to tell the dev! $ length = $ this -> pool -> encodingService -> mbStrLen ( $ data ) ; $ strlen = 'broken encoding ' . $ length ; $ model -> addToJson ( static :: META_ENCODING , 'broken' ) ; } else { // Normal encoding, nothing special here. $ length = $ strlen = $ this -> pool -> encodingService -> mbStrLen ( $ data , $ encoding ) ; } if ( $ length > 20 ) { // Getting mime type from the string. // With larger strings, there is a good chance that there is // something interesting in there. $ model -> addToJson ( static :: META_MIME_TYPE , $ this -> bufferInfo -> buffer ( $ data ) ) ; } // Check, if we are handling large string, and if we need to use a // preview (which we call "extra"). // We also need to check for linebreaks, because the preview can not // display those. if ( $ length > 50 || strstr ( $ data , PHP_EOL ) !== false ) { $ cut = $ this -> pool -> encodingService -> encodeString ( $ this -> pool -> encodingService -> mbSubStr ( $ data , 0 , 50 ) ) . static :: UNKNOWN_VALUE ; $ data = $ this -> pool -> encodingService -> encodeString ( $ data ) ; $ model -> setHasExtra ( true ) -> setNormal ( $ cut ) -> setData ( $ data ) ; } else { $ model -> setNormal ( $ this -> pool -> encodingService -> encodeString ( $ data ) ) ; } return $ this -> pool -> render -> renderSingleChild ( $ model -> setType ( static :: TYPE_STRING . $ strlen ) -> addToJson ( static :: META_LENGTH , $ length ) ) ; }
Render a dump for a string value.

@param Model $model
The data we are analysing.

@return string
The rendered markup.
Render a dump for a string value .