private function selectDataParser()
    {
        /* @var ContentTypeParser $selected */
        $selected = null;

        //Has content?
        if (!empty($this->getContentType())) {

            //Search trough the registered parsers
            foreach (self::$registeredParsers as $parser) {
                /* @var ContentTypeParser $parser */
                if ($parser->canHandle($this->getContentType())) {
                    $selected = $parser;
                    break;
                }
            }
        }

        //If no one was found, pick GenericParser
        if (is_null($selected)) {
            $selected = new GenericParser();
        }

        $selected->setRequest($this);
        $this->parser = $selected;
    }
private function selectDataParser()
    {
        /* @var ContentTypeParser $selected */
        $selected = null;

        //Has content?
        if (!empty($this->getContentType())) {

            //Search trough the registered parsers
            foreach (self::$registeredParsers as $parser) {
                /* @var ContentTypeParser $parser */
                if ($parser->canHandle($this->getContentType())) {
                    $selected = $parser;
                    break;
                }
            }
        }

        //If no one was found, pick GenericParser
        if (is_null($selected)) {
            $selected = new GenericParser();
        }

        $selected->setRequest($this);
        $this->parser = $selected;
    }
private function selectDataParser ( ) { /* @var ContentTypeParser $selected */ $ selected = null ; //Has content? if ( ! empty ( $ this -> getContentType ( ) ) ) { //Search trough the registered parsers foreach ( self :: $ registeredParsers as $ parser ) { /* @var ContentTypeParser $parser */ if ( $ parser -> canHandle ( $ this -> getContentType ( ) ) ) { $ selected = $ parser ; break ; } } } //If no one was found, pick GenericParser if ( is_null ( $ selected ) ) { $ selected = new GenericParser ( ) ; } $ selected -> setRequest ( $ this ) ; $ this -> parser = $ selected ; }
Pick a content type parser
from the list.
Pick a content type parser from the list .