Is there a duplication here?
- Dominant language
- PHP
- Stars
- 9.4k
- Forks
- 1.3k
- PR merge metrics
- No merged PRs in 30d
Description
### Description
In the following code, **it seems that the code of the 'three if conditions which return true' is as the same as the conditions that return true,** so, is there any reasonable reason to separate that elseif in other statement ( why not use || OR )?.
```php
/**
* Determine if a controller method is in an array of options.
*
* @param array $options
*
* @return bool
*/
protected function optionsApplyToControllerMethod(array $options)
{
if (empty($options)) {
return true;
} elseif (isset($options['only']) && in_array($this->controllerMethod, $this->explodeOnPipes($options['only']))) {
return true;
} elseif (isset($options['except'])) {
return ! in_array($this->controllerMethod, $this->explodeOnPipes($options['except']));
} elseif (in_array($this->controllerMethod, $this->explodeOnPipes($options))) {
return true;
}
return false;
}
```
Click here to fix it! [Route.php](https://github.com/dingo/api/blob/master/src/Routing/Route.php)
Best regards [M. Saud](http://twitter.com/BenSaud_CS)
Contributor guide
Assessment
This issue has not been assessed yet.