mirror of
https://github.com/wallabag/wallabag.git
synced 2025-09-10 18:51:02 +00:00
twig implementation
This commit is contained in:
parent
2b840e0cfb
commit
4f5b44bd3b
1418 changed files with 108207 additions and 1586 deletions
79
vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php
vendored
Normal file
79
vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/ArrayAccessibleResourceBundle.php
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Intl\ResourceBundle\Util;
|
||||
|
||||
use Symfony\Component\Intl\Exception\BadMethodCallException;
|
||||
|
||||
/**
|
||||
* Work-around for a bug in PHP's \ResourceBundle implementation.
|
||||
*
|
||||
* More information can be found on https://bugs.php.net/bug.php?id=64356.
|
||||
* This class can be removed once that bug is fixed.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class ArrayAccessibleResourceBundle implements \ArrayAccess, \IteratorAggregate, \Countable
|
||||
{
|
||||
private $bundleImpl;
|
||||
|
||||
public function __construct(\ResourceBundle $bundleImpl)
|
||||
{
|
||||
$this->bundleImpl = $bundleImpl;
|
||||
}
|
||||
|
||||
public function get($offset, $fallback = null)
|
||||
{
|
||||
$value = $this->bundleImpl->get($offset, $fallback);
|
||||
|
||||
return $value instanceof \ResourceBundle ? new static($value) : $value;
|
||||
}
|
||||
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
return null !== $this->bundleImpl[$offset];
|
||||
}
|
||||
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
return $this->get($offset);
|
||||
}
|
||||
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
throw new BadMethodCallException('Resource bundles cannot be modified.');
|
||||
}
|
||||
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
throw new BadMethodCallException('Resource bundles cannot be modified.');
|
||||
}
|
||||
|
||||
public function getIterator()
|
||||
{
|
||||
return $this->bundleImpl;
|
||||
}
|
||||
|
||||
public function count()
|
||||
{
|
||||
return $this->bundleImpl->count();
|
||||
}
|
||||
|
||||
public function getErrorCode()
|
||||
{
|
||||
return $this->bundleImpl->getErrorCode();
|
||||
}
|
||||
|
||||
public function getErrorMessage()
|
||||
{
|
||||
return $this->bundleImpl->getErrorMessage();
|
||||
}
|
||||
}
|
33
vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RecursiveArrayAccess.php
vendored
Normal file
33
vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RecursiveArrayAccess.php
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Intl\ResourceBundle\Util;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class RecursiveArrayAccess
|
||||
{
|
||||
public static function get($array, array $indices)
|
||||
{
|
||||
foreach ($indices as $index) {
|
||||
if (!$array instanceof \ArrayAccess && !is_array($array)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$array = $array[$index];
|
||||
}
|
||||
|
||||
return $array;
|
||||
}
|
||||
|
||||
private function __construct() {}
|
||||
}
|
88
vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RingBuffer.php
vendored
Normal file
88
vendor/symfony/intl/Symfony/Component/Intl/ResourceBundle/Util/RingBuffer.php
vendored
Normal file
|
@ -0,0 +1,88 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Symfony package.
|
||||
*
|
||||
* (c) Fabien Potencier <fabien@symfony.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Symfony\Component\Intl\ResourceBundle\Util;
|
||||
|
||||
use Symfony\Component\Intl\Exception\OutOfBoundsException;
|
||||
|
||||
/**
|
||||
* Implements a ring buffer.
|
||||
*
|
||||
* A ring buffer is an array-like structure with a fixed size. If the buffer
|
||||
* is full, the next written element overwrites the first bucket in the buffer,
|
||||
* then the second and so on.
|
||||
*
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
*/
|
||||
class RingBuffer implements \ArrayAccess
|
||||
{
|
||||
private $values = array();
|
||||
|
||||
private $indices = array();
|
||||
|
||||
private $cursor = 0;
|
||||
|
||||
private $size;
|
||||
|
||||
public function __construct($size)
|
||||
{
|
||||
$this->size = $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetExists($key)
|
||||
{
|
||||
return isset($this->indices[$key]);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetGet($key)
|
||||
{
|
||||
if (!isset($this->indices[$key])) {
|
||||
throw new OutOfBoundsException(sprintf(
|
||||
'The index "%s" does not exist.',
|
||||
$key
|
||||
));
|
||||
}
|
||||
|
||||
return $this->values[$this->indices[$key]];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetSet($key, $value)
|
||||
{
|
||||
if (false !== ($keyToRemove = array_search($this->cursor, $this->indices))) {
|
||||
unset($this->indices[$keyToRemove]);
|
||||
}
|
||||
|
||||
$this->values[$this->cursor] = $value;
|
||||
$this->indices[$key] = $this->cursor;
|
||||
|
||||
$this->cursor = ($this->cursor + 1) % $this->size;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function offsetUnset($key)
|
||||
{
|
||||
if (isset($this->indices[$key])) {
|
||||
$this->values[$this->indices[$key]] = null;
|
||||
unset($this->indices[$key]);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue