Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/5.6' into rename-index
Browse files Browse the repository at this point in the history
  • Loading branch information
slava-vishnyakov committed May 8, 2018
2 parents 85b783b + 458a89b commit 6cc9aaa
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 55 deletions.
35 changes: 35 additions & 0 deletions src/Illuminate/Contracts/Redis/Connection.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php

namespace Illuminate\Contracts\Redis;

use Closure;

interface Connection
{
/**
* Subscribe to a set of given channels for messages.
*
* @param array|string $channels
* @param \Closure $callback
* @return void
*/
public function subscribe($channels, Closure $callback);

/**
* Subscribe to a set of given channels with wildcards.
*
* @param array|string $channels
* @param \Closure $callback
* @return void
*/
public function psubscribe($channels, Closure $callback);

/**
* Run a command against the Redis database.
*
* @param string $method
* @param array $parameters
* @return mixed
*/
public function command($method, array $parameters = []);
}
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn
*
* @var string
*/
const VERSION = '5.6.20';
const VERSION = '5.6.21';

/**
* The base path for the Laravel installation.
Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Redis/Connections/PhpRedisConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

use Redis;
use Closure;
use Illuminate\Contracts\Redis\Connection as ConnectionContract;

/**
* @mixin \Redis
*/
class PhpRedisConnection extends Connection
class PhpRedisConnection extends Connection implements ConnectionContract
{
/**
* Create a new PhpRedis connection.
Expand Down
3 changes: 2 additions & 1 deletion src/Illuminate/Redis/Connections/PredisConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
namespace Illuminate\Redis\Connections;

use Closure;
use Illuminate\Contracts\Redis\Connection as ConnectionContract;

/**
* @mixin \Predis\Client
*/
class PredisConnection extends Connection
class PredisConnection extends Connection implements ConnectionContract
{
/**
* Create a new Predis connection.
Expand Down
102 changes: 51 additions & 51 deletions src/Illuminate/Validation/Concerns/ReplacesAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,231 +77,231 @@ protected function replaceDigitsBetween($message, $attribute, $rule, $parameters
}

/**
* Replace all place-holders for the gt rule.
* Replace all place-holders for the min rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceGt($message, $attribute, $rule, $parameters)
protected function replaceMin($message, $attribute, $rule, $parameters)
{
return str_replace(':value', $this->getSize($parameters[0], $this->getValue($parameters[0])), $message);
return str_replace(':min', $parameters[0], $message);
}

/**
* Replace all place-holders for the lt rule.
* Replace all place-holders for the max rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceLt($message, $attribute, $rule, $parameters)
protected function replaceMax($message, $attribute, $rule, $parameters)
{
return str_replace(':value', $this->getSize($parameters[0], $this->getValue($parameters[0])), $message);
return str_replace(':max', $parameters[0], $message);
}

/**
* Replace all place-holders for the gte rule.
* Replace all place-holders for the in rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceGte($message, $attribute, $rule, $parameters)
protected function replaceIn($message, $attribute, $rule, $parameters)
{
return str_replace(':value', $this->getSize($parameters[0], $this->getValue($parameters[0])), $message);
foreach ($parameters as &$parameter) {
$parameter = $this->getDisplayableValue($attribute, $parameter);
}

return str_replace(':values', implode(', ', $parameters), $message);
}

/**
* Replace all place-holders for the lte rule.
* Replace all place-holders for the not_in rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceLte($message, $attribute, $rule, $parameters)
protected function replaceNotIn($message, $attribute, $rule, $parameters)
{
return str_replace(':value', $this->getSize($parameters[0], $this->getValue($parameters[0])), $message);
return $this->replaceIn($message, $attribute, $rule, $parameters);
}

/**
* Replace all place-holders for the min rule.
* Replace all place-holders for the in_array rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceMin($message, $attribute, $rule, $parameters)
protected function replaceInArray($message, $attribute, $rule, $parameters)
{
return str_replace(':min', $parameters[0], $message);
return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message);
}

/**
* Replace all place-holders for the max rule.
* Replace all place-holders for the mimetypes rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceMax($message, $attribute, $rule, $parameters)
protected function replaceMimetypes($message, $attribute, $rule, $parameters)
{
return str_replace(':max', $parameters[0], $message);
return str_replace(':values', implode(', ', $parameters), $message);
}

/**
* Replace all place-holders for the in rule.
* Replace all place-holders for the mimes rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceIn($message, $attribute, $rule, $parameters)
protected function replaceMimes($message, $attribute, $rule, $parameters)
{
foreach ($parameters as &$parameter) {
$parameter = $this->getDisplayableValue($attribute, $parameter);
}

return str_replace(':values', implode(', ', $parameters), $message);
}

/**
* Replace all place-holders for the not_in rule.
* Replace all place-holders for the required_with rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceNotIn($message, $attribute, $rule, $parameters)
protected function replaceRequiredWith($message, $attribute, $rule, $parameters)
{
return $this->replaceIn($message, $attribute, $rule, $parameters);
return str_replace(':values', implode(' / ', $this->getAttributeList($parameters)), $message);
}

/**
* Replace all place-holders for the in_array rule.
* Replace all place-holders for the required_with_all rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceInArray($message, $attribute, $rule, $parameters)
protected function replaceRequiredWithAll($message, $attribute, $rule, $parameters)
{
return str_replace(':other', $this->getDisplayableAttribute($parameters[0]), $message);
return $this->replaceRequiredWith($message, $attribute, $rule, $parameters);
}

/**
* Replace all place-holders for the mimetypes rule.
* Replace all place-holders for the required_without rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceMimetypes($message, $attribute, $rule, $parameters)
protected function replaceRequiredWithout($message, $attribute, $rule, $parameters)
{
return str_replace(':values', implode(', ', $parameters), $message);
return $this->replaceRequiredWith($message, $attribute, $rule, $parameters);
}

/**
* Replace all place-holders for the mimes rule.
* Replace all place-holders for the required_without_all rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceMimes($message, $attribute, $rule, $parameters)
protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters)
{
return str_replace(':values', implode(', ', $parameters), $message);
return $this->replaceRequiredWith($message, $attribute, $rule, $parameters);
}

/**
* Replace all place-holders for the required_with rule.
* Replace all place-holders for the size rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceRequiredWith($message, $attribute, $rule, $parameters)
protected function replaceSize($message, $attribute, $rule, $parameters)
{
return str_replace(':values', implode(' / ', $this->getAttributeList($parameters)), $message);
return str_replace(':size', $parameters[0], $message);
}

/**
* Replace all place-holders for the required_with_all rule.
* Replace all place-holders for the gt rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceRequiredWithAll($message, $attribute, $rule, $parameters)
protected function replaceGt($message, $attribute, $rule, $parameters)
{
return $this->replaceRequiredWith($message, $attribute, $rule, $parameters);
return str_replace(':value', $this->getSize($parameters[0], $this->getValue($parameters[0])), $message);
}

/**
* Replace all place-holders for the required_without rule.
* Replace all place-holders for the lt rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceRequiredWithout($message, $attribute, $rule, $parameters)
protected function replaceLt($message, $attribute, $rule, $parameters)
{
return $this->replaceRequiredWith($message, $attribute, $rule, $parameters);
return str_replace(':value', $this->getSize($parameters[0], $this->getValue($parameters[0])), $message);
}

/**
* Replace all place-holders for the required_without_all rule.
* Replace all place-holders for the gte rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceRequiredWithoutAll($message, $attribute, $rule, $parameters)
protected function replaceGte($message, $attribute, $rule, $parameters)
{
return $this->replaceRequiredWith($message, $attribute, $rule, $parameters);
return str_replace(':value', $this->getSize($parameters[0], $this->getValue($parameters[0])), $message);
}

/**
* Replace all place-holders for the size rule.
* Replace all place-holders for the lte rule.
*
* @param string $message
* @param string $attribute
* @param string $rule
* @param array $parameters
* @return string
*/
protected function replaceSize($message, $attribute, $rule, $parameters)
protected function replaceLte($message, $attribute, $rule, $parameters)
{
return str_replace(':size', $parameters[0], $message);
return str_replace(':value', $this->getSize($parameters[0], $this->getValue($parameters[0])), $message);
}

/**
Expand Down
Loading

0 comments on commit 6cc9aaa

Please sign in to comment.