Page MenuHomePhabricator

Make a method to do checking of 0 or 1 of the parameters existence (like requireOnlyOneParameter), but without needing one of the parameters
Closed, ResolvedPublic

Description

Make a method to do checking of 0 or 1 of the parameters existence (like requireOnlyOneParameter), but without needing one of the parameters

More a personal TODO. Hence crappy title

If someone can think of a nice method name, it'd be appreciated ;)


Version: unspecified
Severity: enhancement

Details

Reference
bz27716

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:35 PM
bzimport set Reference to bz27716.

I'm trying to remember my use case for this one now.

HMMMMM

OH

		if ( isset( $params['users'] ) && isset( $params['ip'] ) ) {
			$this->dieUsage( 'bkusers and bkip cannot be used together', 'usersandip' );
		}

vs requireOnlyOneParameter

		if ( count( $intersection ) > 1 ) {
			$this->dieUsage( 'The parameters ' . implode( ', ', $intersection ) . ' can not be used together', 'invalidparammix' );
		} elseif ( count( $intersection ) == 0 ) {
			$this->dieUsage( 'One of the parameters ' . implode( ', ', $required ) . ' is required', 'missingparam' );
		}

Something like that without the == 0 check/error it seeeems...