CS fixes
This commit is contained in:
parent
01e84501fd
commit
67226679df
44
.php_cs
44
.php_cs
|
@ -1,31 +1,43 @@
|
|||
<?php
|
||||
|
||||
$finder = Symfony\Component\Finder\Finder::create()
|
||||
->files()
|
||||
->in(__DIR__)
|
||||
->name('*.stub')
|
||||
->ignoreDotFiles(true)
|
||||
->ignoreVCS(true);
|
||||
use Symfony\CS\Config\Config;
|
||||
use Symfony\CS\FixerInterface;
|
||||
use Symfony\CS\Finder\DefaultFinder;
|
||||
|
||||
$fixers = [
|
||||
'-psr0',
|
||||
'-php_closing_tag',
|
||||
'blankline_after_open_tag',
|
||||
'braces',
|
||||
'concat_without_spaces',
|
||||
'double_arrow_multiline_whitespaces',
|
||||
'duplicate_semicolon',
|
||||
'elseif',
|
||||
'empty_return',
|
||||
'encoding',
|
||||
'eof_ending',
|
||||
'extra_empty_lines',
|
||||
'function_call_space',
|
||||
'function_declaration',
|
||||
'include',
|
||||
'indentation',
|
||||
'linefeed',
|
||||
'join_function',
|
||||
'line_after_namespace',
|
||||
'list_commas',
|
||||
'logical_not_operators_with_successor_space',
|
||||
'lowercase_constants',
|
||||
'lowercase_keywords',
|
||||
'method_argument_space',
|
||||
'multiline_array_trailing_comma',
|
||||
'multiline_spaces_before_semicolon',
|
||||
'multiple_use',
|
||||
'namespace_no_leading_whitespace',
|
||||
'no_blank_lines_after_class_opening',
|
||||
'no_empty_lines_after_phpdocs',
|
||||
'object_operator',
|
||||
'operators_spaces',
|
||||
'parenthesis',
|
||||
'phpdoc_indent',
|
||||
'phpdoc_inline_tag',
|
||||
'phpdoc_no_access',
|
||||
'phpdoc_no_package',
|
||||
'phpdoc_scalar',
|
||||
|
@ -38,24 +50,24 @@ $fixers = [
|
|||
'remove_lines_between_uses',
|
||||
'return',
|
||||
'self_accessor',
|
||||
'short_array_syntax',
|
||||
'short_echo_tag',
|
||||
'short_tag',
|
||||
'single_array_no_trailing_comma',
|
||||
'single_blank_line_before_namespace',
|
||||
'single_line_after_imports',
|
||||
'single_quote',
|
||||
'spaces_before_semicolon',
|
||||
'spaces_cast',
|
||||
'standardize_not_equal',
|
||||
'ternary_spaces',
|
||||
'trailing_spaces',
|
||||
'trim_array_spaces',
|
||||
'unalign_equals',
|
||||
'unary_operators_spaces',
|
||||
'unused_use',
|
||||
'visibility',
|
||||
'whitespacy_lines',
|
||||
'multiline_spaces_before_semicolon',
|
||||
'short_array_syntax',
|
||||
'short_echo_tag',
|
||||
];
|
||||
|
||||
return Symfony\CS\Config\Config::create()
|
||||
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
|
||||
->fixers($fixers)
|
||||
->finder($finder)
|
||||
->setUsingCache(true);
|
||||
return Config::create()->level(FixerInterface::NONE_LEVEL)->fixers($fixers)->finder(DefaultFinder::create()->in(__DIR__));
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
preset: laravel
|
|
@ -29,9 +29,9 @@ class AuthManager extends Manager
|
|||
}
|
||||
|
||||
if (method_exists($guard, 'setRequest')) {
|
||||
$guard->setRequest($this->app->refresh('request', $guard, 'setRequest'));
|
||||
$guard->setRequest($this->app->refresh('request', $guard, 'setRequest'));
|
||||
}
|
||||
|
||||
|
||||
return $guard;
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ class DatabaseUserProvider implements UserProvider
|
|||
$query = $this->conn->table($this->table);
|
||||
|
||||
foreach ($credentials as $key => $value) {
|
||||
if (!Str::contains($key, 'password')) {
|
||||
if (! Str::contains($key, 'password')) {
|
||||
$query->where($key, $value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ class EloquentUserProvider implements UserProvider
|
|||
$query = $this->createModel()->newQuery();
|
||||
|
||||
foreach ($credentials as $key => $value) {
|
||||
if (!Str::contains($key, 'password')) {
|
||||
if (! Str::contains($key, 'password')) {
|
||||
$query->where($key, $value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ class Guard implements GuardContract
|
|||
*/
|
||||
public function check()
|
||||
{
|
||||
return !is_null($this->user());
|
||||
return ! is_null($this->user());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,7 +119,7 @@ class Guard implements GuardContract
|
|||
*/
|
||||
public function guest()
|
||||
{
|
||||
return !$this->check();
|
||||
return ! $this->check();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,7 +136,7 @@ class Guard implements GuardContract
|
|||
// If we have already retrieved the user for the current request we can just
|
||||
// return it back immediately. We do not want to pull the user data every
|
||||
// request into the method because that would tremendously slow an app.
|
||||
if (!is_null($this->user)) {
|
||||
if (! is_null($this->user)) {
|
||||
return $this->user;
|
||||
}
|
||||
|
||||
|
@ -147,7 +147,7 @@ class Guard implements GuardContract
|
|||
// request, and if one exists, attempt to retrieve the user using that.
|
||||
$user = null;
|
||||
|
||||
if (!is_null($id)) {
|
||||
if (! is_null($id)) {
|
||||
$user = $this->provider->retrieveById($id);
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ class Guard implements GuardContract
|
|||
// the application. Once we have a user we can return it to the caller.
|
||||
$recaller = $this->getRecaller();
|
||||
|
||||
if (is_null($user) && !is_null($recaller)) {
|
||||
if (is_null($user) && ! is_null($recaller)) {
|
||||
$user = $this->getUserByRecaller($recaller);
|
||||
|
||||
if ($user) {
|
||||
|
@ -197,12 +197,12 @@ class Guard implements GuardContract
|
|||
*/
|
||||
protected function getUserByRecaller($recaller)
|
||||
{
|
||||
if ($this->validRecaller($recaller) && !$this->tokenRetrievalAttempted) {
|
||||
if ($this->validRecaller($recaller) && ! $this->tokenRetrievalAttempted) {
|
||||
$this->tokenRetrievalAttempted = true;
|
||||
|
||||
list($id, $token) = explode('|', $recaller, 2);
|
||||
|
||||
$this->viaRemember = !is_null($user = $this->provider->retrieveByToken($id, $token));
|
||||
$this->viaRemember = ! is_null($user = $this->provider->retrieveByToken($id, $token));
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ class Guard implements GuardContract
|
|||
*/
|
||||
protected function validRecaller($recaller)
|
||||
{
|
||||
if (!is_string($recaller) || !Str::contains($recaller, '|')) {
|
||||
if (! is_string($recaller) || ! Str::contains($recaller, '|')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -305,7 +305,7 @@ class Guard implements GuardContract
|
|||
*/
|
||||
public function onceBasic($field = 'email')
|
||||
{
|
||||
if (!$this->once($this->getBasicCredentials($this->getRequest(), $field))) {
|
||||
if (! $this->once($this->getBasicCredentials($this->getRequest(), $field))) {
|
||||
return $this->getBasicResponse();
|
||||
}
|
||||
}
|
||||
|
@ -319,7 +319,7 @@ class Guard implements GuardContract
|
|||
*/
|
||||
protected function attemptBasic(Request $request, $field)
|
||||
{
|
||||
if (!$request->getUser()) {
|
||||
if (! $request->getUser()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -387,7 +387,7 @@ class Guard implements GuardContract
|
|||
*/
|
||||
protected function hasValidCredentials($user, $credentials)
|
||||
{
|
||||
return !is_null($user) && $this->provider->validateCredentials($user, $credentials);
|
||||
return ! is_null($user) && $this->provider->validateCredentials($user, $credentials);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -499,7 +499,7 @@ class Guard implements GuardContract
|
|||
*/
|
||||
public function onceUsingId($id)
|
||||
{
|
||||
if (!is_null($user = $this->provider->retrieveById($id))) {
|
||||
if (! is_null($user = $this->provider->retrieveById($id))) {
|
||||
$this->setUser($user);
|
||||
|
||||
return true;
|
||||
|
@ -546,7 +546,7 @@ class Guard implements GuardContract
|
|||
// listening for anytime a user signs out of this application manually.
|
||||
$this->clearUserDataFromStorage();
|
||||
|
||||
if (!is_null($this->user)) {
|
||||
if (! is_null($this->user)) {
|
||||
$this->refreshRememberToken($user);
|
||||
}
|
||||
|
||||
|
@ -611,7 +611,7 @@ class Guard implements GuardContract
|
|||
*/
|
||||
public function getCookieJar()
|
||||
{
|
||||
if (!isset($this->cookie)) {
|
||||
if (! isset($this->cookie)) {
|
||||
throw new RuntimeException('Cookie jar has not been set.');
|
||||
}
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ class DatabaseTokenRepository implements TokenRepositoryInterface
|
|||
|
||||
$token = (array) $this->getTable()->where('email', $email)->where('token', $token)->first();
|
||||
|
||||
return $token && !$this->tokenExpired($token);
|
||||
return $token && ! $this->tokenExpired($token);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -112,7 +112,7 @@ class PasswordBroker implements PasswordBrokerContract
|
|||
return $this->mailer->send($view, compact('token', 'user'), function ($m) use ($user, $token, $callback) {
|
||||
$m->to($user->getEmailForPasswordReset());
|
||||
|
||||
if (!is_null($callback)) {
|
||||
if (! is_null($callback)) {
|
||||
call_user_func($callback, $m, $user, $token);
|
||||
}
|
||||
});
|
||||
|
@ -132,7 +132,7 @@ class PasswordBroker implements PasswordBrokerContract
|
|||
// the user is properly redirected having an error message on the post.
|
||||
$user = $this->validateReset($credentials);
|
||||
|
||||
if (!$user instanceof CanResetPasswordContract) {
|
||||
if (! $user instanceof CanResetPasswordContract) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
|
@ -160,11 +160,11 @@ class PasswordBroker implements PasswordBrokerContract
|
|||
return PasswordBrokerContract::INVALID_USER;
|
||||
}
|
||||
|
||||
if (!$this->validateNewPassword($credentials)) {
|
||||
if (! $this->validateNewPassword($credentials)) {
|
||||
return PasswordBrokerContract::INVALID_PASSWORD;
|
||||
}
|
||||
|
||||
if (!$this->tokens->exists($user, $credentials['token'])) {
|
||||
if (! $this->tokens->exists($user, $credentials['token'])) {
|
||||
return PasswordBrokerContract::INVALID_TOKEN;
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ class PasswordBroker implements PasswordBrokerContract
|
|||
|
||||
$user = $this->users->retrieveByCredentials($credentials);
|
||||
|
||||
if ($user && !$user instanceof CanResetPasswordContract) {
|
||||
if ($user && ! $user instanceof CanResetPasswordContract) {
|
||||
throw new UnexpectedValueException('User must implement CanResetPassword interface.');
|
||||
}
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ class Dispatcher implements DispatcherContract, QueueingDispatcher, HandlerResol
|
|||
{
|
||||
$queue = call_user_func($this->queueResolver);
|
||||
|
||||
if (!$queue instanceof Queue) {
|
||||
if (! $queue instanceof Queue) {
|
||||
throw new RuntimeException('Queue resolver did not return a Queue implementation.');
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ class DatabaseStore implements Store
|
|||
// If we have a cache record we will check the expiration time against current
|
||||
// time on the system and see if the record has expired. If it has, we will
|
||||
// remove the records from the database table so it isn't returned again.
|
||||
if (!is_null($cache)) {
|
||||
if (! is_null($cache)) {
|
||||
if (is_array($cache)) {
|
||||
$cache = (object) $cache;
|
||||
}
|
||||
|
@ -157,7 +157,7 @@ class DatabaseStore implements Store
|
|||
|
||||
$cache = $this->table()->where('key', $prefixed)->lockForUpdate()->first();
|
||||
|
||||
if (!is_null($cache)) {
|
||||
if (! is_null($cache)) {
|
||||
$current = $this->encrypter->decrypt($cache->value);
|
||||
|
||||
if (is_numeric($current)) {
|
||||
|
|
|
@ -30,7 +30,7 @@ class MemcachedConnector
|
|||
|
||||
$memcachedStatus = $memcached->getVersion();
|
||||
|
||||
if (!is_array($memcachedStatus)) {
|
||||
if (! is_array($memcachedStatus)) {
|
||||
throw new RuntimeException('No Memcached servers added.');
|
||||
}
|
||||
|
||||
|
|
|
@ -6,86 +6,86 @@ use Illuminate\Contracts\Cache\Repository as Cache;
|
|||
|
||||
class RateLimiter
|
||||
{
|
||||
/**
|
||||
* The cache store implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Cache\Repository
|
||||
*/
|
||||
protected $cache;
|
||||
/**
|
||||
* The cache store implementation.
|
||||
*
|
||||
* @var \Illuminate\Contracts\Cache\Repository
|
||||
*/
|
||||
protected $cache;
|
||||
|
||||
/**
|
||||
* Create a new rate limiter instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Cache\Repository $cache
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Cache $cache)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
}
|
||||
/**
|
||||
* Create a new rate limiter instance.
|
||||
*
|
||||
* @param \Illuminate\Contracts\Cache\Repository $cache
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Cache $cache)
|
||||
{
|
||||
$this->cache = $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the given key has been "accessed" too many times.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $maxAttempts
|
||||
* @param int $decayMinutes
|
||||
* @return bool
|
||||
*/
|
||||
public function tooManyAttempts($key, $maxAttempts, $decayMinutes = 1)
|
||||
{
|
||||
$attempts = $this->cache->get(
|
||||
$key, 0
|
||||
);
|
||||
/**
|
||||
* Determine if the given key has been "accessed" too many times.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $maxAttempts
|
||||
* @param int $decayMinutes
|
||||
* @return bool
|
||||
*/
|
||||
public function tooManyAttempts($key, $maxAttempts, $decayMinutes = 1)
|
||||
{
|
||||
$attempts = $this->cache->get(
|
||||
$key, 0
|
||||
);
|
||||
|
||||
$lockedOut = $this->cache->has($key.':lockout');
|
||||
$lockedOut = $this->cache->has($key.':lockout');
|
||||
|
||||
if ($attempts > $maxAttempts || $lockedOut) {
|
||||
if ( ! $lockedOut) {
|
||||
$this->cache->add($key.':lockout', time() + ($decayMinutes * 60), $decayMinutes);
|
||||
}
|
||||
if ($attempts > $maxAttempts || $lockedOut) {
|
||||
if (! $lockedOut) {
|
||||
$this->cache->add($key.':lockout', time() + ($decayMinutes * 60), $decayMinutes);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment the counter for a given key for a given decay time.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $decayMinutes
|
||||
* @return int
|
||||
*/
|
||||
public function hit($key, $decayMinutes = 1)
|
||||
{
|
||||
/**
|
||||
* Increment the counter for a given key for a given decay time.
|
||||
*
|
||||
* @param string $key
|
||||
* @param int $decayMinutes
|
||||
* @return int
|
||||
*/
|
||||
public function hit($key, $decayMinutes = 1)
|
||||
{
|
||||
$this->cache->add($key, 1, $decayMinutes);
|
||||
|
||||
return (int) $this->cache->increment($key);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the hits and lockout for the given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function clear($key)
|
||||
{
|
||||
$this->cache->forget($key);
|
||||
/**
|
||||
* Clear the hits and lockout for the given key.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function clear($key)
|
||||
{
|
||||
$this->cache->forget($key);
|
||||
|
||||
$this->cache->forget($key.':lockout');
|
||||
}
|
||||
$this->cache->forget($key.':lockout');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of seconds until the "key" is accessible again.
|
||||
*
|
||||
* @param string $key
|
||||
* @return int
|
||||
*/
|
||||
public function availableIn($key)
|
||||
{
|
||||
return $this->cache->get($key.':lockout') - time();
|
||||
}
|
||||
/**
|
||||
* Get the number of seconds until the "key" is accessible again.
|
||||
*
|
||||
* @param string $key
|
||||
* @return int
|
||||
*/
|
||||
public function availableIn($key)
|
||||
{
|
||||
return $this->cache->get($key.':lockout') - time();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ class RedisStore extends TaggableStore implements Store
|
|||
*/
|
||||
public function get($key)
|
||||
{
|
||||
if (!is_null($value = $this->connection()->get($this->prefix.$key))) {
|
||||
if (! is_null($value = $this->connection()->get($this->prefix.$key))) {
|
||||
return is_numeric($value) ? $value : unserialize($value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ class Repository implements CacheContract, ArrayAccess
|
|||
*/
|
||||
public function has($key)
|
||||
{
|
||||
return !is_null($this->get($key));
|
||||
return ! is_null($this->get($key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,7 @@ class Repository implements CacheContract, ArrayAccess
|
|||
{
|
||||
$minutes = $this->getMinutes($minutes);
|
||||
|
||||
if (!is_null($minutes)) {
|
||||
if (! is_null($minutes)) {
|
||||
$this->store->put($key, $value, $minutes);
|
||||
|
||||
$this->fireCacheEvent('write', [$key, $value, $minutes]);
|
||||
|
@ -192,7 +192,7 @@ class Repository implements CacheContract, ArrayAccess
|
|||
// If the item exists in the cache we will just return this immediately
|
||||
// otherwise we will execute the given Closure and cache the result
|
||||
// of that execution for the given number of minutes in storage.
|
||||
if (!is_null($value = $this->get($key))) {
|
||||
if (! is_null($value = $this->get($key))) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
@ -225,7 +225,7 @@ class Repository implements CacheContract, ArrayAccess
|
|||
// If the item exists in the cache we will just return this immediately
|
||||
// otherwise we will execute the given Closure and cache the result
|
||||
// of that execution for the given number of minutes. It's easy.
|
||||
if (!is_null($value = $this->get($key))) {
|
||||
if (! is_null($value = $this->get($key))) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ class TaggedCache implements Store
|
|||
*/
|
||||
public function has($key)
|
||||
{
|
||||
return !is_null($this->get($key));
|
||||
return ! is_null($this->get($key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,7 @@ class TaggedCache implements Store
|
|||
{
|
||||
$value = $this->store->get($this->taggedItemKey($key));
|
||||
|
||||
return !is_null($value) ? $value : value($default);
|
||||
return ! is_null($value) ? $value : value($default);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ class TaggedCache implements Store
|
|||
{
|
||||
$minutes = $this->getMinutes($minutes);
|
||||
|
||||
if (!is_null($minutes)) {
|
||||
if (! is_null($minutes)) {
|
||||
$this->store->put($this->taggedItemKey($key), $value, $minutes);
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ class TaggedCache implements Store
|
|||
// If the item exists in the cache we will just return this immediately
|
||||
// otherwise we will execute the given Closure and cache the result
|
||||
// of that execution for the given number of minutes in storage.
|
||||
if (!is_null($value = $this->get($key))) {
|
||||
if (! is_null($value = $this->get($key))) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
@ -200,7 +200,7 @@ class TaggedCache implements Store
|
|||
// If the item exists in the cache we will just return this immediately
|
||||
// otherwise we will execute the given Closure and cache the result
|
||||
// of that execution for the given number of minutes. It's easy.
|
||||
if (!is_null($value = $this->get($key))) {
|
||||
if (! is_null($value = $this->get($key))) {
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class Command extends SymfonyCommand
|
|||
|
||||
$this->setDescription($this->description);
|
||||
|
||||
if (!isset($this->signature)) {
|
||||
if (! isset($this->signature)) {
|
||||
$this->specifyParameters();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ trait ConfirmableTrait
|
|||
|
||||
$confirmed = $this->confirm('Do you really wish to run this command? [y/N]');
|
||||
|
||||
if (!$confirmed) {
|
||||
if (! $confirmed) {
|
||||
$this->comment('Command Cancelled!');
|
||||
|
||||
return false;
|
||||
|
|
|
@ -132,7 +132,7 @@ abstract class GeneratorCommand extends Command
|
|||
*/
|
||||
protected function makeDirectory($path)
|
||||
{
|
||||
if (!$this->files->isDirectory(dirname($path))) {
|
||||
if (! $this->files->isDirectory(dirname($path))) {
|
||||
$this->files->makeDirectory(dirname($path), 0777, true, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ class Parser
|
|||
$options = [];
|
||||
|
||||
foreach ($tokens as $token) {
|
||||
if (!Str::startsWith($token, '--')) {
|
||||
if (! Str::startsWith($token, '--')) {
|
||||
$arguments[] = static::parseArgument($token);
|
||||
} else {
|
||||
$options[] = static::parseOption(ltrim($token, '-'));
|
||||
|
|
|
@ -34,7 +34,7 @@ class CallbackEvent extends Event
|
|||
$this->callback = $callback;
|
||||
$this->parameters = $parameters;
|
||||
|
||||
if (!is_string($this->callback) && !is_callable($this->callback)) {
|
||||
if (! is_string($this->callback) && ! is_callable($this->callback)) {
|
||||
throw new InvalidArgumentException(
|
||||
'Invalid scheduled callback event. Must be string or callable.'
|
||||
);
|
||||
|
@ -85,7 +85,7 @@ class CallbackEvent extends Event
|
|||
*/
|
||||
public function withoutOverlapping()
|
||||
{
|
||||
if (!isset($this->description)) {
|
||||
if (! isset($this->description)) {
|
||||
throw new LogicException(
|
||||
"A scheduled event name is required to prevent overlapping. Use the 'name' method before 'withoutOverlapping'."
|
||||
);
|
||||
|
|
|
@ -231,7 +231,7 @@ class Event
|
|||
*/
|
||||
public function isDue(Application $app)
|
||||
{
|
||||
if (!$this->runsInMaintenanceMode() && $app->isDownForMaintenance()) {
|
||||
if (! $this->runsInMaintenanceMode() && $app->isDownForMaintenance()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -264,7 +264,7 @@ class Event
|
|||
*/
|
||||
protected function filtersPass(Application $app)
|
||||
{
|
||||
if (($this->filter && !$app->call($this->filter)) ||
|
||||
if (($this->filter && ! $app->call($this->filter)) ||
|
||||
$this->reject && $app->call($this->reject)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ class Container implements ArrayAccess, ContainerContract
|
|||
// If the factory is not a Closure, it means it is just a class name which is
|
||||
// is bound into this container to the abstract type and we will just wrap
|
||||
// it up inside a Closure to make things more convenient when extending.
|
||||
if (!$concrete instanceof Closure) {
|
||||
if (! $concrete instanceof Closure) {
|
||||
$concrete = $this->getClosure($abstract, $concrete);
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ class Container implements ArrayAccess, ContainerContract
|
|||
*/
|
||||
public function bindIf($abstract, $concrete = null, $shared = false)
|
||||
{
|
||||
if (!$this->bound($abstract)) {
|
||||
if (! $this->bound($abstract)) {
|
||||
$this->bind($abstract, $concrete, $shared);
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +356,7 @@ class Container implements ArrayAccess, ContainerContract
|
|||
$tags = is_array($tags) ? $tags : array_slice(func_get_args(), 1);
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
if (!isset($this->tags[$tag])) {
|
||||
if (! isset($this->tags[$tag])) {
|
||||
$this->tags[$tag] = [];
|
||||
}
|
||||
|
||||
|
@ -510,7 +510,7 @@ class Container implements ArrayAccess, ContainerContract
|
|||
*/
|
||||
protected function isCallableWithAtSign($callback)
|
||||
{
|
||||
if (!is_string($callback)) {
|
||||
if (! is_string($callback)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -657,14 +657,14 @@ class Container implements ArrayAccess, ContainerContract
|
|||
*/
|
||||
protected function getConcrete($abstract)
|
||||
{
|
||||
if (!is_null($concrete = $this->getContextualConcrete($abstract))) {
|
||||
if (! is_null($concrete = $this->getContextualConcrete($abstract))) {
|
||||
return $concrete;
|
||||
}
|
||||
|
||||
// If we don't have a registered resolver or concrete for the type, we'll just
|
||||
// assume each type is a concrete name and will attempt to resolve it as is
|
||||
// since the container should be able to resolve concretes automatically.
|
||||
if (!isset($this->bindings[$abstract])) {
|
||||
if (! isset($this->bindings[$abstract])) {
|
||||
if ($this->missingLeadingSlash($abstract) &&
|
||||
isset($this->bindings['\\'.$abstract])) {
|
||||
$abstract = '\\'.$abstract;
|
||||
|
@ -738,7 +738,7 @@ class Container implements ArrayAccess, ContainerContract
|
|||
// If the type is not instantiable, the developer is attempting to resolve
|
||||
// an abstract type such as an Interface of Abstract Class and there is
|
||||
// no binding registered for the abstractions so we need to bail out.
|
||||
if (!$reflector->isInstantiable()) {
|
||||
if (! $reflector->isInstantiable()) {
|
||||
$message = "Target [$concrete] is not instantiable.";
|
||||
|
||||
throw new BindingResolutionContractException($message);
|
||||
|
@ -951,7 +951,7 @@ class Container implements ArrayAccess, ContainerContract
|
|||
|
||||
$expected = $function->getParameters()[0];
|
||||
|
||||
if (!$expected->getClass()) {
|
||||
if (! $expected->getClass()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1169,7 +1169,7 @@ class Container implements ArrayAccess, ContainerContract
|
|||
// If the value is not a Closure, we will make it one. This simply gives
|
||||
// more "drop-in" replacement functionality for the Pimple which this
|
||||
// container's simplest functions are base modeled and built after.
|
||||
if (!$value instanceof Closure) {
|
||||
if (! $value instanceof Closure) {
|
||||
$value = function () use ($value) {
|
||||
return $value;
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Illuminate\Contracts\Support;
|
|||
interface Htmlable
|
||||
{
|
||||
/**
|
||||
* Get content as a string of HTML
|
||||
* Get content as a string of HTML.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
|
|
@ -87,7 +87,7 @@ class CookieJar implements JarContract
|
|||
*/
|
||||
public function hasQueued($key)
|
||||
{
|
||||
return !is_null($this->queued($key));
|
||||
return ! is_null($this->queued($key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -733,7 +733,7 @@ class Connection implements ConnectionInterface
|
|||
$this->events->fire('illuminate.query', [$query, $bindings, $time, $this->getName()]);
|
||||
}
|
||||
|
||||
if (!$this->loggingQueries) {
|
||||
if (! $this->loggingQueries) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ class ConnectionFactory
|
|||
*/
|
||||
public function createConnector(array $config)
|
||||
{
|
||||
if (!isset($config['driver'])) {
|
||||
if (! isset($config['driver'])) {
|
||||
throw new InvalidArgumentException('A driver must be specified.');
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class MySqlConnector extends Connector implements ConnectorInterface
|
|||
$charset = $config['charset'];
|
||||
|
||||
$names = "set names '$charset'".
|
||||
(!is_null($collation) ? " collate '$collation'" : '');
|
||||
(! is_null($collation) ? " collate '$collation'" : '');
|
||||
|
||||
$connection->prepare($names)->execute();
|
||||
|
||||
|
@ -81,7 +81,7 @@ class MySqlConnector extends Connector implements ConnectorInterface
|
|||
*/
|
||||
protected function configHasSocket(array $config)
|
||||
{
|
||||
return isset($config['unix_socket']) && !empty($config['unix_socket']);
|
||||
return isset($config['unix_socket']) && ! empty($config['unix_socket']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -51,7 +51,7 @@ class MigrateCommand extends BaseCommand
|
|||
*/
|
||||
public function fire()
|
||||
{
|
||||
if (!$this->confirmToProceed()) {
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class MigrateCommand extends BaseCommand
|
|||
// Next, we will check to see if a path option has been defined. If it has
|
||||
// we will use the path relative to the root of this installation folder
|
||||
// so that migrations may be run for any path within the applications.
|
||||
if (!is_null($path = $this->input->getOption('path'))) {
|
||||
if (! is_null($path = $this->input->getOption('path'))) {
|
||||
$path = $this->laravel->basePath().'/'.$path;
|
||||
} else {
|
||||
$path = $this->getMigrationPath();
|
||||
|
@ -97,7 +97,7 @@ class MigrateCommand extends BaseCommand
|
|||
{
|
||||
$this->migrator->setConnection($this->input->getOption('database'));
|
||||
|
||||
if (!$this->migrator->repositoryExists()) {
|
||||
if (! $this->migrator->repositoryExists()) {
|
||||
$options = ['--database' => $this->input->getOption('database')];
|
||||
|
||||
$this->call('migrate:install', $options);
|
||||
|
|
|
@ -69,7 +69,7 @@ class MigrateMakeCommand extends BaseCommand
|
|||
|
||||
$create = $this->input->getOption('create');
|
||||
|
||||
if (!$table && is_string($create)) {
|
||||
if (! $table && is_string($create)) {
|
||||
$table = $create;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ class MigrateMakeCommand extends BaseCommand
|
|||
*/
|
||||
protected function getMigrationPath()
|
||||
{
|
||||
if (!is_null($targetPath = $this->input->getOption('path'))) {
|
||||
if (! is_null($targetPath = $this->input->getOption('path'))) {
|
||||
return $this->laravel->basePath().'/'.$targetPath;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class RefreshCommand extends Command
|
|||
*/
|
||||
public function fire()
|
||||
{
|
||||
if (!$this->confirmToProceed()) {
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,13 +52,13 @@ class ResetCommand extends Command
|
|||
*/
|
||||
public function fire()
|
||||
{
|
||||
if (!$this->confirmToProceed()) {
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->migrator->setConnection($this->input->getOption('database'));
|
||||
|
||||
if (!$this->migrator->repositoryExists()) {
|
||||
if (! $this->migrator->repositoryExists()) {
|
||||
$this->output->writeln('<comment>Migration table not found.</comment>');
|
||||
|
||||
return;
|
||||
|
|
|
@ -52,7 +52,7 @@ class RollbackCommand extends Command
|
|||
*/
|
||||
public function fire()
|
||||
{
|
||||
if (!$this->confirmToProceed()) {
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ class StatusCommand extends BaseCommand
|
|||
*/
|
||||
public function fire()
|
||||
{
|
||||
if (!$this->migrator->repositoryExists()) {
|
||||
if (! $this->migrator->repositoryExists()) {
|
||||
return $this->error('No migrations found.');
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class SeedCommand extends Command
|
|||
*/
|
||||
public function fire()
|
||||
{
|
||||
if (!$this->confirmToProceed()) {
|
||||
if (! $this->confirmToProceed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ class DatabaseManager implements ConnectionResolverInterface
|
|||
// If we haven't created this connection, we'll create it based on the config
|
||||
// provided in the application. Once we've created the connections we will
|
||||
// set the "fetch mode" for PDO which determines the query return types.
|
||||
if (!isset($this->connections[$name])) {
|
||||
if (! isset($this->connections[$name])) {
|
||||
$connection = $this->makeConnection($name);
|
||||
|
||||
$this->setPdoForType($connection, $type);
|
||||
|
@ -124,7 +124,7 @@ class DatabaseManager implements ConnectionResolverInterface
|
|||
{
|
||||
$this->disconnect($name = $name ?: $this->getDefaultConnection());
|
||||
|
||||
if (!isset($this->connections[$name])) {
|
||||
if (! isset($this->connections[$name])) {
|
||||
return $this->connection($name);
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,7 @@ class Builder
|
|||
if (count($result) == count(array_unique($id))) {
|
||||
return $result;
|
||||
}
|
||||
} elseif (!is_null($result)) {
|
||||
} elseif (! is_null($result)) {
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
@ -150,7 +150,7 @@ class Builder
|
|||
*/
|
||||
public function firstOrFail($columns = ['*'])
|
||||
{
|
||||
if (!is_null($model = $this->first($columns))) {
|
||||
if (! is_null($model = $this->first($columns))) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
@ -351,7 +351,7 @@ class Builder
|
|||
*/
|
||||
protected function addUpdatedAtColumn(array $values)
|
||||
{
|
||||
if (!$this->model->usesTimestamps()) {
|
||||
if (! $this->model->usesTimestamps()) {
|
||||
return $values;
|
||||
}
|
||||
|
||||
|
@ -804,7 +804,7 @@ class Builder
|
|||
foreach (explode('.', $name) as $segment) {
|
||||
$progress[] = $segment;
|
||||
|
||||
if (!isset($results[$last = implode('.', $progress)])) {
|
||||
if (! isset($results[$last = implode('.', $progress)])) {
|
||||
$results[$last] = function () {};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -137,7 +137,7 @@ class Collection extends BaseCollection
|
|||
$dictionary = $this->getDictionary($items);
|
||||
|
||||
foreach ($this->items as $item) {
|
||||
if (!isset($dictionary[$item->getKey()])) {
|
||||
if (! isset($dictionary[$item->getKey()])) {
|
||||
$diff->add($item);
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ class Collection extends BaseCollection
|
|||
*/
|
||||
public function unique($key = null)
|
||||
{
|
||||
if (!is_null($key)) {
|
||||
if (! is_null($key)) {
|
||||
return parent::unique($key);
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class FactoryBuilder
|
|||
protected function makeInstance(array $attributes = [])
|
||||
{
|
||||
return Model::unguarded(function () use ($attributes) {
|
||||
if (!isset($this->definitions[$this->class][$this->name])) {
|
||||
if (! isset($this->definitions[$this->class][$this->name])) {
|
||||
throw new InvalidArgumentException("Unable to locate factory with name [{$this->name}].");
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
{
|
||||
$class = get_class($this);
|
||||
|
||||
if (!isset(static::$booted[$class])) {
|
||||
if (! isset(static::$booted[$class])) {
|
||||
static::$booted[$class] = true;
|
||||
|
||||
$this->fireModelEvent('booting', false);
|
||||
|
@ -351,7 +351,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public static function hasGlobalScope($scope)
|
||||
{
|
||||
return !is_null(static::getGlobalScope($scope));
|
||||
return ! is_null(static::getGlobalScope($scope));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -454,7 +454,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
protected function fillableFromArray(array $attributes)
|
||||
{
|
||||
if (count($this->fillable) > 0 && !static::$unguarded) {
|
||||
if (count($this->fillable) > 0 && ! static::$unguarded) {
|
||||
return array_intersect_key($attributes, array_flip($this->fillable));
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public static function firstOrCreate(array $attributes)
|
||||
{
|
||||
if (!is_null($instance = static::where($attributes)->first())) {
|
||||
if (! is_null($instance = static::where($attributes)->first())) {
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
@ -589,7 +589,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public static function firstOrNew(array $attributes)
|
||||
{
|
||||
if (!is_null($instance = static::where($attributes)->first())) {
|
||||
if (! is_null($instance = static::where($attributes)->first())) {
|
||||
return $instance;
|
||||
}
|
||||
|
||||
|
@ -676,7 +676,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public static function findOrNew($id, $columns = ['*'])
|
||||
{
|
||||
if (!is_null($model = static::find($id, $columns))) {
|
||||
if (! is_null($model = static::find($id, $columns))) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
@ -691,7 +691,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public function fresh(array $with = [])
|
||||
{
|
||||
if (!$this->exists) {
|
||||
if (! $this->exists) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1060,10 +1060,10 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
$caller = Arr::first(debug_backtrace(false), function ($key, $trace) use ($self) {
|
||||
$caller = $trace['function'];
|
||||
|
||||
return !in_array($caller, Model::$manyMethods) && $caller != $self;
|
||||
return ! in_array($caller, Model::$manyMethods) && $caller != $self;
|
||||
});
|
||||
|
||||
return !is_null($caller) ? $caller['function'] : null;
|
||||
return ! is_null($caller) ? $caller['function'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1282,7 +1282,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public static function flushEventListeners()
|
||||
{
|
||||
if (!isset(static::$dispatcher)) {
|
||||
if (! isset(static::$dispatcher)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1400,7 +1400,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
{
|
||||
$query = $this->newQuery();
|
||||
|
||||
if (!$this->exists) {
|
||||
if (! $this->exists) {
|
||||
return $query->{$method}($column, $amount);
|
||||
}
|
||||
|
||||
|
@ -1432,7 +1432,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public function update(array $attributes = [])
|
||||
{
|
||||
if (!$this->exists) {
|
||||
if (! $this->exists) {
|
||||
return $this->newQuery()->update($attributes);
|
||||
}
|
||||
|
||||
|
@ -1446,7 +1446,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public function push()
|
||||
{
|
||||
if (!$this->save()) {
|
||||
if (! $this->save()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1458,7 +1458,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
? $models->all() : [$models];
|
||||
|
||||
foreach (array_filter($models) as $model) {
|
||||
if (!$model->push()) {
|
||||
if (! $model->push()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -1665,7 +1665,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
protected function fireModelEvent($event, $halt = true)
|
||||
{
|
||||
if (!isset(static::$dispatcher)) {
|
||||
if (! isset(static::$dispatcher)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1713,7 +1713,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
public function touch()
|
||||
{
|
||||
if (!$this->timestamps) {
|
||||
if (! $this->timestamps) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1731,11 +1731,11 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
{
|
||||
$time = $this->freshTimestamp();
|
||||
|
||||
if (!$this->isDirty(static::UPDATED_AT)) {
|
||||
if (! $this->isDirty(static::UPDATED_AT)) {
|
||||
$this->setUpdatedAt($time);
|
||||
}
|
||||
|
||||
if (!$this->exists && !$this->isDirty(static::CREATED_AT)) {
|
||||
if (! $this->exists && ! $this->isDirty(static::CREATED_AT)) {
|
||||
$this->setCreatedAt($time);
|
||||
}
|
||||
}
|
||||
|
@ -2288,7 +2288,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
return false;
|
||||
}
|
||||
|
||||
return empty($this->fillable) && !Str::startsWith($key, '_');
|
||||
return empty($this->fillable) && ! Str::startsWith($key, '_');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2320,7 +2320,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
protected function removeTableFromKey($key)
|
||||
{
|
||||
if (!Str::contains($key, '.')) {
|
||||
if (! Str::contains($key, '.')) {
|
||||
return $key;
|
||||
}
|
||||
|
||||
|
@ -2415,7 +2415,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
// to a DateTime / Carbon instance. This is so we will get some consistent
|
||||
// formatting while accessing attributes vs. arraying / JSONing a model.
|
||||
foreach ($this->getDates() as $key) {
|
||||
if (!isset($attributes[$key])) {
|
||||
if (! isset($attributes[$key])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2430,7 +2430,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
// the mutator for the attribute. We cache off every mutated attributes so
|
||||
// we don't have to constantly check on attributes that actually change.
|
||||
foreach ($mutatedAttributes as $key) {
|
||||
if (!array_key_exists($key, $attributes)) {
|
||||
if (! array_key_exists($key, $attributes)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -2443,7 +2443,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
// the values to their appropriate type. If the attribute has a mutator we
|
||||
// will not perform the cast on those attributes to avoid any confusion.
|
||||
foreach ($this->casts as $key => $value) {
|
||||
if (!array_key_exists($key, $attributes) ||
|
||||
if (! array_key_exists($key, $attributes) ||
|
||||
in_array($key, $mutatedAttributes)) {
|
||||
continue;
|
||||
}
|
||||
|
@ -2480,7 +2480,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
*/
|
||||
protected function getArrayableAppends()
|
||||
{
|
||||
if (!count($this->appends)) {
|
||||
if (! count($this->appends)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -2607,7 +2607,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
// instance on retrieval, which makes it quite convenient to work with
|
||||
// date fields without having to create a mutator for each property.
|
||||
elseif (in_array($key, $this->getDates())) {
|
||||
if (!is_null($value)) {
|
||||
if (! is_null($value)) {
|
||||
return $this->asDateTime($value);
|
||||
}
|
||||
}
|
||||
|
@ -2663,7 +2663,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
{
|
||||
$relations = $this->$method();
|
||||
|
||||
if (!$relations instanceof Relation) {
|
||||
if (! $relations instanceof Relation) {
|
||||
throw new LogicException('Relationship method must return an object of type '
|
||||
.'Illuminate\Database\Eloquent\Relations\Relation');
|
||||
}
|
||||
|
@ -3029,7 +3029,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
return count($dirty) > 0;
|
||||
}
|
||||
|
||||
if (!is_array($attributes)) {
|
||||
if (! is_array($attributes)) {
|
||||
$attributes = func_get_args();
|
||||
}
|
||||
|
||||
|
@ -3052,10 +3052,10 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
$dirty = [];
|
||||
|
||||
foreach ($this->attributes as $key => $value) {
|
||||
if (!array_key_exists($key, $this->original)) {
|
||||
if (! array_key_exists($key, $this->original)) {
|
||||
$dirty[$key] = $value;
|
||||
} elseif ($value !== $this->original[$key] &&
|
||||
!$this->originalIsNumericallyEquivalent($key)) {
|
||||
! $this->originalIsNumericallyEquivalent($key)) {
|
||||
$dirty[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
@ -3252,7 +3252,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
{
|
||||
$class = get_class($this);
|
||||
|
||||
if (!isset(static::$mutatorCache[$class])) {
|
||||
if (! isset(static::$mutatorCache[$class])) {
|
||||
static::cacheMutatedAttributes($class);
|
||||
}
|
||||
|
||||
|
@ -3363,7 +3363,7 @@ abstract class Model implements ArrayAccess, Arrayable, Jsonable, JsonSerializab
|
|||
public function __isset($key)
|
||||
{
|
||||
return (isset($this->attributes[$key]) || isset($this->relations[$key])) ||
|
||||
($this->hasGetMutator($key) && !is_null($this->getAttributeValue($key)));
|
||||
($this->hasGetMutator($key) && ! is_null($this->getAttributeValue($key)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -154,7 +154,7 @@ class BelongsTo extends Relation
|
|||
// to query for via the eager loading query. We will add them to an array then
|
||||
// execute a "where in" statement to gather up all of those related records.
|
||||
foreach ($models as $model) {
|
||||
if (!is_null($value = $model->{$this->foreignKey})) {
|
||||
if (! is_null($value = $model->{$this->foreignKey})) {
|
||||
$keys[] = $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ class BelongsToMany extends Relation
|
|||
*/
|
||||
public function firstOrFail($columns = ['*'])
|
||||
{
|
||||
if (!is_null($model = $this->first($columns))) {
|
||||
if (! is_null($model = $this->first($columns))) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
|
@ -782,7 +782,7 @@ class BelongsToMany extends Relation
|
|||
$results = [];
|
||||
|
||||
foreach ($records as $id => $attributes) {
|
||||
if (!is_array($attributes)) {
|
||||
if (! is_array($attributes)) {
|
||||
list($id, $attributes) = [$attributes, []];
|
||||
}
|
||||
|
||||
|
@ -808,7 +808,7 @@ class BelongsToMany extends Relation
|
|||
// If the ID is not in the list of existing pivot IDs, we will insert a new pivot
|
||||
// record, otherwise, we will just update this existing record on this joining
|
||||
// table, so that the developers will easily update these records pain free.
|
||||
if (!in_array($id, $current)) {
|
||||
if (! in_array($id, $current)) {
|
||||
$this->attach($id, $attributes, $touch);
|
||||
|
||||
$changes['attached'][] = (int) $id;
|
||||
|
@ -968,7 +968,7 @@ class BelongsToMany extends Relation
|
|||
{
|
||||
$fresh = $this->parent->freshTimestamp();
|
||||
|
||||
if (!$exists && $this->hasPivotColumn($this->createdAt())) {
|
||||
if (! $exists && $this->hasPivotColumn($this->createdAt())) {
|
||||
$record[$this->createdAt()] = $fresh;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ class MorphTo extends BelongsTo
|
|||
*/
|
||||
public function getResults()
|
||||
{
|
||||
if (!$this->otherKey) {
|
||||
if (! $this->otherKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ trait SoftDeletes
|
|||
*/
|
||||
public function trashed()
|
||||
{
|
||||
return !is_null($this->{$this->getDeletedAtColumn()});
|
||||
return ! is_null($this->{$this->getDeletedAtColumn()});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,7 +96,7 @@ class MigrationCreator
|
|||
// Here we will replace the table place-holders with the table specified by
|
||||
// the developer, which is useful for quickly creating a tables creation
|
||||
// or update migration from the console instead of typing it manually.
|
||||
if (!is_null($table)) {
|
||||
if (! is_null($table)) {
|
||||
$stub = str_replace('DummyTable', $table, $stub);
|
||||
}
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ class Migrator
|
|||
*/
|
||||
public function setConnection($name)
|
||||
{
|
||||
if (!is_null($name)) {
|
||||
if (! is_null($name)) {
|
||||
$this->resolver->setDefaultConnection($name);
|
||||
}
|
||||
|
||||
|
|
|
@ -465,7 +465,7 @@ class Builder
|
|||
// If the given operator is not found in the list of valid operators we will
|
||||
// assume that the developer is just short-cutting the '=' operators and
|
||||
// we will set the operators to '=' and set the values appropriately.
|
||||
if (!in_array(strtolower($operator), $this->operators, true)) {
|
||||
if (! in_array(strtolower($operator), $this->operators, true)) {
|
||||
list($value, $operator) = [$operator, '='];
|
||||
}
|
||||
|
||||
|
@ -490,7 +490,7 @@ class Builder
|
|||
|
||||
$this->wheres[] = compact('type', 'column', 'operator', 'value', 'boolean');
|
||||
|
||||
if (!$value instanceof Expression) {
|
||||
if (! $value instanceof Expression) {
|
||||
$this->addBinding($value, 'where');
|
||||
}
|
||||
|
||||
|
@ -1050,7 +1050,7 @@ class Builder
|
|||
|
||||
$this->havings[] = compact('type', 'column', 'operator', 'value', 'boolean');
|
||||
|
||||
if (!$value instanceof Expression) {
|
||||
if (! $value instanceof Expression) {
|
||||
$this->addBinding($value, 'having');
|
||||
}
|
||||
|
||||
|
@ -1386,7 +1386,7 @@ class Builder
|
|||
*/
|
||||
protected function runSelect()
|
||||
{
|
||||
return $this->connection->select($this->toSql(), $this->getBindings(), !$this->useWritePdo);
|
||||
return $this->connection->select($this->toSql(), $this->getBindings(), ! $this->useWritePdo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1599,7 +1599,7 @@ class Builder
|
|||
*/
|
||||
public function count($columns = '*')
|
||||
{
|
||||
if (!is_array($columns)) {
|
||||
if (! is_array($columns)) {
|
||||
$columns = [$columns];
|
||||
}
|
||||
|
||||
|
@ -1705,7 +1705,7 @@ class Builder
|
|||
// Since every insert gets treated like a batch insert, we will make sure the
|
||||
// bindings are structured in a way that is convenient for building these
|
||||
// inserts statements by verifying the elements are actually an array.
|
||||
if (!is_array(reset($values))) {
|
||||
if (! is_array(reset($values))) {
|
||||
$values = [$values];
|
||||
}
|
||||
|
||||
|
@ -1816,7 +1816,7 @@ class Builder
|
|||
// If an ID is passed to the method, we will set the where clause to check
|
||||
// the ID to allow developers to simply and quickly remove a single row
|
||||
// from their database without manually specifying the where clauses.
|
||||
if (!is_null($id)) {
|
||||
if (! is_null($id)) {
|
||||
$this->where('id', '=', $id);
|
||||
}
|
||||
|
||||
|
@ -1870,7 +1870,7 @@ class Builder
|
|||
protected function cleanBindings(array $bindings)
|
||||
{
|
||||
return array_values(array_filter($bindings, function ($binding) {
|
||||
return !$binding instanceof Expression;
|
||||
return ! $binding instanceof Expression;
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -1916,7 +1916,7 @@ class Builder
|
|||
*/
|
||||
public function setBindings(array $bindings, $type = 'where')
|
||||
{
|
||||
if (!array_key_exists($type, $this->bindings)) {
|
||||
if (! array_key_exists($type, $this->bindings)) {
|
||||
throw new InvalidArgumentException("Invalid binding type: {$type}.");
|
||||
}
|
||||
|
||||
|
@ -1936,7 +1936,7 @@ class Builder
|
|||
*/
|
||||
public function addBinding($value, $type = 'where')
|
||||
{
|
||||
if (!array_key_exists($type, $this->bindings)) {
|
||||
if (! array_key_exists($type, $this->bindings)) {
|
||||
throw new InvalidArgumentException("Invalid binding type: {$type}.");
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ class Grammar extends BaseGrammar
|
|||
// To compile the query, we'll spin through each component of the query and
|
||||
// see if that component exists. If it does we'll just call the compiler
|
||||
// function for the component which is responsible for making the SQL.
|
||||
if (!is_null($query->$component)) {
|
||||
if (! is_null($query->$component)) {
|
||||
$method = 'compile'.ucfirst($component);
|
||||
|
||||
$sql[$component] = $this->$method($query, $query->$component);
|
||||
|
@ -99,7 +99,7 @@ class Grammar extends BaseGrammar
|
|||
// If the query is actually performing an aggregating select, we will let that
|
||||
// compiler handle the building of the select clauses, as it will need some
|
||||
// more syntax that is best handled by that function to keep things neat.
|
||||
if (!is_null($query->aggregate)) {
|
||||
if (! is_null($query->aggregate)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ class Grammar extends BaseGrammar
|
|||
|
||||
if ($clause['where']) {
|
||||
if ($clause['operator'] === 'in' || $clause['operator'] === 'not in') {
|
||||
$second = '('.join(', ', array_fill(0, $clause['second'], '?')).')';
|
||||
$second = '('.implode(', ', array_fill(0, $clause['second'], '?')).')';
|
||||
} else {
|
||||
$second = '?';
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ class Grammar extends BaseGrammar
|
|||
// basic routine regardless of an amount of records given to us to insert.
|
||||
$table = $this->wrapTable($query->from);
|
||||
|
||||
if (!is_array(reset($values))) {
|
||||
if (! is_array(reset($values))) {
|
||||
$values = [$values];
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class PostgresGrammar extends Grammar
|
|||
*/
|
||||
protected function compileUpdateFrom(Builder $query)
|
||||
{
|
||||
if (!isset($query->joins)) {
|
||||
if (! isset($query->joins)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ class PostgresGrammar extends Grammar
|
|||
{
|
||||
$baseWhere = $this->compileWheres($query);
|
||||
|
||||
if (!isset($query->joins)) {
|
||||
if (! isset($query->joins)) {
|
||||
return $baseWhere;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ class SQLiteGrammar extends Grammar
|
|||
// basic routine regardless of an amount of records given to us to insert.
|
||||
$table = $this->wrapTable($query->from);
|
||||
|
||||
if (!is_array(reset($values))) {
|
||||
if (! is_array(reset($values))) {
|
||||
$values = [$values];
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ class SqlServerGrammar extends Grammar
|
|||
*/
|
||||
protected function compileColumns(Builder $query, $columns)
|
||||
{
|
||||
if (!is_null($query->aggregate)) {
|
||||
if (! is_null($query->aggregate)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ class SqlServerGrammar extends Grammar
|
|||
return $from.' '.$query->lock;
|
||||
}
|
||||
|
||||
if (!is_null($query->lock)) {
|
||||
if (! is_null($query->lock)) {
|
||||
return $from.' with(rowlock,'.($query->lock ? 'updlock,' : '').'holdlock)';
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ class SqlServerGrammar extends Grammar
|
|||
// An ORDER BY clause is required to make this offset query work, so if one does
|
||||
// not exist we'll just create a dummy clause to trick the database and so it
|
||||
// does not complain about the queries for not having an "order by" clause.
|
||||
if (!isset($components['orders'])) {
|
||||
if (! isset($components['orders'])) {
|
||||
$components['orders'] = 'order by (select 0)';
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class Blueprint
|
|||
{
|
||||
$this->table = $table;
|
||||
|
||||
if (!is_null($callback)) {
|
||||
if (! is_null($callback)) {
|
||||
$callback($this);
|
||||
}
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ class Blueprint
|
|||
$method = 'compile'.ucfirst($command->name);
|
||||
|
||||
if (method_exists($grammar, $method)) {
|
||||
if (!is_null($sql = $grammar->$method($this, $command, $connection))) {
|
||||
if (! is_null($sql = $grammar->$method($this, $command, $connection))) {
|
||||
$statements = array_merge($statements, (array) $sql);
|
||||
}
|
||||
}
|
||||
|
@ -113,11 +113,11 @@ class Blueprint
|
|||
*/
|
||||
protected function addImpliedCommands()
|
||||
{
|
||||
if (count($this->getAddedColumns()) > 0 && !$this->creating()) {
|
||||
if (count($this->getAddedColumns()) > 0 && ! $this->creating()) {
|
||||
array_unshift($this->commands, $this->createCommand('add'));
|
||||
}
|
||||
|
||||
if (count($this->getChangedColumns()) > 0 && !$this->creating()) {
|
||||
if (count($this->getChangedColumns()) > 0 && ! $this->creating()) {
|
||||
array_unshift($this->commands, $this->createCommand('change'));
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@ class Blueprint
|
|||
{
|
||||
return $this->unsignedInteger($column, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new auto-incrementing small integer (2-byte) column on the table.
|
||||
*
|
||||
|
@ -994,7 +994,7 @@ class Blueprint
|
|||
public function getAddedColumns()
|
||||
{
|
||||
return array_filter($this->columns, function ($column) {
|
||||
return !$column->change;
|
||||
return ! $column->change;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1006,7 +1006,7 @@ class Blueprint
|
|||
public function getChangedColumns()
|
||||
{
|
||||
return array_filter($this->columns, function ($column) {
|
||||
return !!$column->change;
|
||||
return ! ! $column->change;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ class Builder
|
|||
$tableColumns = array_map('strtolower', $this->getColumnListing($table));
|
||||
|
||||
foreach ($columns as $column) {
|
||||
if (!in_array(strtolower($column), $tableColumns)) {
|
||||
if (! in_array(strtolower($column), $tableColumns)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,11 +97,11 @@ abstract class Grammar extends BaseGrammar
|
|||
// Once we have the basic foreign key creation statement constructed we can
|
||||
// build out the syntax for what should happen on an update or delete of
|
||||
// the affected columns, which will get something like "cascade", etc.
|
||||
if (!is_null($command->onDelete)) {
|
||||
if (! is_null($command->onDelete)) {
|
||||
$sql .= " on delete {$command->onDelete}";
|
||||
}
|
||||
|
||||
if (!is_null($command->onUpdate)) {
|
||||
if (! is_null($command->onUpdate)) {
|
||||
$sql .= " on update {$command->onUpdate}";
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ abstract class Grammar extends BaseGrammar
|
|||
// Doctrine column definitions, which is necessasry because Laravel and Doctrine
|
||||
// use some different terminology for various column attributes on the tables.
|
||||
foreach ($fluent->getAttributes() as $key => $value) {
|
||||
if (!is_null($option = $this->mapFluentOptionToDoctrine($key))) {
|
||||
if (! is_null($option = $this->mapFluentOptionToDoctrine($key))) {
|
||||
if (method_exists($column, $method = 'set'.ucfirst($option))) {
|
||||
$column->{$method}($this->mapFluentValueToDoctrine($option, $value));
|
||||
}
|
||||
|
@ -446,6 +446,6 @@ abstract class Grammar extends BaseGrammar
|
|||
*/
|
||||
protected function mapFluentValueToDoctrine($option, $value)
|
||||
{
|
||||
return $option == 'notnull' ? !$value : $value;
|
||||
return $option == 'notnull' ? ! $value : $value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,13 +80,13 @@ class MySqlGrammar extends Grammar
|
|||
{
|
||||
if (isset($blueprint->charset)) {
|
||||
$sql .= ' default character set '.$blueprint->charset;
|
||||
} elseif (!is_null($charset = $connection->getConfig('charset'))) {
|
||||
} elseif (! is_null($charset = $connection->getConfig('charset'))) {
|
||||
$sql .= ' default character set '.$charset;
|
||||
}
|
||||
|
||||
if (isset($blueprint->collation)) {
|
||||
$sql .= ' collate '.$blueprint->collation;
|
||||
} elseif (!is_null($collation = $connection->getConfig('collation'))) {
|
||||
} elseif (! is_null($collation = $connection->getConfig('collation'))) {
|
||||
$sql .= ' collate '.$collation;
|
||||
}
|
||||
|
||||
|
@ -526,7 +526,7 @@ class MySqlGrammar extends Grammar
|
|||
*/
|
||||
protected function typeTimestamp(Fluent $column)
|
||||
{
|
||||
if (!$column->nullable && $column->default === null) {
|
||||
if (! $column->nullable && $column->default === null) {
|
||||
return 'timestamp default 0';
|
||||
}
|
||||
|
||||
|
@ -541,7 +541,7 @@ class MySqlGrammar extends Grammar
|
|||
*/
|
||||
protected function typeTimestampTz(Fluent $column)
|
||||
{
|
||||
if (!$column->nullable && $column->default === null) {
|
||||
if (! $column->nullable && $column->default === null) {
|
||||
return 'timestamp default 0';
|
||||
}
|
||||
|
||||
|
@ -582,7 +582,7 @@ class MySqlGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyCharset(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->charset)) {
|
||||
if (! is_null($column->charset)) {
|
||||
return ' character set '.$column->charset;
|
||||
}
|
||||
}
|
||||
|
@ -596,7 +596,7 @@ class MySqlGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyCollate(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->collation)) {
|
||||
if (! is_null($column->collation)) {
|
||||
return ' collate '.$column->collation;
|
||||
}
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ class MySqlGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyDefault(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->default)) {
|
||||
if (! is_null($column->default)) {
|
||||
return ' default '.$this->getDefaultValue($column->default);
|
||||
}
|
||||
}
|
||||
|
@ -650,7 +650,7 @@ class MySqlGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyFirst(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->first)) {
|
||||
if (! is_null($column->first)) {
|
||||
return ' first';
|
||||
}
|
||||
}
|
||||
|
@ -664,7 +664,7 @@ class MySqlGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyAfter(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->after)) {
|
||||
if (! is_null($column->after)) {
|
||||
return ' after '.$this->wrap($column->after);
|
||||
}
|
||||
}
|
||||
|
@ -678,7 +678,7 @@ class MySqlGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyComment(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->comment)) {
|
||||
if (! is_null($column->comment)) {
|
||||
return ' comment "'.$column->comment.'"';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -522,7 +522,7 @@ class PostgresGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyDefault(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->default)) {
|
||||
if (! is_null($column->default)) {
|
||||
return ' default '.$this->getDefaultValue($column->default);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,11 +84,11 @@ class SQLiteGrammar extends Grammar
|
|||
foreach ($foreigns as $foreign) {
|
||||
$sql .= $this->getForeignKey($foreign);
|
||||
|
||||
if (!is_null($foreign->onDelete)) {
|
||||
if (! is_null($foreign->onDelete)) {
|
||||
$sql .= " on delete {$foreign->onDelete}";
|
||||
}
|
||||
|
||||
if (!is_null($foreign->onUpdate)) {
|
||||
if (! is_null($foreign->onUpdate)) {
|
||||
$sql .= " on update {$foreign->onUpdate}";
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ class SQLiteGrammar extends Grammar
|
|||
{
|
||||
$primary = $this->getCommandByName($blueprint, 'primary');
|
||||
|
||||
if (!is_null($primary)) {
|
||||
if (! is_null($primary)) {
|
||||
$columns = $this->columnize($primary->columns);
|
||||
|
||||
return ", primary key ({$columns})";
|
||||
|
@ -583,7 +583,7 @@ class SQLiteGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyDefault(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->default)) {
|
||||
if (! is_null($column->default)) {
|
||||
return ' default '.$this->getDefaultValue($column->default);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -530,7 +530,7 @@ class SqlServerGrammar extends Grammar
|
|||
*/
|
||||
protected function modifyDefault(Blueprint $blueprint, Fluent $column)
|
||||
{
|
||||
if (!is_null($column->default)) {
|
||||
if (! is_null($column->default)) {
|
||||
return ' default '.$this->getDefaultValue($column->default);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ abstract class BaseEncrypter
|
|||
// If the payload is not valid JSON or does not have the proper keys set we will
|
||||
// assume it is invalid and bail out of the routine since we will not be able
|
||||
// to decrypt the given value. We'll also check the MAC for this encryption.
|
||||
if (!$payload || $this->invalidPayload($payload)) {
|
||||
if (! $payload || $this->invalidPayload($payload)) {
|
||||
throw new DecryptException('The payload is invalid.');
|
||||
}
|
||||
|
||||
if (!$this->validMac($payload)) {
|
||||
if (! $this->validMac($payload)) {
|
||||
throw new DecryptException('The MAC is invalid.');
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ abstract class BaseEncrypter
|
|||
*/
|
||||
protected function invalidPayload($data)
|
||||
{
|
||||
return !is_array($data) || !isset($data['iv']) || !isset($data['value']) || !isset($data['mac']);
|
||||
return ! is_array($data) || ! isset($data['iv']) || ! isset($data['value']) || ! isset($data['mac']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ class CallQueuedHandler
|
|||
[$handler, $data['method']], unserialize($data['data'])
|
||||
);
|
||||
|
||||
if (!$job->isDeletedOrReleased()) {
|
||||
if (! $job->isDeletedOrReleased()) {
|
||||
$job->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ class Dispatcher implements DispatcherContract
|
|||
// If an array is not given to us as the payload, we will turn it into one so
|
||||
// we can easily use call_user_func_array on the listeners, passing in the
|
||||
// payload to each of them so that they receive each of these arguments.
|
||||
if (!is_array($payload)) {
|
||||
if (! is_array($payload)) {
|
||||
$payload = [$payload];
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ class Dispatcher implements DispatcherContract
|
|||
// If a response is returned from the listener and event halting is enabled
|
||||
// we will just return this response, and not call the rest of the event
|
||||
// listeners. Otherwise we will add the response on the response list.
|
||||
if (!is_null($response) && $halt) {
|
||||
if (! is_null($response) && $halt) {
|
||||
array_pop($this->firing);
|
||||
|
||||
return $response;
|
||||
|
@ -271,7 +271,7 @@ class Dispatcher implements DispatcherContract
|
|||
{
|
||||
$wildcards = $this->getWildcardListeners($eventName);
|
||||
|
||||
if (!isset($this->sorted[$eventName])) {
|
||||
if (! isset($this->sorted[$eventName])) {
|
||||
$this->sortListeners($eventName);
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,7 @@ class Filesystem
|
|||
|
||||
foreach ($paths as $path) {
|
||||
try {
|
||||
if (!@unlink($path)) {
|
||||
if (! @unlink($path)) {
|
||||
$success = false;
|
||||
}
|
||||
} catch (ErrorException $e) {
|
||||
|
@ -347,7 +347,7 @@ class Filesystem
|
|||
*/
|
||||
public function copyDirectory($directory, $destination, $options = null)
|
||||
{
|
||||
if (!$this->isDirectory($directory)) {
|
||||
if (! $this->isDirectory($directory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ class Filesystem
|
|||
// If the destination directory does not actually exist, we will go ahead and
|
||||
// create it recursively, which just gets the destination prepared to copy
|
||||
// the files over. Once we make the directory we'll proceed the copying.
|
||||
if (!$this->isDirectory($destination)) {
|
||||
if (! $this->isDirectory($destination)) {
|
||||
$this->makeDirectory($destination, 0777, true);
|
||||
}
|
||||
|
||||
|
@ -371,7 +371,7 @@ class Filesystem
|
|||
if ($item->isDir()) {
|
||||
$path = $item->getPathname();
|
||||
|
||||
if (!$this->copyDirectory($path, $target, $options)) {
|
||||
if (! $this->copyDirectory($path, $target, $options)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -380,7 +380,7 @@ class Filesystem
|
|||
// location and keep looping. If for some reason the copy fails we'll bail out
|
||||
// and return false, so the developer is aware that the copy process failed.
|
||||
else {
|
||||
if (!$this->copy($item->getPathname(), $target)) {
|
||||
if (! $this->copy($item->getPathname(), $target)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,7 @@ class Filesystem
|
|||
*/
|
||||
public function deleteDirectory($directory, $preserve = false)
|
||||
{
|
||||
if (!$this->isDirectory($directory)) {
|
||||
if (! $this->isDirectory($directory)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -410,7 +410,7 @@ class Filesystem
|
|||
// If the item is a directory, we can just recurse into the function and
|
||||
// delete that sub-directory otherwise we'll just delete the file and
|
||||
// keep iterating through each file until the directory is cleaned.
|
||||
if ($item->isDir() && !$item->isLink()) {
|
||||
if ($item->isDir() && ! $item->isLink()) {
|
||||
$this->deleteDirectory($item->getPathname());
|
||||
}
|
||||
|
||||
|
@ -422,7 +422,7 @@ class Filesystem
|
|||
}
|
||||
}
|
||||
|
||||
if (!$preserve) {
|
||||
if (! $preserve) {
|
||||
@rmdir($directory);
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class AliasLoader
|
|||
*/
|
||||
public function register()
|
||||
{
|
||||
if (!$this->registered) {
|
||||
if (! $this->registered) {
|
||||
$this->prependToLoaderStack();
|
||||
|
||||
$this->registered = true;
|
||||
|
|
|
@ -517,7 +517,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
|
|||
*/
|
||||
public function register($provider, $options = [], $force = false)
|
||||
{
|
||||
if ($registered = $this->getProvider($provider) && !$force) {
|
||||
if ($registered = $this->getProvider($provider) && ! $force) {
|
||||
return $registered;
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
|
|||
*/
|
||||
public function loadDeferredProvider($service)
|
||||
{
|
||||
if (!isset($this->deferredServices[$service])) {
|
||||
if (! isset($this->deferredServices[$service])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -624,7 +624,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
|
|||
// If the service provider has not already been loaded and registered we can
|
||||
// register it with the application and remove the service from this list
|
||||
// of deferred services, since it will already be loaded on subsequent.
|
||||
if (!isset($this->loadedProviders[$provider])) {
|
||||
if (! isset($this->loadedProviders[$provider])) {
|
||||
$this->registerDeferredProvider($provider, $service);
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +647,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
|
|||
|
||||
$this->register($instance = new $provider($this));
|
||||
|
||||
if (!$this->booted) {
|
||||
if (! $this->booted) {
|
||||
$this->booting(function () use ($instance) {
|
||||
$this->bootProvider($instance);
|
||||
});
|
||||
|
@ -980,7 +980,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
|
|||
*/
|
||||
public function hasMonologConfigurator()
|
||||
{
|
||||
return !is_null($this->monologConfigurator);
|
||||
return ! is_null($this->monologConfigurator);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1102,7 +1102,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
|
|||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
if (!is_null($this->namespace)) {
|
||||
if (! is_null($this->namespace)) {
|
||||
return $this->namespace;
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace Illuminate\Foundation\Auth;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\Support\Facades\Cache;
|
||||
|
||||
trait AuthenticatesUsers
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ class HandleExceptions
|
|||
|
||||
register_shutdown_function([$this, 'handleShutdown']);
|
||||
|
||||
if (!$app->environment('testing')) {
|
||||
if (! $app->environment('testing')) {
|
||||
ini_set('display_errors', 'Off');
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ class HandleExceptions
|
|||
*/
|
||||
public function handleException($e)
|
||||
{
|
||||
if (!$e instanceof Exception) {
|
||||
if (! $e instanceof Exception) {
|
||||
$e = new FatalThrowableError($e);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ class HandleExceptions
|
|||
*/
|
||||
public function handleShutdown()
|
||||
{
|
||||
if (!is_null($error = error_get_last()) && $this->isFatal($error['type'])) {
|
||||
if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) {
|
||||
$this->handleException($this->fatalExceptionFromError($error, 0));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ class LoadConfiguration
|
|||
// Next we will spin through all of the configuration files in the configuration
|
||||
// directory and load each one into the repository. This will make all of the
|
||||
// options available to the developer for use in various parts of this app.
|
||||
if (!isset($loadedFromCache)) {
|
||||
if (! isset($loadedFromCache)) {
|
||||
$this->loadConfigurationFiles($app, $config);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class EventGenerateCommand extends Command
|
|||
);
|
||||
|
||||
foreach ($provider->listens() as $event => $listeners) {
|
||||
if (!Str::contains($event, '\\')) {
|
||||
if (! Str::contains($event, '\\')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ class HandlerEventCommand extends GeneratorCommand
|
|||
|
||||
$event = $this->option('event');
|
||||
|
||||
if (!Str::startsWith($event, $this->laravel->getNamespace())) {
|
||||
if (! Str::startsWith($event, $this->laravel->getNamespace())) {
|
||||
$event = $this->laravel->getNamespace().'Events\\'.$event;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,8 +46,8 @@ class IlluminateCaster
|
|||
try {
|
||||
$val = $app->$property();
|
||||
|
||||
if (!is_null($val)) {
|
||||
$results[Caster::PREFIX_VIRTUAL . $property] = $val;
|
||||
if (! is_null($val)) {
|
||||
$results[Caster::PREFIX_VIRTUAL.$property] = $val;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
//
|
||||
|
|
|
@ -202,7 +202,7 @@ class Kernel implements KernelContract
|
|||
*/
|
||||
public function bootstrap()
|
||||
{
|
||||
if (!$this->app->hasBeenBootstrapped()) {
|
||||
if (! $this->app->hasBeenBootstrapped()) {
|
||||
$this->app->bootstrapWith($this->bootstrappers());
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class ListenerMakeCommand extends GeneratorCommand
|
|||
|
||||
$event = $this->option('event');
|
||||
|
||||
if (!Str::startsWith($event, $this->laravel->getNamespace())) {
|
||||
if (! Str::startsWith($event, $this->laravel->getNamespace())) {
|
||||
$event = $this->laravel->getNamespace().'Events\\'.$event;
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ class OptimizeCommand extends Command
|
|||
$this->composer->dumpOptimized();
|
||||
}
|
||||
|
||||
if ($this->option('force') || !$this->laravel['config']['app.debug']) {
|
||||
if ($this->option('force') || ! $this->laravel['config']['app.debug']) {
|
||||
$this->info('Compiling common classes');
|
||||
$this->compileClasses();
|
||||
} else {
|
||||
|
|
|
@ -147,7 +147,7 @@ class RouteListCommand extends Command
|
|||
|
||||
$actionName = $route->getActionName();
|
||||
|
||||
if (!empty($actionName) && $actionName !== 'Closure') {
|
||||
if (! empty($actionName) && $actionName !== 'Closure') {
|
||||
$middlewares = array_merge($middlewares, $this->getControllerMiddleware($actionName));
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ class RouteListCommand extends Command
|
|||
$results = [];
|
||||
|
||||
foreach ($controller->getMiddleware() as $name => $options) {
|
||||
if (!$this->methodExcludedByOptions($method, $options)) {
|
||||
if (! $this->methodExcludedByOptions($method, $options)) {
|
||||
$results[] = Arr::get($middleware, $name, $name);
|
||||
}
|
||||
}
|
||||
|
@ -202,8 +202,8 @@ class RouteListCommand extends Command
|
|||
*/
|
||||
protected 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']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -250,9 +250,9 @@ class RouteListCommand extends Command
|
|||
*/
|
||||
protected function filterRoute(array $route)
|
||||
{
|
||||
if (($this->option('name') && !Str::contains($route['name'], $this->option('name'))) ||
|
||||
$this->option('path') && !Str::contains($route['uri'], $this->option('path')) ||
|
||||
$this->option('method') && !Str::contains($route['method'], $this->option('method'))) {
|
||||
if (($this->option('name') && ! Str::contains($route['name'], $this->option('name'))) ||
|
||||
$this->option('path') && ! Str::contains($route['uri'], $this->option('path')) ||
|
||||
$this->option('method') && ! Str::contains($route['method'], $this->option('method'))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class VendorPublishCommand extends Command
|
|||
*/
|
||||
protected function publishFile($from, $to)
|
||||
{
|
||||
if ($this->files->exists($to) && !$this->option('force')) {
|
||||
if ($this->files->exists($to) && ! $this->option('force')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ class VendorPublishCommand extends Command
|
|||
]);
|
||||
|
||||
foreach ($manager->listContents('from://', true) as $file) {
|
||||
if ($file['type'] === 'file' && (!$manager->has('to://'.$file['path']) || $this->option('force'))) {
|
||||
if ($file['type'] === 'file' && (! $manager->has('to://'.$file['path']) || $this->option('force'))) {
|
||||
$manager->put('to://'.$file['path'], $manager->read('from://'.$file['path']));
|
||||
}
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ class VendorPublishCommand extends Command
|
|||
*/
|
||||
protected function createParentDirectory($directory)
|
||||
{
|
||||
if (!$this->files->isDirectory($directory)) {
|
||||
if (! $this->files->isDirectory($directory)) {
|
||||
$this->files->makeDirectory($directory, 0755, true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class EnvironmentDetector
|
|||
// First we will check if an environment argument was passed via console arguments
|
||||
// and if it was that automatically overrides as the environment. Otherwise, we
|
||||
// will check the environment as a "web" request like a typical HTTP request.
|
||||
if (!is_null($value = $this->getEnvironmentArgument($args))) {
|
||||
if (! is_null($value = $this->getEnvironmentArgument($args))) {
|
||||
return head(array_slice(explode('=', $value), 1));
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ class Handler implements ExceptionHandlerContract
|
|||
*/
|
||||
public function shouldReport(Exception $e)
|
||||
{
|
||||
return !$this->shouldntReport($e);
|
||||
return ! $this->shouldntReport($e);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace Illuminate\Foundation\Http;
|
|||
|
||||
use Exception;
|
||||
use Throwable;
|
||||
use RuntimeException;
|
||||
use Illuminate\Routing\Router;
|
||||
use Illuminate\Pipeline\Pipeline;
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
@ -219,7 +218,7 @@ class Kernel implements KernelContract
|
|||
*/
|
||||
public function bootstrap()
|
||||
{
|
||||
if (!$this->app->hasBeenBootstrapped()) {
|
||||
if (! $this->app->hasBeenBootstrapped()) {
|
||||
$this->app->bootstrapWith($this->bootstrappers());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ class VerifyCsrfToken
|
|||
{
|
||||
$token = $request->input('_token') ?: $request->header('X-CSRF-TOKEN');
|
||||
|
||||
if (!$token && $header = $request->header('X-XSRF-TOKEN')) {
|
||||
if (! $token && $header = $request->header('X-XSRF-TOKEN')) {
|
||||
$token = $this->encrypter->decrypt($header);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ trait ApplicationTrait
|
|||
*/
|
||||
protected function startSession()
|
||||
{
|
||||
if (!$this->app['session']->isStarted()) {
|
||||
if (! $this->app['session']->isStarted()) {
|
||||
$this->app['session']->start();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ trait AssertionsTrait
|
|||
return $this->assertViewHasAll($key);
|
||||
}
|
||||
|
||||
if (!isset($this->response->original) || !$this->response->original instanceof View) {
|
||||
if (! isset($this->response->original) || ! $this->response->original instanceof View) {
|
||||
return PHPUnit::assertTrue(false, 'The response was not a view.');
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ trait AssertionsTrait
|
|||
*/
|
||||
public function assertViewMissing($key)
|
||||
{
|
||||
if (!isset($this->response->original) || !$this->response->original instanceof View) {
|
||||
if (! isset($this->response->original) || ! $this->response->original instanceof View) {
|
||||
return PHPUnit::assertTrue(false, 'The response was not a view.');
|
||||
}
|
||||
|
||||
|
|
|
@ -296,7 +296,7 @@ trait CrawlerTrait
|
|||
{
|
||||
$this->seeJson();
|
||||
|
||||
if (!is_null($data)) {
|
||||
if (! is_null($data)) {
|
||||
return $this->seeJson($data);
|
||||
}
|
||||
}
|
||||
|
@ -448,7 +448,7 @@ trait CrawlerTrait
|
|||
|
||||
$this->assertTrue($headers->has($headerName), "Header [{$headerName}] not present on response.");
|
||||
|
||||
if (!is_null($value)) {
|
||||
if (! is_null($value)) {
|
||||
$this->assertEquals(
|
||||
$headers->get($headerName), $value,
|
||||
"Header [{$headerName}] was found, but value [{$headers->get($headerName)}] does not match [{$value}]."
|
||||
|
@ -480,7 +480,7 @@ trait CrawlerTrait
|
|||
|
||||
$this->assertTrue($exist, "Cookie [{$cookieName}] not present on response.");
|
||||
|
||||
if (!is_null($value)) {
|
||||
if (! is_null($value)) {
|
||||
$this->assertEquals(
|
||||
$cookie->getValue(), $value,
|
||||
"Cookie [{$cookieName}] was found, but value [{$cookie->getValue()}] does not match [{$value}]."
|
||||
|
@ -500,10 +500,10 @@ trait CrawlerTrait
|
|||
{
|
||||
$link = $this->crawler->selectLink($name);
|
||||
|
||||
if (!count($link)) {
|
||||
if (! count($link)) {
|
||||
$link = $this->filterByNameOrId($name, 'a');
|
||||
|
||||
if (!count($link)) {
|
||||
if (! count($link)) {
|
||||
throw new InvalidArgumentException(
|
||||
"Could not find a link with a body, name, or ID attribute of [{$name}]."
|
||||
);
|
||||
|
@ -599,7 +599,7 @@ trait CrawlerTrait
|
|||
*/
|
||||
protected function fillForm($buttonText, $inputs = [])
|
||||
{
|
||||
if (!is_string($buttonText)) {
|
||||
if (! is_string($buttonText)) {
|
||||
$inputs = $buttonText;
|
||||
|
||||
$buttonText = null;
|
||||
|
@ -657,7 +657,7 @@ trait CrawlerTrait
|
|||
{
|
||||
$crawler = $this->filterByNameOrId($filter);
|
||||
|
||||
if (!count($crawler)) {
|
||||
if (! count($crawler)) {
|
||||
throw new InvalidArgumentException(
|
||||
"Nothing matched the filter [{$filter}] CSS query provided for [{$this->currentUri}]."
|
||||
);
|
||||
|
@ -779,7 +779,7 @@ trait CrawlerTrait
|
|||
$uri = substr($uri, 1);
|
||||
}
|
||||
|
||||
if (!Str::startsWith($uri, 'http')) {
|
||||
if (! Str::startsWith($uri, 'http')) {
|
||||
$uri = $this->baseUrl.'/'.$uri;
|
||||
}
|
||||
|
||||
|
@ -801,7 +801,7 @@ trait CrawlerTrait
|
|||
$name = strtr(strtoupper($name), '-', '_');
|
||||
|
||||
if (! starts_with($name, $prefix) && $name != 'CONTENT_TYPE') {
|
||||
$name = $prefix . $name;
|
||||
$name = $prefix.$name;
|
||||
}
|
||||
|
||||
$server[$name] = $value;
|
||||
|
|
|
@ -32,7 +32,7 @@ abstract class TestCase extends PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function setUp()
|
||||
{
|
||||
if (!$this->app) {
|
||||
if (! $this->app) {
|
||||
$this->refreshApplication();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
use Illuminate\Support\Str;
|
||||
use Illuminate\Container\Container;
|
||||
|
||||
if (!function_exists('abort')) {
|
||||
if (! function_exists('abort')) {
|
||||
/**
|
||||
* Throw an HttpException with the given data.
|
||||
*
|
||||
|
@ -21,7 +21,7 @@ if (!function_exists('abort')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('action')) {
|
||||
if (! function_exists('action')) {
|
||||
/**
|
||||
* Generate a URL to a controller action.
|
||||
*
|
||||
|
@ -36,7 +36,7 @@ if (!function_exists('action')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('app')) {
|
||||
if (! function_exists('app')) {
|
||||
/**
|
||||
* Get the available container instance.
|
||||
*
|
||||
|
@ -54,7 +54,7 @@ if (!function_exists('app')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('app_path')) {
|
||||
if (! function_exists('app_path')) {
|
||||
/**
|
||||
* Get the path to the application folder.
|
||||
*
|
||||
|
@ -67,7 +67,7 @@ if (!function_exists('app_path')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('asset')) {
|
||||
if (! function_exists('asset')) {
|
||||
/**
|
||||
* Generate an asset path for the application.
|
||||
*
|
||||
|
@ -81,7 +81,7 @@ if (!function_exists('asset')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('auth')) {
|
||||
if (! function_exists('auth')) {
|
||||
/**
|
||||
* Get the available auth instance.
|
||||
*
|
||||
|
@ -93,7 +93,7 @@ if (!function_exists('auth')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('base_path')) {
|
||||
if (! function_exists('base_path')) {
|
||||
/**
|
||||
* Get the path to the base of the install.
|
||||
*
|
||||
|
@ -106,7 +106,7 @@ if (!function_exists('base_path')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('back')) {
|
||||
if (! function_exists('back')) {
|
||||
/**
|
||||
* Create a new redirect response to the previous location.
|
||||
*
|
||||
|
@ -120,7 +120,7 @@ if (!function_exists('back')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('bcrypt')) {
|
||||
if (! function_exists('bcrypt')) {
|
||||
/**
|
||||
* Hash the given value.
|
||||
*
|
||||
|
@ -134,7 +134,7 @@ if (!function_exists('bcrypt')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('config')) {
|
||||
if (! function_exists('config')) {
|
||||
/**
|
||||
* Get / set the specified configuration value.
|
||||
*
|
||||
|
@ -158,7 +158,7 @@ if (!function_exists('config')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('config_path')) {
|
||||
if (! function_exists('config_path')) {
|
||||
/**
|
||||
* Get the configuration path.
|
||||
*
|
||||
|
@ -171,7 +171,7 @@ if (!function_exists('config_path')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('cookie')) {
|
||||
if (! function_exists('cookie')) {
|
||||
/**
|
||||
* Create a new cookie instance.
|
||||
*
|
||||
|
@ -196,7 +196,7 @@ if (!function_exists('cookie')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('csrf_field')) {
|
||||
if (! function_exists('csrf_field')) {
|
||||
/**
|
||||
* Generate a CSRF token form field.
|
||||
*
|
||||
|
@ -208,7 +208,7 @@ if (!function_exists('csrf_field')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('csrf_token')) {
|
||||
if (! function_exists('csrf_token')) {
|
||||
/**
|
||||
* Get the CSRF token value.
|
||||
*
|
||||
|
@ -228,7 +228,7 @@ if (!function_exists('csrf_token')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('database_path')) {
|
||||
if (! function_exists('database_path')) {
|
||||
/**
|
||||
* Get the database path.
|
||||
*
|
||||
|
@ -241,7 +241,7 @@ if (!function_exists('database_path')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('delete')) {
|
||||
if (! function_exists('delete')) {
|
||||
/**
|
||||
* Register a new DELETE route with the router.
|
||||
*
|
||||
|
@ -255,7 +255,7 @@ if (!function_exists('delete')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('factory')) {
|
||||
if (! function_exists('factory')) {
|
||||
/**
|
||||
* Create a model factory builder for a given class, name, and amount.
|
||||
*
|
||||
|
@ -278,7 +278,7 @@ if (!function_exists('factory')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('get')) {
|
||||
if (! function_exists('get')) {
|
||||
/**
|
||||
* Register a new GET route with the router.
|
||||
*
|
||||
|
@ -292,7 +292,7 @@ if (!function_exists('get')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('info')) {
|
||||
if (! function_exists('info')) {
|
||||
/**
|
||||
* Write some information to the log.
|
||||
*
|
||||
|
@ -306,7 +306,7 @@ if (!function_exists('info')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('logger')) {
|
||||
if (! function_exists('logger')) {
|
||||
/**
|
||||
* Log a debug message to the logs.
|
||||
*
|
||||
|
@ -324,7 +324,7 @@ if (!function_exists('logger')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('method_field')) {
|
||||
if (! function_exists('method_field')) {
|
||||
/**
|
||||
* Generate a form field to spoof the HTTP verb used by forms.
|
||||
*
|
||||
|
@ -337,7 +337,7 @@ if (!function_exists('method_field')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('old')) {
|
||||
if (! function_exists('old')) {
|
||||
/**
|
||||
* Retrieve an old input item.
|
||||
*
|
||||
|
@ -351,7 +351,7 @@ if (!function_exists('old')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('patch')) {
|
||||
if (! function_exists('patch')) {
|
||||
/**
|
||||
* Register a new PATCH route with the router.
|
||||
*
|
||||
|
@ -365,7 +365,7 @@ if (!function_exists('patch')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('post')) {
|
||||
if (! function_exists('post')) {
|
||||
/**
|
||||
* Register a new POST route with the router.
|
||||
*
|
||||
|
@ -379,7 +379,7 @@ if (!function_exists('post')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('put')) {
|
||||
if (! function_exists('put')) {
|
||||
/**
|
||||
* Register a new PUT route with the router.
|
||||
*
|
||||
|
@ -393,7 +393,7 @@ if (!function_exists('put')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('public_path')) {
|
||||
if (! function_exists('public_path')) {
|
||||
/**
|
||||
* Get the path to the public folder.
|
||||
*
|
||||
|
@ -406,7 +406,7 @@ if (!function_exists('public_path')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('redirect')) {
|
||||
if (! function_exists('redirect')) {
|
||||
/**
|
||||
* Get an instance of the redirector.
|
||||
*
|
||||
|
@ -426,7 +426,7 @@ if (!function_exists('redirect')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('resource')) {
|
||||
if (! function_exists('resource')) {
|
||||
/**
|
||||
* Route a resource to a controller.
|
||||
*
|
||||
|
@ -441,7 +441,7 @@ if (!function_exists('resource')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('response')) {
|
||||
if (! function_exists('response')) {
|
||||
/**
|
||||
* Return a new response from the application.
|
||||
*
|
||||
|
@ -462,7 +462,7 @@ if (!function_exists('response')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('route')) {
|
||||
if (! function_exists('route')) {
|
||||
/**
|
||||
* Generate a URL to a named route.
|
||||
*
|
||||
|
@ -478,7 +478,7 @@ if (!function_exists('route')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('secure_asset')) {
|
||||
if (! function_exists('secure_asset')) {
|
||||
/**
|
||||
* Generate an asset path for the application.
|
||||
*
|
||||
|
@ -491,7 +491,7 @@ if (!function_exists('secure_asset')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('secure_url')) {
|
||||
if (! function_exists('secure_url')) {
|
||||
/**
|
||||
* Generate a HTTPS url for the application.
|
||||
*
|
||||
|
@ -505,7 +505,7 @@ if (!function_exists('secure_url')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('session')) {
|
||||
if (! function_exists('session')) {
|
||||
/**
|
||||
* Get / set the specified session value.
|
||||
*
|
||||
|
@ -529,7 +529,7 @@ if (!function_exists('session')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('storage_path')) {
|
||||
if (! function_exists('storage_path')) {
|
||||
/**
|
||||
* Get the path to the storage folder.
|
||||
*
|
||||
|
@ -542,7 +542,7 @@ if (!function_exists('storage_path')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('trans')) {
|
||||
if (! function_exists('trans')) {
|
||||
/**
|
||||
* Translate the given message.
|
||||
*
|
||||
|
@ -562,7 +562,7 @@ if (!function_exists('trans')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('trans_choice')) {
|
||||
if (! function_exists('trans_choice')) {
|
||||
/**
|
||||
* Translates the given message based on a count.
|
||||
*
|
||||
|
@ -579,7 +579,7 @@ if (!function_exists('trans_choice')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('url')) {
|
||||
if (! function_exists('url')) {
|
||||
/**
|
||||
* Generate a url for the application.
|
||||
*
|
||||
|
@ -594,7 +594,7 @@ if (!function_exists('url')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('view')) {
|
||||
if (! function_exists('view')) {
|
||||
/**
|
||||
* Get the evaluated view contents for the given view.
|
||||
*
|
||||
|
@ -615,7 +615,7 @@ if (!function_exists('view')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('env')) {
|
||||
if (! function_exists('env')) {
|
||||
/**
|
||||
* Gets the value of an environment variable. Supports boolean, empty and null.
|
||||
*
|
||||
|
@ -657,7 +657,7 @@ if (!function_exists('env')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('event')) {
|
||||
if (! function_exists('event')) {
|
||||
/**
|
||||
* Fire an event and call the listeners.
|
||||
*
|
||||
|
@ -672,7 +672,7 @@ if (!function_exists('event')) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!function_exists('elixir')) {
|
||||
if (! function_exists('elixir')) {
|
||||
/**
|
||||
* Get the path to a versioned Elixir file.
|
||||
*
|
||||
|
|
|
@ -77,7 +77,7 @@ class RedirectResponse extends BaseRedirectResponse
|
|||
$value = array_filter($value, $callback);
|
||||
}
|
||||
|
||||
return !$value instanceof UploadedFile;
|
||||
return ! $value instanceof UploadedFile;
|
||||
}));
|
||||
|
||||
return $this;
|
||||
|
|
|
@ -224,7 +224,7 @@ class Request extends SymfonyRequest implements ArrayAccess
|
|||
$input = $this->all();
|
||||
|
||||
foreach ($keys as $value) {
|
||||
if (!array_key_exists($value, $input)) {
|
||||
if (! array_key_exists($value, $input)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ class Request extends SymfonyRequest implements ArrayAccess
|
|||
|
||||
$boolOrArray = is_bool($value) || is_array($value);
|
||||
|
||||
return !$boolOrArray && trim((string) $value) === '';
|
||||
return ! $boolOrArray && trim((string) $value) === '';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -348,7 +348,7 @@ class Request extends SymfonyRequest implements ArrayAccess
|
|||
*/
|
||||
public function hasCookie($key)
|
||||
{
|
||||
return !is_null($this->cookie($key));
|
||||
return ! is_null($this->cookie($key));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -383,7 +383,7 @@ class Request extends SymfonyRequest implements ArrayAccess
|
|||
*/
|
||||
public function hasFile($key)
|
||||
{
|
||||
if (!is_array($files = $this->file($key))) {
|
||||
if (! is_array($files = $this->file($key))) {
|
||||
$files = [$files];
|
||||
}
|
||||
|
||||
|
@ -452,7 +452,7 @@ class Request extends SymfonyRequest implements ArrayAccess
|
|||
*/
|
||||
public function flash($filter = null, $keys = [])
|
||||
{
|
||||
$flash = (!is_null($filter)) ? $this->$filter($keys) : $this->input();
|
||||
$flash = (! is_null($filter)) ? $this->$filter($keys) : $this->input();
|
||||
|
||||
$this->session()->flashInput($flash);
|
||||
}
|
||||
|
@ -541,7 +541,7 @@ class Request extends SymfonyRequest implements ArrayAccess
|
|||
*/
|
||||
public function json($key = null, $default = null)
|
||||
{
|
||||
if (!isset($this->json)) {
|
||||
if (! isset($this->json)) {
|
||||
$this->json = new ParameterBag((array) json_decode($this->getContent(), true));
|
||||
}
|
||||
|
||||
|
@ -659,7 +659,7 @@ class Request extends SymfonyRequest implements ArrayAccess
|
|||
foreach ($contentTypes as $contentType) {
|
||||
$type = $contentType;
|
||||
|
||||
if (!is_null($mimeType = $this->getMimeType($contentType))) {
|
||||
if (! is_null($mimeType = $this->getMimeType($contentType))) {
|
||||
$type = $mimeType;
|
||||
}
|
||||
|
||||
|
@ -752,7 +752,7 @@ class Request extends SymfonyRequest implements ArrayAccess
|
|||
*/
|
||||
public function session()
|
||||
{
|
||||
if (!$this->hasSession()) {
|
||||
if (! $this->hasSession()) {
|
||||
throw new RuntimeException('Session store not set on request.');
|
||||
}
|
||||
|
||||
|
|
|
@ -271,7 +271,7 @@ class Writer implements LogContract, PsrLoggerInterface
|
|||
*/
|
||||
public function listen(Closure $callback)
|
||||
{
|
||||
if (!isset($this->dispatcher)) {
|
||||
if (! isset($this->dispatcher)) {
|
||||
throw new RuntimeException('Events dispatcher has not been set.');
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ class Mailer implements MailerContract, MailQueueContract
|
|||
*/
|
||||
protected function buildQueueCallable($callback)
|
||||
{
|
||||
if (!$callback instanceof Closure) {
|
||||
if (! $callback instanceof Closure) {
|
||||
return $callback;
|
||||
}
|
||||
|
||||
|
@ -378,7 +378,7 @@ class Mailer implements MailerContract, MailQueueContract
|
|||
$this->events->fire('mailer.sending', [$message]);
|
||||
}
|
||||
|
||||
if (!$this->pretending) {
|
||||
if (! $this->pretending) {
|
||||
return $this->swift->send($message, $this->failedRecipients);
|
||||
} elseif (isset($this->logger)) {
|
||||
$this->logMessage($message);
|
||||
|
@ -432,7 +432,7 @@ class Mailer implements MailerContract, MailQueueContract
|
|||
// If a global from address has been specified we will set it on every message
|
||||
// instances so the developer does not have to repeat themselves every time
|
||||
// they create a new message. We will just go ahead and push the address.
|
||||
if (!empty($this->from['address'])) {
|
||||
if (! empty($this->from['address'])) {
|
||||
$message->from($this->from['address'], $this->from['name']);
|
||||
}
|
||||
|
||||
|
|
|
@ -275,7 +275,7 @@ abstract class AbstractPaginator
|
|||
*/
|
||||
public function hasPages()
|
||||
{
|
||||
return !($this->currentPage() == 1 && !$this->hasMorePages());
|
||||
return ! ($this->currentPage() == 1 && ! $this->hasMorePages());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -37,7 +37,7 @@ trait BootstrapThreeNextPreviousButtonRendererTrait
|
|||
// If the current page is greater than or equal to the last page, it means we
|
||||
// can't go any further into the pages, as we're already on this last page
|
||||
// that is available, so we will make it the "next" link style disabled.
|
||||
if (!$this->paginator->hasMorePages()) {
|
||||
if (! $this->paginator->hasMorePages()) {
|
||||
return $this->getDisabledTextWrapper($text);
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ class UrlWindow
|
|||
{
|
||||
$window = $onEachSide * 2;
|
||||
|
||||
if (!$this->hasPages()) {
|
||||
if (! $this->hasPages()) {
|
||||
return [
|
||||
'first' => null,
|
||||
'slider' => null,
|
||||
|
|
|
@ -42,7 +42,7 @@ class CallQueuedHandler
|
|||
$this->setJobInstanceIfNecessary($job, $handler);
|
||||
});
|
||||
|
||||
if (!$job->isDeletedOrReleased()) {
|
||||
if (! $job->isDeletedOrReleased()) {
|
||||
$job->delete();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ class RetryCommand extends Command
|
|||
{
|
||||
$failed = $this->laravel['queue.failer']->find($this->argument('id'));
|
||||
|
||||
if (!is_null($failed)) {
|
||||
if (! is_null($failed)) {
|
||||
$failed = (object) $failed;
|
||||
|
||||
$failed->payload = $this->resetAttempts($failed->payload);
|
||||
|
|
|
@ -47,7 +47,7 @@ class SubscribeCommand extends Command
|
|||
{
|
||||
$iron = $this->laravel['queue']->connection();
|
||||
|
||||
if (!$iron instanceof IronQueue) {
|
||||
if (! $iron instanceof IronQueue) {
|
||||
throw new RuntimeException('Iron.io based queue must be default.');
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ class SubscribeCommand extends Command
|
|||
|
||||
$url = $this->argument('url');
|
||||
|
||||
if (!Str::startsWith($url, ['http://', 'https://'])) {
|
||||
if (! Str::startsWith($url, ['http://', 'https://'])) {
|
||||
$url = $this->laravel['url']->to($url);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ class WorkCommand extends Command
|
|||
*/
|
||||
public function fire()
|
||||
{
|
||||
if ($this->downForMaintenance() && !$this->option('daemon')) {
|
||||
if ($this->downForMaintenance() && ! $this->option('daemon')) {
|
||||
return $this->worker->sleep($this->option('sleep'));
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ class WorkCommand extends Command
|
|||
// If a job was fired by the worker, we'll write the output out to the console
|
||||
// so that the developer can watch live while the queue runs in the console
|
||||
// window, which will also of get logged if stdout is logged out to disk.
|
||||
if (!is_null($response['job'])) {
|
||||
if (! is_null($response['job'])) {
|
||||
$this->writeOutput($response['job'], $response['failed']);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ class DatabaseQueue extends Queue implements QueueContract
|
|||
{
|
||||
$queue = $this->getQueue($queue);
|
||||
|
||||
if (!is_null($this->expire)) {
|
||||
if (! is_null($this->expire)) {
|
||||
$this->releaseJobsThatHaveBeenReservedTooLong($queue);
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,7 @@ class IronQueue extends Queue implements QueueContract
|
|||
// If we were able to pop a message off of the queue, we will need to decrypt
|
||||
// the message body, as all Iron.io messages are encrypted, since the push
|
||||
// queues will be a security hazard to unsuspecting developers using it.
|
||||
if (!is_null($job)) {
|
||||
if (! is_null($job)) {
|
||||
$job->body = $this->parseJobBody($job->body);
|
||||
|
||||
return new IronJob($this->container, $this, $job);
|
||||
|
|
|
@ -96,7 +96,7 @@ class IronJob extends Job implements JobContract
|
|||
{
|
||||
parent::release($delay);
|
||||
|
||||
if (!$this->pushed) {
|
||||
if (! $this->pushed) {
|
||||
$this->delete();
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ class QueueManager implements FactoryContract, MonitorContract
|
|||
// If the connection has not been resolved yet we will resolve it now as all
|
||||
// of the connections are resolved when they are actually needed so we do
|
||||
// not make any unnecessary connection to the various queue end-points.
|
||||
if (!isset($this->connections[$name])) {
|
||||
if (! isset($this->connections[$name])) {
|
||||
$this->connections[$name] = $this->resolve($name);
|
||||
|
||||
$this->connections[$name]->setContainer($this->app);
|
||||
|
|
|
@ -129,13 +129,13 @@ class RedisQueue extends Queue implements QueueContract
|
|||
|
||||
$queue = $this->getQueue($queue);
|
||||
|
||||
if (!is_null($this->expire)) {
|
||||
if (! is_null($this->expire)) {
|
||||
$this->migrateAllExpiredJobs($queue);
|
||||
}
|
||||
|
||||
$job = $this->getConnection()->lpop($queue);
|
||||
|
||||
if (!is_null($job)) {
|
||||
if (! is_null($job)) {
|
||||
$this->getConnection()->zadd($queue.':reserved', $this->getTime() + $this->expire, $job);
|
||||
|
||||
return new RedisJob($this->container, $this, $job, $original);
|
||||
|
|
|
@ -153,7 +153,7 @@ class Worker
|
|||
// If we're able to pull a job off of the stack, we will process it and
|
||||
// then immediately return back out. If there is no job on the queue
|
||||
// we will "sleep" the worker for the specified number of seconds.
|
||||
if (!is_null($job)) {
|
||||
if (! is_null($job)) {
|
||||
return $this->process(
|
||||
$this->manager->getName($connectionName), $job, $maxTries, $delay
|
||||
);
|
||||
|
@ -178,7 +178,7 @@ class Worker
|
|||
}
|
||||
|
||||
foreach (explode(',', $queue) as $queue) {
|
||||
if (!is_null($job = $connection->pop($queue))) {
|
||||
if (! is_null($job = $connection->pop($queue))) {
|
||||
return $job;
|
||||
}
|
||||
}
|
||||
|
@ -212,13 +212,13 @@ class Worker
|
|||
// If we catch an exception, we will attempt to release the job back onto
|
||||
// the queue so it is not lost. This will let is be retried at a later
|
||||
// time by another listener (or the same one). We will do that here.
|
||||
if (!$job->isDeleted()) {
|
||||
if (! $job->isDeleted()) {
|
||||
$job->release($delay);
|
||||
}
|
||||
|
||||
throw $e;
|
||||
} catch (Throwable $e) {
|
||||
if (!$job->isDeleted()) {
|
||||
if (! $job->isDeleted()) {
|
||||
$job->release($delay);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue