src/Analyse/Routing/Process/ProcessResource.php
public function process(Model $model)
    {
        $resource = $model->getData();
        $type = get_resource_type($resource);
        $typeString = 'resource (' . $type . ')';

        switch ($type) {
            case 'stream':
                $meta = stream_get_meta_data($resource);
                break;

            case 'curl':
                // No need to check for a curl installation, because we are
                // facing a curl instance right here.
                $meta = curl_getinfo($resource);
                break;

            default:
                $meta = array();
        }

        // Check, if we have something useful.
        if (empty($meta)) {
            // If we are facing a closed resource, 'Unknown' is a little bit sparse.
            // PHP 7.2 can provide more info by calling gettype().
            if (version_compare(phpversion(), '7.2.0', '>=')) {
                $typeString = gettype($resource);
            }
            return $this->pool->render->renderSingleChild(
                $model->setData($typeString)
                    ->setNormal($typeString)
                    ->setType(static::TYPE_RESOURCE)
            );
        }

        // Output meta data from the class.
        return $this->pool->render->renderExpandableChild(
            $model->setType(static::TYPE_RESOURCE)
                ->addParameter(static::PARAM_DATA, $meta)
                ->setNormal($typeString)
                ->injectCallback(
                    $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughResource')
                )
        );
    }
public function process(Model $model)
    {
        $resource = $model->getData();
        $type = get_resource_type($resource);
        $typeString = 'resource (' . $type . ')';

        switch ($type) {
            case 'stream':
                $meta = stream_get_meta_data($resource);
                break;

            case 'curl':
                // No need to check for a curl installation, because we are
                // facing a curl instance right here.
                $meta = curl_getinfo($resource);
                break;

            default:
                $meta = array();
        }

        // Check, if we have something useful.
        if (empty($meta)) {
            // If we are facing a closed resource, 'Unknown' is a little bit sparse.
            // PHP 7.2 can provide more info by calling gettype().
            if (version_compare(phpversion(), '7.2.0', '>=')) {
                $typeString = gettype($resource);
            }
            return $this->pool->render->renderSingleChild(
                $model->setData($typeString)
                    ->setNormal($typeString)
                    ->setType(static::TYPE_RESOURCE)
            );
        }

        // Output meta data from the class.
        return $this->pool->render->renderExpandableChild(
            $model->setType(static::TYPE_RESOURCE)
                ->addParameter(static::PARAM_DATA, $meta)
                ->setNormal($typeString)
                ->injectCallback(
                    $this->pool->createClass('Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughResource')
                )
        );
    }
public function process ( Model $ model ) { $ resource = $ model -> getData ( ) ; $ type = get_resource_type ( $ resource ) ; $ typeString = 'resource (' . $ type . ')' ; switch ( $ type ) { case 'stream' : $ meta = stream_get_meta_data ( $ resource ) ; break ; case 'curl' : // No need to check for a curl installation, because we are // facing a curl instance right here. $ meta = curl_getinfo ( $ resource ) ; break ; default : $ meta = array ( ) ; } // Check, if we have something useful. if ( empty ( $ meta ) ) { // If we are facing a closed resource, 'Unknown' is a little bit sparse. // PHP 7.2 can provide more info by calling gettype(). if ( version_compare ( phpversion ( ) , '7.2.0' , '>=' ) ) { $ typeString = gettype ( $ resource ) ; } return $ this -> pool -> render -> renderSingleChild ( $ model -> setData ( $ typeString ) -> setNormal ( $ typeString ) -> setType ( static :: TYPE_RESOURCE ) ) ; } // Output meta data from the class. return $ this -> pool -> render -> renderExpandableChild ( $ model -> setType ( static :: TYPE_RESOURCE ) -> addParameter ( static :: PARAM_DATA , $ meta ) -> setNormal ( $ typeString ) -> injectCallback ( $ this -> pool -> createClass ( 'Brainworxx\\Krexx\\Analyse\\Callback\\Iterate\\ThroughResource' ) ) ) ; }
Analyses a resource.

@param Model $model
The data we are analysing.

@return string
The rendered markup.
Analyses a resource .