src/Analyse/Callback/Analyse/Objects/Traversable.php
protected function getTaversableData()
    {
        $data = $this->parameters[static::PARAM_DATA];
        $name = $this->parameters[static::PARAM_NAME];

        // Add a try to prevent the hosting CMS from doing something stupid.
        try {
            // We need to deactivate the current error handling to
            // prevent the host system to do anything stupid.
            set_error_handler(
                function () {
                    // Do nothing.
                }
            );
            $parameter = iterator_to_array($data);
        } catch (\Throwable $e) {
            //Restore the previous error handler, and return an empty string.
            restore_error_handler();
            $this->pool->emergencyHandler->downOneNestingLevel();
            return '';
        } catch (\Exception $e) {
            //Restore the previous error handler, and return an empty string.
            restore_error_handler();
            $this->pool->emergencyHandler->downOneNestingLevel();
            return '';
        }

        // Reactivate whatever error handling we had previously.
        restore_error_handler();

        if (is_array($parameter) === true) {
            // Special Array Access here, resulting in more complicated source
            // generation. So we tell the callback to to that.
            $multiline = true;

            // Normal ArrayAccess, direct access to the array. Nothing special
            if ($data instanceof \ArrayAccess) {
                $multiline = false;
            }

            // SplObject pool use the object as keys, so we need some
            // multiline stuff!
            if ($data instanceof \SplObjectStorage) {
                $multiline = true;
            }

            $count = count($parameter);

            /** @var Model $model */
            $model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
                ->setName($name)
                ->setType(static::TYPE_FOREACH)
                ->addParameter(static::PARAM_DATA, $parameter)
                ->addParameter(static::PARAM_MULTILINE, $multiline)
                ->addToJson(static::META_LENGTH, count($parameter));

            // Check, if we are handling a huge array. Huge arrays tend to result in a huge
            // output, maybe even triggering a emergency break. to avoid this, we give them
            // a special callback.
            if ($count > (int) $this->pool->config->getSetting(Fallback::SETTING_ARRAY_COUNT_LIMIT)) {
                $model->injectCallback(
                    $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughLargeArray')
                )->setNormal('Simplified Traversable Info')
                    ->setHelpid('simpleArray');
            } else {
                $model->injectCallback(
                    $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughArray')
                )->setNormal('Traversable Info');
            }

            $result = $this->pool->render->renderExpandableChild(
                $this->dispatchEventWithModel(static::EVENT_MARKER_ANALYSES_END, $model)
            );
            $this->pool->emergencyHandler->downOneNestingLevel();
            return $result;
        }

        // Still here?!? Return an empty string.
        $this->pool->emergencyHandler->downOneNestingLevel();
        return '';
    }
protected function getTaversableData()
    {
        $data = $this->parameters[static::PARAM_DATA];
        $name = $this->parameters[static::PARAM_NAME];

        // Add a try to prevent the hosting CMS from doing something stupid.
        try {
            // We need to deactivate the current error handling to
            // prevent the host system to do anything stupid.
            set_error_handler(
                function () {
                    // Do nothing.
                }
            );
            $parameter = iterator_to_array($data);
        } catch (\Throwable $e) {
            //Restore the previous error handler, and return an empty string.
            restore_error_handler();
            $this->pool->emergencyHandler->downOneNestingLevel();
            return '';
        } catch (\Exception $e) {
            //Restore the previous error handler, and return an empty string.
            restore_error_handler();
            $this->pool->emergencyHandler->downOneNestingLevel();
            return '';
        }

        // Reactivate whatever error handling we had previously.
        restore_error_handler();

        if (is_array($parameter) === true) {
            // Special Array Access here, resulting in more complicated source
            // generation. So we tell the callback to to that.
            $multiline = true;

            // Normal ArrayAccess, direct access to the array. Nothing special
            if ($data instanceof \ArrayAccess) {
                $multiline = false;
            }

            // SplObject pool use the object as keys, so we need some
            // multiline stuff!
            if ($data instanceof \SplObjectStorage) {
                $multiline = true;
            }

            $count = count($parameter);

            /** @var Model $model */
            $model = $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Model')
                ->setName($name)
                ->setType(static::TYPE_FOREACH)
                ->addParameter(static::PARAM_DATA, $parameter)
                ->addParameter(static::PARAM_MULTILINE, $multiline)
                ->addToJson(static::META_LENGTH, count($parameter));

            // Check, if we are handling a huge array. Huge arrays tend to result in a huge
            // output, maybe even triggering a emergency break. to avoid this, we give them
            // a special callback.
            if ($count > (int) $this->pool->config->getSetting(Fallback::SETTING_ARRAY_COUNT_LIMIT)) {
                $model->injectCallback(
                    $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughLargeArray')
                )->setNormal('Simplified Traversable Info')
                    ->setHelpid('simpleArray');
            } else {
                $model->injectCallback(
                    $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughArray')
                )->setNormal('Traversable Info');
            }

            $result = $this->pool->render->renderExpandableChild(
                $this->dispatchEventWithModel(static::EVENT_MARKER_ANALYSES_END, $model)
            );
            $this->pool->emergencyHandler->downOneNestingLevel();
            return $result;
        }

        // Still here?!? Return an empty string.
        $this->pool->emergencyHandler->downOneNestingLevel();
        return '';
    }
protected function getTaversableData ( ) { $ data = $ this -> parameters [ static :: PARAM_DATA ] ; $ name = $ this -> parameters [ static :: PARAM_NAME ] ; // Add a try to prevent the hosting CMS from doing something stupid. try { // We need to deactivate the current error handling to // prevent the host system to do anything stupid. set_error_handler ( function ( ) { // Do nothing. } ) ; $ parameter = iterator_to_array ( $ data ) ; } catch ( \ Throwable $ e ) { //Restore the previous error handler, and return an empty string. restore_error_handler ( ) ; $ this -> pool -> emergencyHandler -> downOneNestingLevel ( ) ; return '' ; } catch ( \ Exception $ e ) { //Restore the previous error handler, and return an empty string. restore_error_handler ( ) ; $ this -> pool -> emergencyHandler -> downOneNestingLevel ( ) ; return '' ; } // Reactivate whatever error handling we had previously. restore_error_handler ( ) ; if ( is_array ( $ parameter ) === true ) { // Special Array Access here, resulting in more complicated source // generation. So we tell the callback to to that. $ multiline = true ; // Normal ArrayAccess, direct access to the array. Nothing special if ( $ data instanceof \ ArrayAccess ) { $ multiline = false ; } // SplObject pool use the object as keys, so we need some // multiline stuff! if ( $ data instanceof \ SplObjectStorage ) { $ multiline = true ; } $ count = count ( $ parameter ) ; /** @var Model $model */ $ model = $ this -> pool -> createClass ( 'Brainworxx\\Krexx\\Analyse\\Model' ) -> setName ( $ name ) -> setType ( static :: TYPE_FOREACH ) -> addParameter ( static :: PARAM_DATA , $ parameter ) -> addParameter ( static :: PARAM_MULTILINE , $ multiline ) -> addToJson ( static :: META_LENGTH , count ( $ parameter ) ) ; // Check, if we are handling a huge array. Huge arrays tend to result in a huge // output, maybe even triggering a emergency break. to avoid this, we give them // a special callback. if ( $ count > ( int ) $ this -> pool -> config -> getSetting ( Fallback :: SETTING_ARRAY_COUNT_LIMIT ) ) { $ model -> injectCallback ( $ this -> pool -> createClass ( 'Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughLargeArray' ) ) -> setNormal ( 'Simplified Traversable Info' ) -> setHelpid ( 'simpleArray' ) ; } else { $ model -> injectCallback ( $ this -> pool -> createClass ( 'Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughArray' ) ) -> setNormal ( 'Traversable Info' ) ; } $ result = $ this -> pool -> render -> renderExpandableChild ( $ this -> dispatchEventWithModel ( static :: EVENT_MARKER_ANALYSES_END , $ model ) ) ; $ this -> pool -> emergencyHandler -> downOneNestingLevel ( ) ; return $ result ; } // Still here?!? Return an empty string. $ this -> pool -> emergencyHandler -> downOneNestingLevel ( ) ; return '' ; }
Analyses the traversable data.

@return string
The generated markup.
Analyses the traversable data .