private function checkVerb()
    {
        if (!isset($this->params['verb'])) {
            throw new BadVerbException("Verb is missing");
        }

        $this->verb = $this->params['verb'];
        if (is_array($this->verb)) {
            throw new BadVerbException("Only 1 verb allowed, multiple given");
        }
        if (!array_key_exists($this->verb, self::$verbs)) {
            throw new BadVerbException("$this->verb is not a valid verb");
        }

        $requestParams = $this->params;
        unset($requestParams['verb']);

        $errors = [];
        foreach (array_diff_key($requestParams, array_flip(self::$verbs[$this->verb])) as $key => $value) {
            $errors[] = new BadArgumentException(
                "Argument {$key} is not allowed for verb $this->verb. " .
                "Allowed arguments are: " . implode(", ", self::$verbs[$this->verb])
            );
        }
        if (count($errors)) {
            throw (new MultipleExceptions())->setExceptions($errors);
        }

        //if the resumption token is set it should be the only argument
        if (isset($requestParams['resumptionToken']) && count($requestParams) > 1) {
            throw new BadArgumentException("resumptionToken can not be used together with other arguments");
        }
    }
private function checkVerb()
    {
        if (!isset($this->params['verb'])) {
            throw new BadVerbException("Verb is missing");
        }

        $this->verb = $this->params['verb'];
        if (is_array($this->verb)) {
            throw new BadVerbException("Only 1 verb allowed, multiple given");
        }
        if (!array_key_exists($this->verb, self::$verbs)) {
            throw new BadVerbException("$this->verb is not a valid verb");
        }

        $requestParams = $this->params;
        unset($requestParams['verb']);

        $errors = [];
        foreach (array_diff_key($requestParams, array_flip(self::$verbs[$this->verb])) as $key => $value) {
            $errors[] = new BadArgumentException(
                "Argument {$key} is not allowed for verb $this->verb. " .
                "Allowed arguments are: " . implode(", ", self::$verbs[$this->verb])
            );
        }
        if (count($errors)) {
            throw (new MultipleExceptions())->setExceptions($errors);
        }

        //if the resumption token is set it should be the only argument
        if (isset($requestParams['resumptionToken']) && count($requestParams) > 1) {
            throw new BadArgumentException("resumptionToken can not be used together with other arguments");
        }
    }
private function checkVerb ( ) { if ( ! isset ( $ this -> params [ 'verb' ] ) ) { throw new BadVerbException ( "Verb is missing" ) ; } $ this -> verb = $ this -> params [ 'verb' ] ; if ( is_array ( $ this -> verb ) ) { throw new BadVerbException ( "Only 1 verb allowed, multiple given" ) ; } if ( ! array_key_exists ( $ this -> verb , self :: $ verbs ) ) { throw new BadVerbException ( "$this->verb is not a valid verb" ) ; } $ requestParams = $ this -> params ; unset ( $ requestParams [ 'verb' ] ) ; $ errors = [ ] ; foreach ( array_diff_key ( $ requestParams , array_flip ( self :: $ verbs [ $ this -> verb ] ) ) as $ key => $ value ) { $ errors [ ] = new BadArgumentException ( "Argument {$key} is not allowed for verb $this->verb. " . "Allowed arguments are: " . implode ( ", " , self :: $ verbs [ $ this -> verb ] ) ) ; } if ( count ( $ errors ) ) { throw ( new MultipleExceptions ( ) ) -> setExceptions ( $ errors ) ; } //if the resumption token is set it should be the only argument if ( isset ( $ requestParams [ 'resumptionToken' ] ) && count ( $ requestParams ) > 1 ) { throw new BadArgumentException ( "resumptionToken can not be used together with other arguments" ) ; } }
checks if the provided verb is correct and if the arguments supplied are allowed for this verb
@throws BadArgumentException
@throws BadVerbException
@throws MultipleExceptions
checks if the provided verb is correct and if the arguments supplied are allowed for this verb