/** * Returns the binding states selected in the console arguments. * * @param Args $args The console arguments. * * @return int[] The selected {@link BindingState} constants. */ private function getBindingStates(Args $args) { $states = array(BindingState::ENABLED => 'enabled', BindingState::DISABLED => 'disabled', BindingState::TYPE_NOT_FOUND => 'type-not-found', BindingState::TYPE_NOT_ENABLED => 'type-not-enabled', BindingState::INVALID => 'invalid'); $states = array_filter($states, function ($option) use($args) { return $args->isOptionSet($option); }); return array_keys($states) ?: BindingState::all(); }
/** * Returns the binding states selected in the console arguments. * * @param Args $args The console arguments. * * @return int[] The selected {@link BindingState} constants. */ private function getBindingStates(Args $args) { $states = array(); if ($args->isOptionSet('enabled')) { $states[] = BindingState::ENABLED; } if ($args->isOptionSet('disabled')) { $states[] = BindingState::DISABLED; } if ($args->isOptionSet('undecided')) { $states[] = BindingState::UNDECIDED; } if ($args->isOptionSet('type-not-found')) { $states[] = BindingState::TYPE_NOT_FOUND; } if ($args->isOptionSet('type-not-enabled')) { $states[] = BindingState::TYPE_NOT_ENABLED; } if ($args->isOptionSet('invalid')) { $states[] = BindingState::INVALID; } return $states ?: BindingState::all(); }