Subida del módulo y tema de PrestaShop

This commit is contained in:
Kaloyan
2026-04-09 18:31:51 +02:00
parent 12c253296f
commit 16b3ff9424
39262 changed files with 7418797 additions and 0 deletions

19
vendor/mrclay/props-dic/LICENSE vendored Normal file
View File

@@ -0,0 +1,19 @@
Copyright (c) 2013 The Authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,9 @@
<?php
namespace Props;
use Psr\Container\ContainerExceptionInterface;
class BadMethodCallException extends \Exception implements ContainerExceptionInterface
{
}

View File

@@ -0,0 +1,249 @@
<?php
namespace Props;
use Psr\Container\ContainerInterface;
/**
* Container holding values which can be resolved upon reading and optionally stored and shared
* across reads.
*
* Values are read/set as properties.
*
* @note see scripts/example.php
*/
class Container implements ContainerInterface
{
/**
* @var callable[]
*/
private $factories = array();
/**
* @var array
*/
private $cache = array();
/**
* Fetch a value.
*
* @param string $name
* @return mixed
* @throws FactoryUncallableException|ValueUnresolvableException|NotFoundException
*/
public function __get($name)
{
if (array_key_exists($name, $this->cache)) {
return $this->cache[$name];
}
$value = $this->build($name);
$this->cache[$name] = $value;
return $value;
}
/**
* {@inheritdoc}
*/
public function get($name)
{
return $this->__get($name);
}
/**
* Set a value.
*
* @param string $name
* @param mixed $value
* @throws \InvalidArgumentException
*/
public function __set($name, $value)
{
if ($value instanceof \Closure) {
$this->setFactory($name, $value);
return;
}
$this->cache[$name] = $value;
unset($this->factories[$name]);
}
/**
* Set a value to be later returned as is. You only need to use this if you wish to store
* a Closure.
*
* @param string $name
* @param mixed $value
* @throws \InvalidArgumentException
*/
public function setValue($name, $value)
{
unset($this->factories[$name]);
$this->cache[$name] = $value;
}
/**
* @param string $name
*/
public function __unset($name)
{
unset($this->cache[$name]);
unset($this->factories[$name]);
}
/**
* @param string $name
* @return bool
*/
public function __isset($name)
{
return array_key_exists($name, $this->factories) || array_key_exists($name, $this->cache);
}
/**
* {@inheritdoc}
*/
public function has($name)
{
return $this->__isset($name);
}
/**
* Fetch a freshly-resolved value.
*
* @param string $method method name must start with "new_"
* @param array $args
* @return mixed
* @throws BadMethodCallException
*/
public function __call($method, $args)
{
if (0 !== strpos($method, 'new_')) {
throw new BadMethodCallException("Method name must begin with 'new_'");
}
return $this->build(substr($method, 4));
}
/**
* Can we fetch a new value via new_$name()?
*
* @param string $name
* @return bool
*/
public function hasFactory($name)
{
return array_key_exists($name, $this->factories);
}
/**
* Set a factory to generate a value when the container is read.
*
* @param string $name The name of the value
* @param callable $factory Factory for the value
* @throws FactoryUncallableException
*/
public function setFactory($name, $factory)
{
if (!is_callable($factory, true)) {
throw new FactoryUncallableException('$factory must appear callable');
}
unset($this->cache[$name]);
$this->factories[$name] = $factory;
}
/**
* Get an already-set factory callable (Closure, invokable, or callback)
*
* @param string $name The name of the value
* @return callable
* @throws NotFoundException
*/
public function getFactory($name)
{
if (!array_key_exists($name, $this->factories)) {
throw new NotFoundException("No factory available for: $name");
}
return $this->factories[$name];
}
/**
* Add a function that gets applied to the return value of an existing factory
*
* @note A cached value (from a previous property read) will thrown away. The next property read
* (and all new_NAME() calls) will call the original factory.
*
* @param string $name The name of the value
* @param callable $extender Function that is applied to extend the returned value
* @return \Closure
* @throws FactoryUncallableException|NotFoundException
*/
public function extend($name, $extender)
{
if (!is_callable($extender, true)) {
throw new FactoryUncallableException('$extender must appear callable');
}
if (!array_key_exists($name, $this->factories)) {
throw new NotFoundException("No factory available for: $name");
}
$factory = $this->factories[$name];
$newFactory = function (Container $c) use ($extender, $factory) {
return call_user_func($extender, call_user_func($factory, $c), $c);
};
$this->setFactory($name, $newFactory);
return $newFactory;
}
/**
* Get all keys available
*
* @return string[]
*/
public function getKeys()
{
$keys = array_keys($this->cache) + array_keys($this->factories);
return array_unique($keys);
}
/**
* Build a value
*
* @param string $name
* @return mixed
* @throws FactoryUncallableException|ValueUnresolvableException|NotFoundException
*/
private function build($name)
{
if (!array_key_exists($name, $this->factories)) {
throw new NotFoundException("Missing value: $name");
}
$factory = $this->factories[$name];
if (is_callable($factory)) {
try {
return call_user_func($factory, $this);
} catch (\Exception $e) {
throw new ValueUnresolvableException("Factory for '$name' threw an exception.", 0, $e);
}
}
$msg = "Factory for '$name' was uncallable";
if (is_string($factory)) {
$msg .= ": '$factory'";
} elseif (is_array($factory)) {
if (is_string($factory[0])) {
$msg .= ": '{$factory[0]}::{$factory[1]}'";
} else {
$msg .= ": " . get_class($factory[0]) . "->{$factory[1]}";
}
}
throw new FactoryUncallableException($msg);
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace Props;
use Psr\Container\ContainerExceptionInterface;
class FactoryUncallableException extends \Exception implements ContainerExceptionInterface
{
}

View File

@@ -0,0 +1,10 @@
<?php
namespace Props;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
class NotFoundException extends \Exception implements ContainerExceptionInterface, NotFoundExceptionInterface
{
}

View File

@@ -0,0 +1,56 @@
<?php
namespace Props;
/**
* A version of Pimple that uses property access instead of array access
*
* @author Steve Clay <steve@mrclay.org>
*/
class Pimple extends \Pimple\Container
{
/**
* Sets a parameter or an object.
*
* @param string $id The unique identifier for the parameter or object
* @param mixed $value The value of the parameter or a closure to define an object
* @throws \RuntimeException Prevent override of a frozen service
*/
public function __set($id, $value)
{
$this->offsetSet($id, $value);
}
/**
* Gets a parameter or an object.
*
* @param string $id The unique identifier for the parameter or object
* @return mixed The value of the parameter or an object
* @throws \InvalidArgumentException if the identifier is not defined
*/
public function __get($id)
{
return $this->offsetGet($id);
}
/**
* Checks if a parameter or an object is set.
*
* @param string $id The unique identifier for the parameter or object
* @return Boolean
*/
public function __isset($id)
{
return $this->offsetExists($id);
}
/**
* Unsets a parameter or an object.
*
* @param string $id The unique identifier for the parameter or object
*/
public function __unset($id)
{
$this->offsetUnset($id);
}
}

View File

@@ -0,0 +1,9 @@
<?php
namespace Props;
use Psr\Container\ContainerExceptionInterface;
class ValueUnresolvableException extends \Exception implements ContainerExceptionInterface
{
}