protected function checkParameters(array $parameters)
    {
        if (!array_key_exists('record_type', $parameters)) {
            throw new \InvalidArgumentException('You need to provide the record_type.');
        }

        if (!in_array($parameters['record_type'], array('A', 'CNAME', 'NS', 'TXT', 'MX', 'SRV'))) {
            throw new \InvalidArgumentException('The record_type can only be A, CNAME, NS, TXT, MX or SRV');
        }

        if (!array_key_exists('data', $parameters) || !is_string($parameters['data'])) {
            throw new \InvalidArgumentException('You need to provide the data value of the record.');
        }

        if (in_array($parameters['record_type'], array('A', 'CNAME', 'TXT', 'SRV'))) {
            if (!array_key_exists('name', $parameters) || !is_string($parameters['name'])) {
                throw new \InvalidArgumentException('You need to provide the name string if the record_type is A, CNAME, TXT or SRV.');
            }
        }

        if (in_array($parameters['record_type'], array('SRV', 'MX'))) {
            if (!array_key_exists('priority', $parameters) || !is_int($parameters['priority'])) {
                throw new \InvalidArgumentException('You need to provide the priority integer if the record_type is SRV or MX.');
            }
        }

        if ('SRV' === $parameters['record_type']) {
            if (!array_key_exists('port', $parameters) || !is_int($parameters['port'])) {
                throw new \InvalidArgumentException('You need to provide the port integer if the record_type is SRV.');
            }
        }

        if ('SRV' === $parameters['record_type']) {
            if (!array_key_exists('weight', $parameters) || !is_int($parameters['weight'])) {
                throw new \InvalidArgumentException('You need to provide the weight integer if the record_type is SRV.');
            }
        }
    }
protected function checkParameters(array $parameters)
    {
        if (!array_key_exists('record_type', $parameters)) {
            throw new \InvalidArgumentException('You need to provide the record_type.');
        }

        if (!in_array($parameters['record_type'], array('A', 'CNAME', 'NS', 'TXT', 'MX', 'SRV'))) {
            throw new \InvalidArgumentException('The record_type can only be A, CNAME, NS, TXT, MX or SRV');
        }

        if (!array_key_exists('data', $parameters) || !is_string($parameters['data'])) {
            throw new \InvalidArgumentException('You need to provide the data value of the record.');
        }

        if (in_array($parameters['record_type'], array('A', 'CNAME', 'TXT', 'SRV'))) {
            if (!array_key_exists('name', $parameters) || !is_string($parameters['name'])) {
                throw new \InvalidArgumentException('You need to provide the name string if the record_type is A, CNAME, TXT or SRV.');
            }
        }

        if (in_array($parameters['record_type'], array('SRV', 'MX'))) {
            if (!array_key_exists('priority', $parameters) || !is_int($parameters['priority'])) {
                throw new \InvalidArgumentException('You need to provide the priority integer if the record_type is SRV or MX.');
            }
        }

        if ('SRV' === $parameters['record_type']) {
            if (!array_key_exists('port', $parameters) || !is_int($parameters['port'])) {
                throw new \InvalidArgumentException('You need to provide the port integer if the record_type is SRV.');
            }
        }

        if ('SRV' === $parameters['record_type']) {
            if (!array_key_exists('weight', $parameters) || !is_int($parameters['weight'])) {
                throw new \InvalidArgumentException('You need to provide the weight integer if the record_type is SRV.');
            }
        }
    }
protected function checkParameters ( array $ parameters ) { if ( ! array_key_exists ( 'record_type' , $ parameters ) ) { throw new \ InvalidArgumentException ( 'You need to provide the record_type.' ) ; } if ( ! in_array ( $ parameters [ 'record_type' ] , array ( 'A' , 'CNAME' , 'NS' , 'TXT' , 'MX' , 'SRV' ) ) ) { throw new \ InvalidArgumentException ( 'The record_type can only be A, CNAME, NS, TXT, MX or SRV' ) ; } if ( ! array_key_exists ( 'data' , $ parameters ) || ! is_string ( $ parameters [ 'data' ] ) ) { throw new \ InvalidArgumentException ( 'You need to provide the data value of the record.' ) ; } if ( in_array ( $ parameters [ 'record_type' ] , array ( 'A' , 'CNAME' , 'TXT' , 'SRV' ) ) ) { if ( ! array_key_exists ( 'name' , $ parameters ) || ! is_string ( $ parameters [ 'name' ] ) ) { throw new \ InvalidArgumentException ( 'You need to provide the name string if the record_type is A, CNAME, TXT or SRV.' ) ; } } if ( in_array ( $ parameters [ 'record_type' ] , array ( 'SRV' , 'MX' ) ) ) { if ( ! array_key_exists ( 'priority' , $ parameters ) || ! is_int ( $ parameters [ 'priority' ] ) ) { throw new \ InvalidArgumentException ( 'You need to provide the priority integer if the record_type is SRV or MX.' ) ; } } if ( 'SRV' === $ parameters [ 'record_type' ] ) { if ( ! array_key_exists ( 'port' , $ parameters ) || ! is_int ( $ parameters [ 'port' ] ) ) { throw new \ InvalidArgumentException ( 'You need to provide the port integer if the record_type is SRV.' ) ; } } if ( 'SRV' === $ parameters [ 'record_type' ] ) { if ( ! array_key_exists ( 'weight' , $ parameters ) || ! is_int ( $ parameters [ 'weight' ] ) ) { throw new \ InvalidArgumentException ( 'You need to provide the weight integer if the record_type is SRV.' ) ; } } }
Check submitted parameters.

The array requires record_type and data keys:
- record_type can be only 'A', 'CNAME', 'NS', 'TXT', 'MX' or 'SRV'.
- data is a string, the value of the record.

Special cases:
- name is a required string if the record_type is 'A', 'CNAME', 'TXT' or 'SRV'.
- priority is an required integer if the record_type is 'SRV' or 'MX'.
- port is an required integer if the record_type is 'SRV'.
- weight is an required integer if the record_type is 'SRV'.

@param array $parameters An array of parameters.

@throws \InvalidArgumentException
Check submitted parameters .