protected function provides($mimetype)
    {
        if (count($this->request->getAccept()) == 0) return 0;
        $pos = array_search($mimetype, $this->request->getAccept());
        if ($pos === FALSE) {
            if (in_array('*/*', $this->request->getAccept())) {
                return 0;
            } else {
                throw new NotAcceptableException('No matching method for response type "'.join(', ', $this->request->getAccept()).'"');
            }
        } else {
            $this->after(function ($response) use ($mimetype) {
                $response->contentType = $mimetype;
            });

            return count($this->request->getAccept()) - $pos;
        }
    }
protected function provides($mimetype)
    {
        if (count($this->request->getAccept()) == 0) return 0;
        $pos = array_search($mimetype, $this->request->getAccept());
        if ($pos === FALSE) {
            if (in_array('*/*', $this->request->getAccept())) {
                return 0;
            } else {
                throw new NotAcceptableException('No matching method for response type "'.join(', ', $this->request->getAccept()).'"');
            }
        } else {
            $this->after(function ($response) use ($mimetype) {
                $response->contentType = $mimetype;
            });

            return count($this->request->getAccept()) - $pos;
        }
    }
protected function provides ( $ mimetype ) { if ( count ( $ this -> request -> getAccept ( ) ) == 0 ) return 0 ; $ pos = array_search ( $ mimetype , $ this -> request -> getAccept ( ) ) ; if ( $ pos === FALSE ) { if ( in_array ( '*/*' , $ this -> request -> getAccept ( ) ) ) { return 0 ; } else { throw new NotAcceptableException ( 'No matching method for response type "' . join ( ', ' , $ this -> request -> getAccept ( ) ) . '"' ) ; } } else { $ this -> after ( function ( $ response ) use ( $ mimetype ) { $ response -> contentType = $ mimetype ; } ) ; return count ( $ this -> request -> getAccept ( ) ) - $ pos ; } }
Provides condition mimetype must be in request accept array, returns a number
based on the priority of the match.
@param  str $mimetype
@return int
Provides condition mimetype must be in request accept array returns a number based on the priority of the match .