Skip to content

Commit

Permalink
CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
GrahamCampbell committed Aug 1, 2015
1 parent bf60f06 commit 8f0ca78
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 45 deletions.
10 changes: 5 additions & 5 deletions ControllerDispatcher.php
Expand Up @@ -126,7 +126,7 @@ protected function getMiddleware($instance, $method)
$results = [];

foreach ($instance->getMiddleware() as $name => $options) {
if (!$this->methodExcludedByOptions($method, $options)) {
if (! $this->methodExcludedByOptions($method, $options)) {
$results[] = $this->router->resolveMiddlewareClassName($name);
}
}
Expand All @@ -143,8 +143,8 @@ protected function getMiddleware($instance, $method)
*/
public function methodExcludedByOptions($method, array $options)
{
return (!empty($options['only']) && !in_array($method, (array) $options['only'])) ||
(!empty($options['except']) && in_array($method, (array) $options['except']));
return (! empty($options['only']) && ! in_array($method, (array) $options['only'])) ||
(! empty($options['except']) && in_array($method, (array) $options['except']));
}

/**
Expand Down Expand Up @@ -182,7 +182,7 @@ protected function before($instance, $route, $request, $method)
// them until we get a response or are finished iterating through this filters.
$response = $this->callFilter($filter, $route, $request);

if (!is_null($response)) {
if (! is_null($response)) {
return $response;
}
}
Expand Down Expand Up @@ -280,7 +280,7 @@ protected function filterFailsOn($filter, $request, $method)
$on = explode('|', $on);
}

return !in_array(strtolower($request->getMethod()), $on);
return ! in_array(strtolower($request->getMethod()), $on);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Matching/SchemeValidator.php
Expand Up @@ -17,7 +17,7 @@ class SchemeValidator implements ValidatorInterface
public function matches(Route $route, Request $request)
{
if ($route->httpOnly()) {
return !$request->secure();
return ! $request->secure();
} elseif ($route->secure()) {
return $request->secure();
}
Expand Down
4 changes: 2 additions & 2 deletions ResourceRegistrar.php
Expand Up @@ -128,7 +128,7 @@ protected function getResourceMethods($defaults, $options)
*/
public function getResourceUri($resource)
{
if (!Str::contains($resource, '.')) {
if (! Str::contains($resource, '.')) {
return $resource;
}

Expand Down Expand Up @@ -194,7 +194,7 @@ protected function getResourceName($resource, $method, $options)
// the resource action. Otherwise we'll just use an empty string for here.
$prefix = isset($options['as']) ? $options['as'].'.' : '';

if (!$this->router->hasGroupStack()) {
if (! $this->router->hasGroupStack()) {
return $prefix.$resource.'.'.$method;
}

Expand Down
4 changes: 2 additions & 2 deletions ResponseFactory.php
Expand Up @@ -82,7 +82,7 @@ public function view($view, $data = [], $status = 200, array $headers = [])
*/
public function json($data = [], $status = 200, array $headers = [], $options = 0)
{
if ($data instanceof Arrayable && !$data instanceof JsonSerializable) {
if ($data instanceof Arrayable && ! $data instanceof JsonSerializable) {
$data = $data->toArray();
}

Expand Down Expand Up @@ -130,7 +130,7 @@ public function download($file, $name = null, array $headers = [], $disposition
{
$response = new BinaryFileResponse($file, 200, $headers, true, $disposition);

if (!is_null($name)) {
if (! is_null($name)) {
return $response->setContentDisposition($disposition, $name, str_replace('%', '', Str::ascii($name)));
}

Expand Down
22 changes: 11 additions & 11 deletions Route.php
Expand Up @@ -106,7 +106,7 @@ public function __construct($methods, $uri, $action)
$this->methods = (array) $methods;
$this->action = $this->parseAction($action);

if (in_array('GET', $this->methods) && !in_array('HEAD', $this->methods)) {
if (in_array('GET', $this->methods) && ! in_array('HEAD', $this->methods)) {
$this->methods[] = 'HEAD';
}

Expand All @@ -126,7 +126,7 @@ public function run(Request $request)
$this->container = $this->container ?: new Container;

try {
if (!is_string($this->action['uses'])) {
if (! is_string($this->action['uses'])) {
return $this->runCallable($request);
}

Expand Down Expand Up @@ -169,7 +169,7 @@ protected function runController(Request $request)
$this->parametersWithoutNulls(), $class, $method
);

if (!method_exists($instance = $this->container->make($class), $method)) {
if (! method_exists($instance = $this->container->make($class), $method)) {
throw new NotFoundHttpException;
}

Expand Down Expand Up @@ -213,11 +213,11 @@ public function matches(Request $request, $includingMethod = true)
$this->compileRoute();

foreach ($this->getValidators() as $validator) {
if (!$includingMethod && $validator instanceof MethodValidator) {
if (! $includingMethod && $validator instanceof MethodValidator) {
continue;
}

if (!$validator->matches($this, $request)) {
if (! $validator->matches($this, $request)) {
return false;
}
}
Expand Down Expand Up @@ -274,7 +274,7 @@ public function middleware()
*/
public function beforeFilters()
{
if (!isset($this->action['before'])) {
if (! isset($this->action['before'])) {
return [];
}

Expand All @@ -290,7 +290,7 @@ public function beforeFilters()
*/
public function afterFilters()
{
if (!isset($this->action['after'])) {
if (! isset($this->action['after'])) {
return [];
}

Expand Down Expand Up @@ -354,7 +354,7 @@ protected static function explodeArrayFilters(array $filters)
*/
public static function parseFilter($filter)
{
if (!Str::contains($filter, ':')) {
if (! Str::contains($filter, ':')) {
return [$filter, []];
}

Expand Down Expand Up @@ -462,7 +462,7 @@ public function parameters()
*/
public function parametersWithoutNulls()
{
return array_filter($this->parameters(), function ($p) { return !is_null($p); });
return array_filter($this->parameters(), function ($p) { return ! is_null($p); });
}

/**
Expand Down Expand Up @@ -526,7 +526,7 @@ public function bindParameters(Request $request)
// If the route has a regular expression for the host part of the URI, we will
// compile that and get the parameter matches for this domain. We will then
// merge them into this parameters array so that this array is completed.
if (!is_null($this->compiled->getHostRegex())) {
if (! is_null($this->compiled->getHostRegex())) {
$params = $this->bindHostParameters(
$request, $params
);
Expand Down Expand Up @@ -616,7 +616,7 @@ protected function parseAction($action)
// If no "uses" property has been set, we will dig through the array to find a
// Closure instance within this list. We will set the first Closure we come
// across into the "uses" property that will get fired off by this route.
elseif (!isset($action['uses'])) {
elseif (! isset($action['uses'])) {
$action['uses'] = $this->findCallable($action);
}

Expand Down
6 changes: 3 additions & 3 deletions RouteCollection.php
Expand Up @@ -127,7 +127,7 @@ public function match(Request $request)
// by the consumer. Otherwise we will check for routes with another verb.
$route = $this->check($routes, $request);

if (!is_null($route)) {
if (! is_null($route)) {
return $route->bind($request);
}

Expand Down Expand Up @@ -159,7 +159,7 @@ protected function checkForAlternateVerbs($request)
$others = [];

foreach ($methods as $method) {
if (!is_null($this->check($this->get($method), $request, false))) {
if (! is_null($this->check($this->get($method), $request, false))) {
$others[] = $method;
}
}
Expand Down Expand Up @@ -239,7 +239,7 @@ protected function get($method = null)
*/
public function hasNamedRoute($name)
{
return !is_null($this->getByName($name));
return ! is_null($this->getByName($name));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions RouteDependencyResolverTrait.php
Expand Up @@ -32,7 +32,7 @@ protected function callWithDependencies($instance, $method)
*/
protected function resolveClassMethodDependencies(array $parameters, $instance, $method)
{
if (!method_exists($instance, $method)) {
if (! method_exists($instance, $method)) {
return $parameters;
}

Expand All @@ -56,7 +56,7 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA
// binding and we do not want to mess with those; otherwise, we resolve it here.
$class = $parameter->getClass();

if ($class && !$this->alreadyInParameters($class->name, $parameters)) {
if ($class && ! $this->alreadyInParameters($class->name, $parameters)) {
array_splice(
$parameters, $key, 0, [$this->container->make($class->name)]
);
Expand All @@ -75,7 +75,7 @@ public function resolveMethodDependencies(array $parameters, ReflectionFunctionA
*/
protected function alreadyInParameters($class, array $parameters)
{
return !is_null(Arr::first($parameters, function ($key, $value) use ($class) {
return ! is_null(Arr::first($parameters, function ($key, $value) use ($class) {
return $value instanceof $class;
}));
}
Expand Down
26 changes: 13 additions & 13 deletions Router.php
Expand Up @@ -247,7 +247,7 @@ public function controller($uri, $controller, $names = [])
// First, we will check to see if a controller prefix has been registered in
// the route group. If it has, we will need to prefix it before trying to
// reflect into the class instance and pull out the method for routing.
if (!empty($this->groupStack)) {
if (! empty($this->groupStack)) {
$prepended = $this->prependGroupUses($controller);
}

Expand Down Expand Up @@ -360,7 +360,7 @@ public function group(array $attributes, Closure $callback)
*/
protected function updateGroupStack(array $attributes)
{
if (!empty($this->groupStack)) {
if (! empty($this->groupStack)) {
$attributes = $this->mergeGroup($attributes, end($this->groupStack));
}

Expand Down Expand Up @@ -450,7 +450,7 @@ protected static function formatGroupPrefix($new, $old)
*/
public function getLastGroupPrefix()
{
if (!empty($this->groupStack)) {
if (! empty($this->groupStack)) {
$last = end($this->groupStack);

return isset($last['prefix']) ? $last['prefix'] : '';
Expand Down Expand Up @@ -587,7 +587,7 @@ protected function convertToControllerAction($action)
// Here we'll merge any group "uses" statement if necessary so that the action
// has the proper clause for this property. Then we can simply set the name
// of the controller on the action and return the action array for usage.
if (!empty($this->groupStack)) {
if (! empty($this->groupStack)) {
$action['uses'] = $this->prependGroupUses($action['uses']);
}

Expand Down Expand Up @@ -875,7 +875,7 @@ public function filter($name, $callback)
*/
protected function parseFilter($callback)
{
if (is_string($callback) && !Str::contains($callback, '@')) {
if (is_string($callback) && ! Str::contains($callback, '@')) {
return $callback.'@filter';
}

Expand All @@ -894,7 +894,7 @@ protected function parseFilter($callback)
*/
public function when($pattern, $name, $methods = null)
{
if (!is_null($methods)) {
if (! is_null($methods)) {
$methods = array_map('strtoupper', (array) $methods);
}

Expand All @@ -913,7 +913,7 @@ public function when($pattern, $name, $methods = null)
*/
public function whenRegex($pattern, $name, $methods = null)
{
if (!is_null($methods)) {
if (! is_null($methods)) {
$methods = array_map('strtoupper', (array) $methods);
}

Expand Down Expand Up @@ -1059,7 +1059,7 @@ protected function callPatternFilters($route, $request)
foreach ($this->findPatternFilters($request) as $filter => $parameters) {
$response = $this->callRouteFilter($filter, $parameters, $route, $request);

if (!is_null($response)) {
if (! is_null($response)) {
return $response;
}
}
Expand Down Expand Up @@ -1155,7 +1155,7 @@ protected function callAttachedBefores($route, $request)
foreach ($route->beforeFilters() as $filter => $parameters) {
$response = $this->callRouteFilter($filter, $parameters, $route, $request);

if (!is_null($response)) {
if (! is_null($response)) {
return $response;
}
}
Expand Down Expand Up @@ -1206,7 +1206,7 @@ public function callRouteFilter($filter, $parameters, $route, $request, $respons
protected function cleanFilterParameters(array $parameters)
{
return array_filter($parameters, function ($p) {
return !is_null($p) && $p !== '';
return ! is_null($p) && $p !== '';
});
}

Expand All @@ -1221,7 +1221,7 @@ public function prepareResponse($request, $response)
{
if ($response instanceof PsrResponseInterface) {
$response = (new HttpFoundationFactory)->createResponse($response);
} elseif (!$response instanceof SymfonyResponse) {
} elseif (! $response instanceof SymfonyResponse) {
$response = new Response($response);
}

Expand All @@ -1235,7 +1235,7 @@ public function prepareResponse($request, $response)
*/
public function hasGroupStack()
{
return !empty($this->groupStack);
return ! empty($this->groupStack);
}

/**
Expand Down Expand Up @@ -1336,7 +1336,7 @@ public function currentRouteNamed($name)
*/
public function currentRouteAction()
{
if (!$this->current()) {
if (! $this->current()) {
return;
}

Expand Down
10 changes: 5 additions & 5 deletions UrlGenerator.php
Expand Up @@ -271,7 +271,7 @@ public function forceSchema($schema)
*/
public function route($name, $parameters = [], $absolute = true)
{
if (!is_null($route = $this->routes->getByName($name))) {
if (! is_null($route = $this->routes->getByName($name))) {
return $this->toRoute($route, $parameters, $absolute);
}

Expand Down Expand Up @@ -358,7 +358,7 @@ protected function addQueryString($uri, array $parameters)
// If the URI has a fragment, we will move it to the end of the URI since it will
// need to come after any query string that may be added to the URL else it is
// not going to be available. We will remove it then append it back on here.
if (!is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) {
if (! is_null($fragment = parse_url($uri, PHP_URL_FRAGMENT))) {
$uri = preg_replace('/#.*/', '', $uri);
}

Expand Down Expand Up @@ -497,7 +497,7 @@ protected function addPortToDomain($domain)

$port = (int) $this->request->getPort();

if (($secure && $port === 443) || (!$secure && $port === 80)) {
if (($secure && $port === 443) || (! $secure && $port === 80)) {
return $domain;
}

Expand Down Expand Up @@ -545,13 +545,13 @@ protected function getRouteScheme($route)
*/
public function action($action, $parameters = [], $absolute = true)
{
if ($this->rootNamespace && !(strpos($action, '\\') === 0)) {
if ($this->rootNamespace && ! (strpos($action, '\\') === 0)) {
$action = $this->rootNamespace.'\\'.$action;
} else {
$action = trim($action, '\\');
}

if (!is_null($route = $this->routes->getByAction($action))) {
if (! is_null($route = $this->routes->getByAction($action))) {
return $this->toRoute($route, $parameters, $absolute);
}

Expand Down

0 comments on commit 8f0ca78

Please sign in to comment.