Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions src/Illuminate/Broadcasting/BroadcastManager.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -111,15 +111,9 @@ public function queue($event)
$connection = $event->connection; $connection = $event->connection;
} }


$queue = null; $queue = (method_exists($event, 'broadcastQueue'))

? $event->broadcastQueue()
if (method_exists($event, 'broadcastQueue')) { : $event->broadcastQueue ?? $event->queue ?? null;
$queue = $event->broadcastQueue();
} elseif (isset($event->broadcastQueue)) {
$queue = $event->broadcastQueue;
} elseif (isset($event->queue)) {
$queue = $event->queue;
}


$this->app->make('queue')->connection($connection)->pushOn( $this->app->make('queue')->connection($connection)->pushOn(
$queue, new BroadcastEvent(clone $event) $queue, new BroadcastEvent(clone $event)
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Bus/Dispatcher.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public function dispatch($command)
{ {
if ($this->queueResolver && $this->commandShouldBeQueued($command)) { if ($this->queueResolver && $this->commandShouldBeQueued($command)) {
return $this->dispatchToQueue($command); return $this->dispatchToQueue($command);
} else {
return $this->dispatchNow($command);
} }

return $this->dispatchNow($command);
} }


/** /**
Expand Down Expand Up @@ -155,9 +155,9 @@ public function dispatchToQueue($command)


if (method_exists($command, 'queue')) { if (method_exists($command, 'queue')) {
return $command->queue($queue, $command); return $command->queue($queue, $command);
} else {
return $this->pushCommandToQueue($queue, $command);
} }

return $this->pushCommandToQueue($queue, $command);
} }


/** /**
Expand Down
6 changes: 3 additions & 3 deletions src/Illuminate/Cache/CacheManager.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ protected function resolve($name)
} else { } else {
$driverMethod = 'create'.ucfirst($config['driver']).'Driver'; $driverMethod = 'create'.ucfirst($config['driver']).'Driver';


if (method_exists($this, $driverMethod)) { if (! method_exists($this, $driverMethod)) {
return $this->{$driverMethod}($config);
} else {
throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported."); throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
} }

return $this->{$driverMethod}($config);
} }
} }


Expand Down
10 changes: 3 additions & 7 deletions src/Illuminate/Cache/MemcachedStore.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -78,13 +78,9 @@ public function many(array $keys)
return $this->prefix.$key; return $this->prefix.$key;
}, $keys); }, $keys);


if ($this->onVersionThree) { $values = ($this->onVersionThree)
$values = $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER); ? $this->memcached->getMulti($prefixedKeys, Memcached::GET_PRESERVE_ORDER)
} else { : $this->memcached->getMulti($prefixedKeys, null, Memcached::GET_PRESERVE_ORDER);
$null = null;

$values = $this->memcached->getMulti($prefixedKeys, $null, Memcached::GET_PRESERVE_ORDER);
}


if ($this->memcached->getResultCode() != 0) { if ($this->memcached->getResultCode() != 0) {
return array_fill_keys($keys, null); return array_fill_keys($keys, null);
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Console/Scheduling/CommandBuilder.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public function buildCommand(Event $event)
{ {
if ($event->runInBackground) { if ($event->runInBackground) {
return $this->buildBackgroundCommand($event); return $this->buildBackgroundCommand($event);
} else {
return $this->buildForegroundCommand($event);
} }

return $this->buildForegroundCommand($event);
} }


/** /**
Expand Down
8 changes: 3 additions & 5 deletions src/Illuminate/Container/Container.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -627,11 +627,9 @@ protected function resolve($abstract, $parameters = [])
// We're ready to instantiate an instance of the concrete type registered for // We're ready to instantiate an instance of the concrete type registered for
// the binding. This will instantiate the types, as well as resolve any of // the binding. This will instantiate the types, as well as resolve any of
// its "nested" dependencies recursively until all have gotten resolved. // its "nested" dependencies recursively until all have gotten resolved.
if ($this->isBuildable($concrete, $abstract)) { $object = ($this->isBuildable($concrete, $abstract))
$object = $this->build($concrete); ? $this->build($concrete)
} else { : $this->make($concrete);
$object = $this->make($concrete);
}


// If we defined any extenders for this type, we'll need to spin through them // If we defined any extenders for this type, we'll need to spin through them
// and apply them to the object being built. This allows for the extension // and apply them to the object being built. This allows for the extension
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Connectors/PostgresConnector.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ protected function formatSchema($schema)
{ {
if (is_array($schema)) { if (is_array($schema)) {
return '"'.implode('", "', $schema).'"'; return '"'.implode('", "', $schema).'"';
} else {
return '"'.$schema.'"';
} }

return '"'.$schema.'"';
} }


/** /**
Expand Down
8 changes: 5 additions & 3 deletions src/Illuminate/Database/Connectors/SqlServerConnector.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ protected function getDsn(array $config)
// need to establish the PDO connections and return them back for use. // need to establish the PDO connections and return them back for use.
if (in_array('dblib', $this->getAvailableDrivers())) { if (in_array('dblib', $this->getAvailableDrivers())) {
return $this->getDblibDsn($config); return $this->getDblibDsn($config);
} elseif ($this->prefersOdbc($config)) { }

if ($this->prefersOdbc($config)) {
return $this->getOdbcDsn($config); return $this->getOdbcDsn($config);
} else {
return $this->getSqlSrvDsn($config);
} }

return $this->getSqlSrvDsn($config);
} }


/** /**
Expand Down
9 changes: 3 additions & 6 deletions src/Illuminate/Database/Eloquent/ModelNotFoundException.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -34,12 +34,9 @@ public function setModel($model, $ids = [])
$this->ids = Arr::wrap($ids); $this->ids = Arr::wrap($ids);


$this->message = "No query results for model [{$model}]"; $this->message = "No query results for model [{$model}]";

$this->message .= (count($this->ids) > 0)
if (count($this->ids) > 0) { ? ' '.implode(', ', $this->ids)
$this->message .= ' '.implode(', ', $this->ids); : '.';
} else {
$this->message .= '.';
}


return $this; return $this;
} }
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Migrations/Migrator.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -204,9 +204,9 @@ public function rollback($paths = [], array $options = [])
$this->note('<info>Nothing to rollback.</info>'); $this->note('<info>Nothing to rollback.</info>');


return []; return [];
} else {
return $this->rollbackMigrations($migrations, $paths, $options);
} }

return $this->rollbackMigrations($migrations, $paths, $options);
} }


/** /**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Database/Query/Grammars/MySqlGrammar.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ protected function compileUpdateColumns($values)
return collect($values)->map(function ($value, $key) { return collect($values)->map(function ($value, $key) {
if ($this->isJsonSelector($key)) { if ($this->isJsonSelector($key)) {
return $this->compileJsonUpdateColumn($key, new JsonExpression($value)); return $this->compileJsonUpdateColumn($key, new JsonExpression($value));
} else {
return $this->wrap($key).' = '.$this->parameter($value);
} }

return $this->wrap($key).' = '.$this->parameter($value);
})->implode(', '); })->implode(', ');
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ public function processInsertGetId(Builder $query, $sql, $values, $sequence = nu


$connection->insert($sql, $values); $connection->insert($sql, $values);


if ($connection->getConfig('odbc') === true) { $id = ($connection->getConfig('odbc') === true)
$id = $this->processInsertGetIdForOdbc($connection); ? $this->processInsertGetIdForOdbc($connection)
} else { : $connection->getPdo()->lastInsertId();
$id = $connection->getPdo()->lastInsertId();
}


return is_numeric($id) ? (int) $id : $id; return is_numeric($id) ? (int) $id : $id;
} }
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Filesystem/FilesystemAdapter.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -391,9 +391,9 @@ protected function getLocalUrl($path)
// are really supposed to use. We will remove the public from this path here. // are really supposed to use. We will remove the public from this path here.
if (Str::contains($path, '/storage/public/')) { if (Str::contains($path, '/storage/public/')) {
return Str::replaceFirst('/public/', '/', $path); return Str::replaceFirst('/public/', '/', $path);
} else {
return $path;
} }

return $path;
} }


/** /**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Filesystem/FilesystemManager.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ protected function resolve($name)


if (method_exists($this, $driverMethod)) { if (method_exists($this, $driverMethod)) {
return $this->{$driverMethod}($config); return $this->{$driverMethod}($config);
} else {
throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
} }

throw new InvalidArgumentException("Driver [{$config['driver']}] is not supported.");
} }


/** /**
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Foundation/Console/ListenerMakeCommand.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ protected function getStub()
return $this->option('event') return $this->option('event')
? __DIR__.'/stubs/listener-queued.stub' ? __DIR__.'/stubs/listener-queued.stub'
: __DIR__.'/stubs/listener-queued-duck.stub'; : __DIR__.'/stubs/listener-queued-duck.stub';
} else {
return $this->option('event')
? __DIR__.'/stubs/listener.stub'
: __DIR__.'/stubs/listener-duck.stub';
} }

return $this->option('event')
? __DIR__.'/stubs/listener.stub'
: __DIR__.'/stubs/listener-duck.stub';
} }


/** /**
Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Foundation/Console/TestMakeCommand.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ protected function getStub()
{ {
if ($this->option('unit')) { if ($this->option('unit')) {
return __DIR__.'/stubs/unit-test.stub'; return __DIR__.'/stubs/unit-test.stub';
} else {
return __DIR__.'/stubs/test.stub';
} }

return __DIR__.'/stubs/test.stub';
} }


/** /**
Expand All @@ -65,9 +65,9 @@ protected function getDefaultNamespace($rootNamespace)
{ {
if ($this->option('unit')) { if ($this->option('unit')) {
return $rootNamespace.'\Unit'; return $rootNamespace.'\Unit';
} else {
return $rootNamespace.'\Feature';
} }

return $rootNamespace.'\Feature';
} }


/** /**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Testing/WithoutEvents.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function disableEventsForAllTests()
{ {
if (method_exists($this, 'withoutEvents')) { if (method_exists($this, 'withoutEvents')) {
$this->withoutEvents(); $this->withoutEvents();
} else {
throw new Exception('Unable to disable events. ApplicationTrait not used.');
} }

throw new Exception('Unable to disable events. ApplicationTrait not used.');
} }
} }
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Testing/WithoutMiddleware.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ public function disableMiddlewareForAllTests()
{ {
if (method_exists($this, 'withoutMiddleware')) { if (method_exists($this, 'withoutMiddleware')) {
$this->withoutMiddleware(); $this->withoutMiddleware();
} else {
throw new Exception('Unable to disable middleware. MakesHttpRequests trait not used.');
} }

throw new Exception('Unable to disable middleware. MakesHttpRequests trait not used.');
} }
} }
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/helpers.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ function auth($guard = null)
{ {
if (is_null($guard)) { if (is_null($guard)) {
return app(AuthFactory::class); return app(AuthFactory::class);
} else {
return app(AuthFactory::class)->guard($guard);
} }

return app(AuthFactory::class)->guard($guard);
} }
} }


Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Routing/RouteUrlGenerator.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ protected function getRouteScheme($route)
return 'http://'; return 'http://';
} elseif ($route->httpsOnly()) { } elseif ($route->httpsOnly()) {
return 'https://'; return 'https://';
} else {
return $this->url->formatScheme(null);
} }

return $this->url->formatScheme(null);
} }


/** /**
Expand Down Expand Up @@ -212,9 +212,9 @@ protected function replaceNamedParameters($path, &$parameters)
return Arr::pull($parameters, $m[1]); return Arr::pull($parameters, $m[1]);
} elseif (isset($this->defaultParameters[$m[1]])) { } elseif (isset($this->defaultParameters[$m[1]])) {
return $this->defaultParameters[$m[1]]; return $this->defaultParameters[$m[1]];
} else {
return $m[0];
} }

return $m[0];
}, $path); }, $path);
} }


Expand Down
8 changes: 4 additions & 4 deletions src/Illuminate/Routing/UrlGenerator.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ public function previous($fallback = false)
return $url; return $url;
} elseif ($fallback) { } elseif ($fallback) {
return $this->to($fallback); return $this->to($fallback);
} else {
return $this->to('/');
} }

return $this->to('/');
} }


/** /**
Expand Down Expand Up @@ -351,9 +351,9 @@ protected function formatAction($action)
{ {
if ($this->rootNamespace && ! (strpos($action, '\\') === 0)) { if ($this->rootNamespace && ! (strpos($action, '\\') === 0)) {
return $this->rootNamespace.'\\'.$action; return $this->rootNamespace.'\\'.$action;
} else {
return trim($action, '\\');
} }

return trim($action, '\\');
} }


/** /**
Expand Down
4 changes: 2 additions & 2 deletions src/Illuminate/Session/SessionManager.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ protected function buildSession($handler)
{ {
if ($this->app['config']['session.encrypt']) { if ($this->app['config']['session.encrypt']) {
return $this->buildEncryptedSession($handler); return $this->buildEncryptedSession($handler);
} else {
return new Store($this->app['config']['session.cookie'], $handler);
} }

return new Store($this->app['config']['session.cookie'], $handler);
} }


/** /**
Expand Down
12 changes: 5 additions & 7 deletions src/Illuminate/Validation/ValidationRuleParser.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ protected function explodeExplicitRule($rule)
return explode('|', $rule); return explode('|', $rule);
} elseif (is_object($rule)) { } elseif (is_object($rule)) {
return [$this->prepareRule($rule)]; return [$this->prepareRule($rule)];
} else {
return array_map([$this, 'prepareRule'], $rule);
} }

return array_map([$this, 'prepareRule'], $rule);
} }


/** /**
Expand Down Expand Up @@ -195,11 +195,9 @@ public static function parse($rules)
return [$rules, []]; return [$rules, []];
} }


if (is_array($rules)) { $rules = (is_array($rules))
$rules = static::parseArrayRule($rules); ? static::parseArrayRule($rules)
} else { : static::parseStringRule($rules);
$rules = static::parseStringRule($rules);
}


$rules[0] = static::normalizeRule($rules[0]); $rules[0] = static::normalizeRule($rules[0]);


Expand Down