public static function factory(array $oaResponse) {

		if(empty($oaResponse['auth'])) {
			throw new InvalidArgumentException('The auth key is required to continue.');
		}
		if(empty($oaResponse['auth']['provider'])) {
			throw new InvalidArgumentException('Unable to determine provider.');
		}

		$auth = $oaResponse['auth'];

		$do = OpauthIdentity::get()->filter(
			array(
				'Provider' => $auth['provider'],
				'UID' => $auth['uid'],
			)
		)->first();

		if(!$do || !$do->exists()) {
			$do = new OpauthIdentity();
			$do->Provider = $auth['provider'];
			$do->UID = $auth['uid'];
		}

		$do->setAuthSource($auth);
		return $do;
	}
public static function factory(array $oaResponse) {

		if(empty($oaResponse['auth'])) {
			throw new InvalidArgumentException('The auth key is required to continue.');
		}
		if(empty($oaResponse['auth']['provider'])) {
			throw new InvalidArgumentException('Unable to determine provider.');
		}

		$auth = $oaResponse['auth'];

		$do = OpauthIdentity::get()->filter(
			array(
				'Provider' => $auth['provider'],
				'UID' => $auth['uid'],
			)
		)->first();

		if(!$do || !$do->exists()) {
			$do = new OpauthIdentity();
			$do->Provider = $auth['provider'];
			$do->UID = $auth['uid'];
		}

		$do->setAuthSource($auth);
		return $do;
	}
public static function factory ( array $ oaResponse ) { if ( empty ( $ oaResponse [ 'auth' ] ) ) { throw new InvalidArgumentException ( 'The auth key is required to continue.' ) ; } if ( empty ( $ oaResponse [ 'auth' ] [ 'provider' ] ) ) { throw new InvalidArgumentException ( 'Unable to determine provider.' ) ; } $ auth = $ oaResponse [ 'auth' ] ; $ do = OpauthIdentity :: get ( ) -> filter ( array ( 'Provider' => $ auth [ 'provider' ] , 'UID' => $ auth [ 'uid' ] , ) ) -> first ( ) ; if ( ! $ do || ! $ do -> exists ( ) ) { $ do = new OpauthIdentity ( ) ; $ do -> Provider = $ auth [ 'provider' ] ; $ do -> UID = $ auth [ 'uid' ] ; } $ do -> setAuthSource ( $ auth ) ; return $ do ; }
factory
Returns or creates a fresh OpauthIdentity.
@param array $oaResponse The response object from Opauth.
@return OpauthIdentity instance based on $oaResponse.
factory Returns or creates a fresh OpauthIdentity .