Laravel version update
Laravel version update
This commit is contained in:
@@ -11,6 +11,8 @@
|
||||
|
||||
namespace Symfony\Component\Translation\Catalogue;
|
||||
|
||||
use Symfony\Component\Translation\Exception\InvalidArgumentException;
|
||||
use Symfony\Component\Translation\Exception\LogicException;
|
||||
use Symfony\Component\Translation\MessageCatalogue;
|
||||
use Symfony\Component\Translation\MessageCatalogueInterface;
|
||||
|
||||
@@ -24,19 +26,8 @@ use Symfony\Component\Translation\MessageCatalogueInterface;
|
||||
*/
|
||||
abstract class AbstractOperation implements OperationInterface
|
||||
{
|
||||
/**
|
||||
* @var MessageCatalogueInterface The source catalogue
|
||||
*/
|
||||
protected $source;
|
||||
|
||||
/**
|
||||
* @var MessageCatalogueInterface The target catalogue
|
||||
*/
|
||||
protected $target;
|
||||
|
||||
/**
|
||||
* @var MessageCatalogue The result catalogue
|
||||
*/
|
||||
protected $result;
|
||||
|
||||
/**
|
||||
@@ -69,21 +60,17 @@ abstract class AbstractOperation implements OperationInterface
|
||||
protected $messages;
|
||||
|
||||
/**
|
||||
* @param MessageCatalogueInterface $source The source catalogue
|
||||
* @param MessageCatalogueInterface $target The target catalogue
|
||||
*
|
||||
* @throws \LogicException
|
||||
* @throws LogicException
|
||||
*/
|
||||
public function __construct(MessageCatalogueInterface $source, MessageCatalogueInterface $target)
|
||||
{
|
||||
if ($source->getLocale() !== $target->getLocale()) {
|
||||
throw new \LogicException('Operated catalogues must belong to the same locale.');
|
||||
throw new LogicException('Operated catalogues must belong to the same locale.');
|
||||
}
|
||||
|
||||
$this->source = $source;
|
||||
$this->target = $target;
|
||||
$this->result = new MessageCatalogue($source->getLocale());
|
||||
$this->domains = null;
|
||||
$this->messages = array();
|
||||
}
|
||||
|
||||
@@ -104,8 +91,8 @@ abstract class AbstractOperation implements OperationInterface
|
||||
*/
|
||||
public function getMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
if (!isset($this->messages[$domain]['all'])) {
|
||||
@@ -120,8 +107,8 @@ abstract class AbstractOperation implements OperationInterface
|
||||
*/
|
||||
public function getNewMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
if (!isset($this->messages[$domain]['new'])) {
|
||||
@@ -136,8 +123,8 @@ abstract class AbstractOperation implements OperationInterface
|
||||
*/
|
||||
public function getObsoleteMessages($domain)
|
||||
{
|
||||
if (!in_array($domain, $this->getDomains())) {
|
||||
throw new \InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
if (!\in_array($domain, $this->getDomains())) {
|
||||
throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain));
|
||||
}
|
||||
|
||||
if (!isset($this->messages[$domain]['obsolete'])) {
|
||||
|
@@ -17,7 +17,7 @@ namespace Symfony\Component\Translation\Catalogue;
|
||||
* all = intersection ∪ (target ∖ intersection) = target
|
||||
* new = all ∖ source = {x: x ∈ target ∧ x ∉ source}
|
||||
* obsolete = source ∖ all = source ∖ target = {x: x ∈ source ∧ x ∉ target}
|
||||
* Basically, the result contains messages from the target catalogue.
|
||||
* Basically, the result contains messages from the target catalogue.
|
||||
*
|
||||
* @author Michael Lee <michael.lee@zerustech.com>
|
||||
*/
|
||||
@@ -34,12 +34,12 @@ class TargetOperation extends AbstractOperation
|
||||
'obsolete' => array(),
|
||||
);
|
||||
|
||||
// For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``,
|
||||
// For 'all' messages, the code can't be simplified as ``$this->messages[$domain]['all'] = $target->all($domain);``,
|
||||
// because doing so will drop messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback}
|
||||
//
|
||||
// For 'new' messages, the code can't be simplied as ``array_diff_assoc($this->target->all($domain), $this->source->all($domain));``
|
||||
// because doing so will not exclude messages like {x: x ∈ target ∧ x ∉ source.all ∧ x ∈ source.fallback}
|
||||
//
|
||||
//
|
||||
// For 'obsolete' messages, the code can't be simplifed as ``array_diff_assoc($this->source->all($domain), $this->target->all($domain))``
|
||||
// because doing so will not exclude messages like {x: x ∈ source ∧ x ∉ target.all ∧ x ∈ target.fallback}
|
||||
|
||||
|
Reference in New Issue
Block a user