private function checkRequired()
    {
        // Loop through all params
        foreach ($this->params as $param) {
            if (array_key_exists('required', $param) && $param['required'] == true) {
                if (!array_key_exists($param['name'], $this->pinputs)) {
                    throw new \Exception('Parameter "' . $param['name'] . '" is required');
                }
            }
        }

        // Loop through all options
        foreach ($this->options as $key => $option) {
            // if option is required
            if (array_key_exists('required', $option) && $option['required'] == true) {
                // check that it is defined in pinputs
                if ($this->pinputs[$option['short']] == false) {
                    throw new \Exception('Option "' . $option['help'] . '" is required');
                }
            }
        }

    }
private function checkRequired()
    {
        // Loop through all params
        foreach ($this->params as $param) {
            if (array_key_exists('required', $param) && $param['required'] == true) {
                if (!array_key_exists($param['name'], $this->pinputs)) {
                    throw new \Exception('Parameter "' . $param['name'] . '" is required');
                }
            }
        }

        // Loop through all options
        foreach ($this->options as $key => $option) {
            // if option is required
            if (array_key_exists('required', $option) && $option['required'] == true) {
                // check that it is defined in pinputs
                if ($this->pinputs[$option['short']] == false) {
                    throw new \Exception('Option "' . $option['help'] . '" is required');
                }
            }
        }

    }
private function checkRequired ( ) { // Loop through all params foreach ( $ this -> params as $ param ) { if ( array_key_exists ( 'required' , $ param ) && $ param [ 'required' ] == true ) { if ( ! array_key_exists ( $ param [ 'name' ] , $ this -> pinputs ) ) { throw new \ Exception ( 'Parameter "' . $ param [ 'name' ] . '" is required' ) ; } } } // Loop through all options foreach ( $ this -> options as $ key => $ option ) { // if option is required if ( array_key_exists ( 'required' , $ option ) && $ option [ 'required' ] == true ) { // check that it is defined in pinputs if ( $ this -> pinputs [ $ option [ 'short' ] ] == false ) { throw new \ Exception ( 'Option "' . $ option [ 'help' ] . '" is required' ) ; } } } }
Check required options
If a required option is not provided then throw and exception

@throws \Exception if required param or option is not present
Check required options If a required option is not provided then throw and exception