Des modules ajoutés et mise en page du CSS
This commit is contained in:
7
local/modules/MondialRelay/vendor/autoload.php
vendored
Normal file
7
local/modules/MondialRelay/vendor/autoload.php
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
// autoload.php @generated by Composer
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitc5f9e4166b08cdd2cfebefc863dd2000::getLoader();
|
||||
445
local/modules/MondialRelay/vendor/composer/ClassLoader.php
vendored
Normal file
445
local/modules/MondialRelay/vendor/composer/ClassLoader.php
vendored
Normal file
@@ -0,0 +1,445 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Composer.
|
||||
*
|
||||
* (c) Nils Adermann <naderman@naderman.de>
|
||||
* Jordi Boggiano <j.boggiano@seld.be>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
/**
|
||||
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
||||
*
|
||||
* $loader = new \Composer\Autoload\ClassLoader();
|
||||
*
|
||||
* // register classes with namespaces
|
||||
* $loader->add('Symfony\Component', __DIR__.'/component');
|
||||
* $loader->add('Symfony', __DIR__.'/framework');
|
||||
*
|
||||
* // activate the autoloader
|
||||
* $loader->register();
|
||||
*
|
||||
* // to enable searching the include path (eg. for PEAR packages)
|
||||
* $loader->setUseIncludePath(true);
|
||||
*
|
||||
* In this example, if you try to use a class in the Symfony\Component
|
||||
* namespace or one of its children (Symfony\Component\Console for instance),
|
||||
* the autoloader will first look for the class under the component/
|
||||
* directory, and it will then fallback to the framework/ directory if not
|
||||
* found before giving up.
|
||||
*
|
||||
* This class is loosely based on the Symfony UniversalClassLoader.
|
||||
*
|
||||
* @author Fabien Potencier <fabien@symfony.com>
|
||||
* @author Jordi Boggiano <j.boggiano@seld.be>
|
||||
* @see http://www.php-fig.org/psr/psr-0/
|
||||
* @see http://www.php-fig.org/psr/psr-4/
|
||||
*/
|
||||
class ClassLoader
|
||||
{
|
||||
// PSR-4
|
||||
private $prefixLengthsPsr4 = array();
|
||||
private $prefixDirsPsr4 = array();
|
||||
private $fallbackDirsPsr4 = array();
|
||||
|
||||
// PSR-0
|
||||
private $prefixesPsr0 = array();
|
||||
private $fallbackDirsPsr0 = array();
|
||||
|
||||
private $useIncludePath = false;
|
||||
private $classMap = array();
|
||||
private $classMapAuthoritative = false;
|
||||
private $missingClasses = array();
|
||||
private $apcuPrefix;
|
||||
|
||||
public function getPrefixes()
|
||||
{
|
||||
if (!empty($this->prefixesPsr0)) {
|
||||
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getPrefixesPsr4()
|
||||
{
|
||||
return $this->prefixDirsPsr4;
|
||||
}
|
||||
|
||||
public function getFallbackDirs()
|
||||
{
|
||||
return $this->fallbackDirsPsr0;
|
||||
}
|
||||
|
||||
public function getFallbackDirsPsr4()
|
||||
{
|
||||
return $this->fallbackDirsPsr4;
|
||||
}
|
||||
|
||||
public function getClassMap()
|
||||
{
|
||||
return $this->classMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $classMap Class to filename map
|
||||
*/
|
||||
public function addClassMap(array $classMap)
|
||||
{
|
||||
if ($this->classMap) {
|
||||
$this->classMap = array_merge($this->classMap, $classMap);
|
||||
} else {
|
||||
$this->classMap = $classMap;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix, either
|
||||
* appending or prepending to the ones previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 root directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*/
|
||||
public function add($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr0
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr0 = array_merge(
|
||||
$this->fallbackDirsPsr0,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$first = $prefix[0];
|
||||
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
||||
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
||||
|
||||
return;
|
||||
}
|
||||
if ($prepend) {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixesPsr0[$first][$prefix]
|
||||
);
|
||||
} else {
|
||||
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
||||
$this->prefixesPsr0[$first][$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace, either
|
||||
* appending or prepending to the ones previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
* @param bool $prepend Whether to prepend the directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function addPsr4($prefix, $paths, $prepend = false)
|
||||
{
|
||||
if (!$prefix) {
|
||||
// Register directories for the root namespace.
|
||||
if ($prepend) {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
(array) $paths,
|
||||
$this->fallbackDirsPsr4
|
||||
);
|
||||
} else {
|
||||
$this->fallbackDirsPsr4 = array_merge(
|
||||
$this->fallbackDirsPsr4,
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
||||
// Register directories for a new namespace.
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
} elseif ($prepend) {
|
||||
// Prepend directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
(array) $paths,
|
||||
$this->prefixDirsPsr4[$prefix]
|
||||
);
|
||||
} else {
|
||||
// Append directories for an already registered namespace.
|
||||
$this->prefixDirsPsr4[$prefix] = array_merge(
|
||||
$this->prefixDirsPsr4[$prefix],
|
||||
(array) $paths
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-0 directories for a given prefix,
|
||||
* replacing any others previously set for this prefix.
|
||||
*
|
||||
* @param string $prefix The prefix
|
||||
* @param array|string $paths The PSR-0 base directories
|
||||
*/
|
||||
public function set($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr0 = (array) $paths;
|
||||
} else {
|
||||
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a set of PSR-4 directories for a given namespace,
|
||||
* replacing any others previously set for this namespace.
|
||||
*
|
||||
* @param string $prefix The prefix/namespace, with trailing '\\'
|
||||
* @param array|string $paths The PSR-4 base directories
|
||||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public function setPsr4($prefix, $paths)
|
||||
{
|
||||
if (!$prefix) {
|
||||
$this->fallbackDirsPsr4 = (array) $paths;
|
||||
} else {
|
||||
$length = strlen($prefix);
|
||||
if ('\\' !== $prefix[$length - 1]) {
|
||||
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
||||
}
|
||||
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
||||
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns on searching the include path for class files.
|
||||
*
|
||||
* @param bool $useIncludePath
|
||||
*/
|
||||
public function setUseIncludePath($useIncludePath)
|
||||
{
|
||||
$this->useIncludePath = $useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to check if the autoloader uses the include path to check
|
||||
* for classes.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getUseIncludePath()
|
||||
{
|
||||
return $this->useIncludePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns off searching the prefix and fallback directories for classes
|
||||
* that have not been registered with the class map.
|
||||
*
|
||||
* @param bool $classMapAuthoritative
|
||||
*/
|
||||
public function setClassMapAuthoritative($classMapAuthoritative)
|
||||
{
|
||||
$this->classMapAuthoritative = $classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should class lookup fail if not found in the current class map?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isClassMapAuthoritative()
|
||||
{
|
||||
return $this->classMapAuthoritative;
|
||||
}
|
||||
|
||||
/**
|
||||
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
||||
*
|
||||
* @param string|null $apcuPrefix
|
||||
*/
|
||||
public function setApcuPrefix($apcuPrefix)
|
||||
{
|
||||
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The APCu prefix in use, or null if APCu caching is not enabled.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApcuPrefix()
|
||||
{
|
||||
return $this->apcuPrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers this instance as an autoloader.
|
||||
*
|
||||
* @param bool $prepend Whether to prepend the autoloader or not
|
||||
*/
|
||||
public function register($prepend = false)
|
||||
{
|
||||
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregisters this instance as an autoloader.
|
||||
*/
|
||||
public function unregister()
|
||||
{
|
||||
spl_autoload_unregister(array($this, 'loadClass'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the given class or interface.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
* @return bool|null True if loaded, null otherwise
|
||||
*/
|
||||
public function loadClass($class)
|
||||
{
|
||||
if ($file = $this->findFile($class)) {
|
||||
includeFile($file);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the path to the file where the class is defined.
|
||||
*
|
||||
* @param string $class The name of the class
|
||||
*
|
||||
* @return string|false The path if found, false otherwise
|
||||
*/
|
||||
public function findFile($class)
|
||||
{
|
||||
// class map lookup
|
||||
if (isset($this->classMap[$class])) {
|
||||
return $this->classMap[$class];
|
||||
}
|
||||
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
||||
return false;
|
||||
}
|
||||
if (null !== $this->apcuPrefix) {
|
||||
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
||||
if ($hit) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
$file = $this->findFileWithExtension($class, '.php');
|
||||
|
||||
// Search for Hack files if we are running on HHVM
|
||||
if (false === $file && defined('HHVM_VERSION')) {
|
||||
$file = $this->findFileWithExtension($class, '.hh');
|
||||
}
|
||||
|
||||
if (null !== $this->apcuPrefix) {
|
||||
apcu_add($this->apcuPrefix.$class, $file);
|
||||
}
|
||||
|
||||
if (false === $file) {
|
||||
// Remember that this class does not exist.
|
||||
$this->missingClasses[$class] = true;
|
||||
}
|
||||
|
||||
return $file;
|
||||
}
|
||||
|
||||
private function findFileWithExtension($class, $ext)
|
||||
{
|
||||
// PSR-4 lookup
|
||||
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
||||
|
||||
$first = $class[0];
|
||||
if (isset($this->prefixLengthsPsr4[$first])) {
|
||||
$subPath = $class;
|
||||
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
||||
$subPath = substr($subPath, 0, $lastPos);
|
||||
$search = $subPath.'\\';
|
||||
if (isset($this->prefixDirsPsr4[$search])) {
|
||||
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
||||
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
||||
if (file_exists($file = $dir . $pathEnd)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-4 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr4 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 lookup
|
||||
if (false !== $pos = strrpos($class, '\\')) {
|
||||
// namespaced class name
|
||||
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
||||
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
||||
} else {
|
||||
// PEAR-like class name
|
||||
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
||||
}
|
||||
|
||||
if (isset($this->prefixesPsr0[$first])) {
|
||||
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
||||
if (0 === strpos($class, $prefix)) {
|
||||
foreach ($dirs as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 fallback dirs
|
||||
foreach ($this->fallbackDirsPsr0 as $dir) {
|
||||
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
}
|
||||
|
||||
// PSR-0 include paths.
|
||||
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
||||
return $file;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Scope isolated include.
|
||||
*
|
||||
* Prevents access to $this/self from included files.
|
||||
*/
|
||||
function includeFile($file)
|
||||
{
|
||||
include $file;
|
||||
}
|
||||
21
local/modules/MondialRelay/vendor/composer/LICENSE
vendored
Normal file
21
local/modules/MondialRelay/vendor/composer/LICENSE
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
Copyright (c) Nils Adermann, Jordi Boggiano
|
||||
|
||||
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.
|
||||
|
||||
9
local/modules/MondialRelay/vendor/composer/autoload_classmap.php
vendored
Normal file
9
local/modules/MondialRelay/vendor/composer/autoload_classmap.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_classmap.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
9
local/modules/MondialRelay/vendor/composer/autoload_namespaces.php
vendored
Normal file
9
local/modules/MondialRelay/vendor/composer/autoload_namespaces.php
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// autoload_namespaces.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
);
|
||||
10
local/modules/MondialRelay/vendor/composer/autoload_psr4.php
vendored
Normal file
10
local/modules/MondialRelay/vendor/composer/autoload_psr4.php
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
// autoload_psr4.php @generated by Composer
|
||||
|
||||
$vendorDir = dirname(dirname(__FILE__));
|
||||
$baseDir = dirname($vendorDir);
|
||||
|
||||
return array(
|
||||
'MondialRelay\\' => array($vendorDir . '/xaviborja/php-mondialrelay-api/src/MondialRelay'),
|
||||
);
|
||||
52
local/modules/MondialRelay/vendor/composer/autoload_real.php
vendored
Normal file
52
local/modules/MondialRelay/vendor/composer/autoload_real.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitc5f9e4166b08cdd2cfebefc863dd2000
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
public static function loadClassLoader($class)
|
||||
{
|
||||
if ('Composer\Autoload\ClassLoader' === $class) {
|
||||
require __DIR__ . '/ClassLoader.php';
|
||||
}
|
||||
}
|
||||
|
||||
public static function getLoader()
|
||||
{
|
||||
if (null !== self::$loader) {
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitc5f9e4166b08cdd2cfebefc863dd2000', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitc5f9e4166b08cdd2cfebefc863dd2000', 'loadClassLoader'));
|
||||
|
||||
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
||||
if ($useStaticLoader) {
|
||||
require_once __DIR__ . '/autoload_static.php';
|
||||
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitc5f9e4166b08cdd2cfebefc863dd2000::getInitializer($loader));
|
||||
} else {
|
||||
$map = require __DIR__ . '/autoload_namespaces.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->set($namespace, $path);
|
||||
}
|
||||
|
||||
$map = require __DIR__ . '/autoload_psr4.php';
|
||||
foreach ($map as $namespace => $path) {
|
||||
$loader->setPsr4($namespace, $path);
|
||||
}
|
||||
|
||||
$classMap = require __DIR__ . '/autoload_classmap.php';
|
||||
if ($classMap) {
|
||||
$loader->addClassMap($classMap);
|
||||
}
|
||||
}
|
||||
|
||||
$loader->register(true);
|
||||
|
||||
return $loader;
|
||||
}
|
||||
}
|
||||
31
local/modules/MondialRelay/vendor/composer/autoload_static.php
vendored
Normal file
31
local/modules/MondialRelay/vendor/composer/autoload_static.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
// autoload_static.php @generated by Composer
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitc5f9e4166b08cdd2cfebefc863dd2000
|
||||
{
|
||||
public static $prefixLengthsPsr4 = array (
|
||||
'M' =>
|
||||
array (
|
||||
'MondialRelay\\' => 13,
|
||||
),
|
||||
);
|
||||
|
||||
public static $prefixDirsPsr4 = array (
|
||||
'MondialRelay\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/xaviborja/php-mondialrelay-api/src/MondialRelay',
|
||||
),
|
||||
);
|
||||
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitc5f9e4166b08cdd2cfebefc863dd2000::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitc5f9e4166b08cdd2cfebefc863dd2000::$prefixDirsPsr4;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
}
|
||||
43
local/modules/MondialRelay/vendor/composer/installed.json
vendored
Normal file
43
local/modules/MondialRelay/vendor/composer/installed.json
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
[
|
||||
{
|
||||
"name": "xaviborja/php-mondialrelay-api",
|
||||
"version": "dev-master",
|
||||
"version_normalized": "9999999-dev",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/xaviborja/php-mondialrelay-api.git",
|
||||
"reference": "b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/xaviborja/php-mondialrelay-api/zipball/b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf",
|
||||
"reference": "b57f7da5f3f2ce983c8bea3d8239b7fdbe7ebcbf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"xaviborja/php-mondialrelay-api": "dev-master"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.0"
|
||||
},
|
||||
"time": "2017-06-21T12:22:06+00:00",
|
||||
"type": "library",
|
||||
"installation-source": "source",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"MondialRelay\\": "src/MondialRelay/"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Xavier Borja",
|
||||
"email": "xavibm86@gmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A PHP library for dealing with Mondial Relay API (http://api.mondialrelay.com)"
|
||||
}
|
||||
]
|
||||
5
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/Readme.md
vendored
Normal file
5
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/Readme.md
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
PHP Library to Wrap Mondial Relay API
|
||||
|
||||
## Installation
|
||||
|
||||
composer require xaviborja/php-mondialrelay-api
|
||||
1
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/bin/phpunit
vendored
Normal file
1
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/bin/phpunit
vendored
Normal file
@@ -0,0 +1 @@
|
||||
../vendor/phpunit/phpunit/phpunit
|
||||
26
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/composer.json
vendored
Normal file
26
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/composer.json
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "xaviborja/php-mondialrelay-api",
|
||||
"description": "A PHP library for dealing with Mondial Relay API (http://api.mondialrelay.com)",
|
||||
"license": "MIT",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Xavier Borja",
|
||||
"email": "xavibm86@gmail.com"
|
||||
}
|
||||
],
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^5.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {"MondialRelay\\": "src/MondialRelay/"}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {"MondialRelay\\": "tests/MondialRelay/"}
|
||||
},
|
||||
"config": {
|
||||
"bin-dir": "bin"
|
||||
},
|
||||
"require": {
|
||||
"xaviborja/php-mondialrelay-api": "dev-master"
|
||||
}
|
||||
}
|
||||
1334
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/composer.lock
generated
vendored
Normal file
1334
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/composer.lock
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
24
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/phpunit.xml.dist
vendored
Normal file
24
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/phpunit.xml.dist
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false">
|
||||
|
||||
<testsuites>
|
||||
<testsuite name="Test Suite">
|
||||
<directory>./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
|
||||
<filter>
|
||||
<whitelist>
|
||||
<directory>./src/</directory>
|
||||
</whitelist>
|
||||
</filter>
|
||||
</phpunit>
|
||||
132
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/src/MondialRelay/ApiClient.php
vendored
Normal file
132
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/src/MondialRelay/ApiClient.php
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay;
|
||||
|
||||
use MondialRelay\Expedition\ExpeditionFactory;
|
||||
use MondialRelay\Point\PointFactory;
|
||||
use MondialRelay\Ticket\TicketFactory;
|
||||
|
||||
class ApiClient
|
||||
{
|
||||
|
||||
private $websiteId;
|
||||
private $websiteKey;
|
||||
private $client;
|
||||
|
||||
public function __construct(\SoapClient $soapClient, $websiteId, $websiteKey)
|
||||
{
|
||||
$this->websiteId = $websiteId;
|
||||
$this->websiteKey = $websiteKey;
|
||||
$this->client = $soapClient;
|
||||
}
|
||||
|
||||
public function findDeliveryPoints(array $request)
|
||||
{
|
||||
try {
|
||||
$request = $this->decorateRequest($request);
|
||||
$result = $this->client->WSI4_PointRelais_Recherche($request);
|
||||
|
||||
$pointFactory = new PointFactory();
|
||||
$this->checkResponse('WSI4_PointRelais_Recherche', $result);
|
||||
$delivery_points = [];
|
||||
if (!property_exists($result->WSI4_PointRelais_RechercheResult, 'PointsRelais')) {
|
||||
return $delivery_points;
|
||||
}
|
||||
if (!property_exists($result->WSI4_PointRelais_RechercheResult->PointsRelais, 'PointRelais_Details')) {
|
||||
return $delivery_points;
|
||||
}
|
||||
if (is_object($result->WSI4_PointRelais_RechercheResult->PointsRelais->PointRelais_Details)) {
|
||||
$delivery_points[] = $pointFactory->create($result->WSI4_PointRelais_RechercheResult->PointsRelais->PointRelais_Details);
|
||||
return $delivery_points;
|
||||
}
|
||||
foreach ($result->WSI4_PointRelais_RechercheResult->PointsRelais->PointRelais_Details as $destination_point) {
|
||||
$delivery_points[] = $pointFactory->create($destination_point);
|
||||
}
|
||||
return $delivery_points;
|
||||
} catch (\SoapFault $e) {
|
||||
throw new \Exception();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function findDeliveryPoint($id, $country)
|
||||
{
|
||||
try {
|
||||
return $this->findDeliveryPoints(array(
|
||||
'NumPointRelais' => $id,
|
||||
'Pays' => $country
|
||||
));
|
||||
|
||||
} catch (\SoapFault $e) {
|
||||
throw new \Exception();
|
||||
}
|
||||
}
|
||||
|
||||
private function decorateRequest($request)
|
||||
{
|
||||
$key = $this->websiteId;
|
||||
foreach ($request as $parameter => $value) {
|
||||
$key .= $value;
|
||||
}
|
||||
$key .= $this->websiteKey;
|
||||
$request['Enseigne'] = $this->websiteId;
|
||||
$request['Security'] = strtoupper(md5($key));
|
||||
return $request;
|
||||
}
|
||||
|
||||
private function checkResponse($method, $result)
|
||||
{
|
||||
$method = $method . "Result";
|
||||
if ($result->{$method}->STAT != 0) {
|
||||
$request = $this->decorateRequest([
|
||||
'STAT_ID' => $result->{$method}->STAT,
|
||||
'Langue' => 'FR',
|
||||
]);
|
||||
$error_response = $this->client->WSI2_STAT_Label($request);
|
||||
throw new \InvalidArgumentException($error_response->WSI2_STAT_LabelResult);
|
||||
}
|
||||
}
|
||||
|
||||
public function createExpedition(array $request)
|
||||
{
|
||||
try {
|
||||
|
||||
$request = $this->decorateRequest($request);
|
||||
$result = $this->client->WSI2_CreationExpedition($request);
|
||||
$this->checkResponse('WSI2_CreationExpedition', $result);
|
||||
|
||||
return (new ExpeditionFactory())->create($result->WSI2_CreationExpeditionResult->STAT,
|
||||
$result->WSI2_CreationExpeditionResult->ExpeditionNum,
|
||||
$result->WSI2_CreationExpeditionResult->TRI_AgenceCode,
|
||||
$result->WSI2_CreationExpeditionResult->TRI_Groupe,
|
||||
$result->WSI2_CreationExpeditionResult->TRI_Navette,
|
||||
$result->WSI2_CreationExpeditionResult->TRI_Agence,
|
||||
$result->WSI2_CreationExpeditionResult->TRI_TourneeCode,
|
||||
$result->WSI2_CreationExpeditionResult->TRI_LivraisonMode,
|
||||
$result->WSI2_CreationExpeditionResult->CodesBarres->string);
|
||||
|
||||
} catch (\SoapFault $e) {
|
||||
throw new \Exception();
|
||||
}
|
||||
}
|
||||
|
||||
public function generateTickets(array $request)
|
||||
{
|
||||
|
||||
try {
|
||||
|
||||
$request = $this->decorateRequest($request);
|
||||
$result = $this->client->WSI3_GetEtiquettes($request);
|
||||
$this->checkResponse('WSI3_GetEtiquettes', $result);
|
||||
|
||||
return (new TicketFactory())->create($result->WSI3_GetEtiquettesResult->STAT,
|
||||
$result->WSI3_GetEtiquettesResult->URL_PDF_A4,
|
||||
$result->WSI3_GetEtiquettesResult->URL_PDF_A5,
|
||||
$result->WSI3_GetEtiquettesResult->URL_PDF_10x15);
|
||||
|
||||
} catch (\SoapFault $e) {
|
||||
throw new \Exception();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace MondialRelay\BussinessHours;
|
||||
|
||||
|
||||
class BussinessHours
|
||||
{
|
||||
private $day;
|
||||
private $openingTime1;
|
||||
private $closingTime1;
|
||||
private $openingTime2;
|
||||
private $closingTime2;
|
||||
|
||||
public function __construct($day, $openingTime1, $closingTime1, $openingTime2, $closingTime2)
|
||||
{
|
||||
$this->day = $day;
|
||||
$this->openingTime1 = $openingTime1;
|
||||
$this->closingTime1 = $closingTime1;
|
||||
$this->openingTime2 = $openingTime2;
|
||||
$this->closingTime2 = $closingTime2;
|
||||
}
|
||||
|
||||
public function day()
|
||||
{
|
||||
return $this->day;
|
||||
}
|
||||
|
||||
public function openingTime1()
|
||||
{
|
||||
return $this->openingTime1;
|
||||
}
|
||||
|
||||
public function closingTime1()
|
||||
{
|
||||
return $this->closingTime1;
|
||||
}
|
||||
|
||||
public function openingTime2()
|
||||
{
|
||||
return $this->openingTime2;
|
||||
}
|
||||
|
||||
public function closingTime2()
|
||||
{
|
||||
return $this->closingTime2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\BussinessHours;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: albertclaret
|
||||
* Date: 14/06/17
|
||||
* Time: 09:29
|
||||
*/
|
||||
class BussinessHoursFactory
|
||||
{
|
||||
|
||||
private static $property_days_name = [
|
||||
'monday' => 'Horaires_Lundi',
|
||||
'tuesday' => 'Horaires_Mardi',
|
||||
'wednesday' => 'Horaires_Mercredi',
|
||||
'thursday' => 'Horaires_Jeudi',
|
||||
'friday' => 'Horaires_Vendredi',
|
||||
'saturday' => 'Horaires_Samedi',
|
||||
'sunday' => 'Horaires_Dimanche'
|
||||
];
|
||||
|
||||
public function create($response)
|
||||
{
|
||||
$bussines_hours = [];
|
||||
foreach (self::$property_days_name as $day => $property) {
|
||||
$bussines_hours[] = new BussinessHours(
|
||||
$day,
|
||||
$response->$property->string[0],
|
||||
$response->$property->string[1],
|
||||
$response->$property->string[2],
|
||||
$response->$property->string[3]
|
||||
);
|
||||
}
|
||||
return $bussines_hours;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Expedition;
|
||||
|
||||
|
||||
class Expedition
|
||||
{
|
||||
private $stat;
|
||||
private $expeditionNum;
|
||||
private $triAgenceCode;
|
||||
private $triGroupe;
|
||||
private $triNavette;
|
||||
private $triAgence;
|
||||
private $triTourneeCode;
|
||||
private $triLivraisonMode;
|
||||
private $codesBarres;
|
||||
|
||||
/**
|
||||
* Expedition constructor.
|
||||
* @param $stat
|
||||
* @param $expeditionNum
|
||||
* @param $triAgenceCode
|
||||
* @param $triGroupe
|
||||
* @param $triNavette
|
||||
* @param $triAgence
|
||||
* @param $triTourneeCode
|
||||
* @param $triLivraisonMode
|
||||
* @param $codesBarres
|
||||
*/
|
||||
public function __construct(
|
||||
$stat,
|
||||
$expeditionNum,
|
||||
$triAgenceCode,
|
||||
$triGroupe,
|
||||
$triNavette,
|
||||
$triAgence,
|
||||
$triTourneeCode,
|
||||
$triLivraisonMode,
|
||||
$codesBarres
|
||||
) {
|
||||
$this->stat = $stat;
|
||||
$this->expeditionNum = $expeditionNum;
|
||||
$this->triAgenceCode = $triAgenceCode;
|
||||
$this->triGroupe = $triGroupe;
|
||||
$this->triNavette = $triNavette;
|
||||
$this->triAgence = $triAgence;
|
||||
$this->triTourneeCode = $triTourneeCode;
|
||||
$this->triLivraisonMode = $triLivraisonMode;
|
||||
$this->codesBarres = $codesBarres;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function stat()
|
||||
{
|
||||
return $this->stat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function expeditionNum()
|
||||
{
|
||||
return $this->expeditionNum;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function triAgenceCode()
|
||||
{
|
||||
return $this->triAgenceCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function triGroupe()
|
||||
{
|
||||
return $this->triGroupe;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function triNavette()
|
||||
{
|
||||
return $this->triNavette;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function triAgence()
|
||||
{
|
||||
return $this->triAgence;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function triTourneeCode()
|
||||
{
|
||||
return $this->triTourneeCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function triLivraisonMode()
|
||||
{
|
||||
return $this->triLivraisonMode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function codesBarres()
|
||||
{
|
||||
return $this->codesBarres;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Expedition;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: albertclaret
|
||||
* Date: 14/06/17
|
||||
* Time: 09:19
|
||||
*/
|
||||
class ExpeditionFactory
|
||||
{
|
||||
public function create(
|
||||
$stat,
|
||||
$expeditionNum,
|
||||
$triAgenceCode,
|
||||
$triGroupe,
|
||||
$triNavette,
|
||||
$triAgence,
|
||||
$triTourneeCode,
|
||||
$triLivraisonMode,
|
||||
$codesBarres)
|
||||
{
|
||||
return new Expedition($stat,
|
||||
$expeditionNum,
|
||||
$triAgenceCode,
|
||||
$triGroupe,
|
||||
$triNavette,
|
||||
$triAgence,
|
||||
$triTourneeCode,
|
||||
$triLivraisonMode,
|
||||
$codesBarres);
|
||||
}
|
||||
}
|
||||
112
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/src/MondialRelay/Point/Point.php
vendored
Normal file
112
local/modules/MondialRelay/vendor/xaviborja/php-mondialrelay-api/src/MondialRelay/Point/Point.php
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace MondialRelay\Point;
|
||||
|
||||
|
||||
class Point
|
||||
{
|
||||
private $id;
|
||||
private $latitude;
|
||||
private $longitude;
|
||||
private $cp;
|
||||
private $address;
|
||||
private $city;
|
||||
private $country;
|
||||
private $location;
|
||||
private $activityType;
|
||||
private $information;
|
||||
private $distance;
|
||||
private $business_hours;
|
||||
|
||||
public function __construct(
|
||||
$id,
|
||||
$latitude,
|
||||
$longitude,
|
||||
$cp,
|
||||
array $address,
|
||||
$city,
|
||||
$country,
|
||||
array $location,
|
||||
$activityType,
|
||||
$information,
|
||||
$distance,
|
||||
array $business_hours
|
||||
) {
|
||||
$this->id = $id;
|
||||
$this->latitude = $latitude;
|
||||
$this->longitude = $longitude;
|
||||
$this->cp = $cp;
|
||||
$this->address = $address;
|
||||
$this->city = $city;
|
||||
$this->country = $country;
|
||||
$this->location = $location;
|
||||
$this->activityType = $activityType;
|
||||
$this->information = $information;
|
||||
$this->distance = $distance;
|
||||
$this->business_hours = $business_hours;
|
||||
}
|
||||
|
||||
|
||||
public function id()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function address()
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
public function latitude()
|
||||
{
|
||||
return $this->latitude;
|
||||
}
|
||||
|
||||
public function longitude()
|
||||
{
|
||||
return $this->longitude;
|
||||
}
|
||||
|
||||
public function cp()
|
||||
{
|
||||
return $this->cp;
|
||||
}
|
||||
|
||||
public function city()
|
||||
{
|
||||
return $this->city;
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->country;
|
||||
}
|
||||
|
||||
public function location()
|
||||
{
|
||||
return $this->location;
|
||||
}
|
||||
|
||||
public function activityType()
|
||||
{
|
||||
return $this->activityType;
|
||||
}
|
||||
|
||||
public function information()
|
||||
{
|
||||
return $this->information;
|
||||
}
|
||||
|
||||
public function distance()
|
||||
{
|
||||
return $this->distance;
|
||||
}
|
||||
|
||||
public function business_hours()
|
||||
{
|
||||
return $this->business_hours;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Point;
|
||||
|
||||
use MondialRelay\BussinessHours\BussinessHoursFactory;
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: albertclaret
|
||||
* Date: 14/06/17
|
||||
* Time: 09:27
|
||||
*/
|
||||
class PointFactory
|
||||
{
|
||||
protected function safeGet($response, $var)
|
||||
{
|
||||
if (isset($response->$var)) {
|
||||
return $response->$var;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function create($response)
|
||||
{
|
||||
$bussines_hours = (new BussinessHoursFactory())->create($response);
|
||||
return new Point(
|
||||
$response->Num,
|
||||
str_replace(",", ".", $response->Latitude),
|
||||
str_replace(",", ".", $response->Longitude),
|
||||
$response->CP,
|
||||
[
|
||||
trim($this->safeGet($response, 'LgAdr1')),
|
||||
trim($this->safeGet($response, 'LgAdr2')),
|
||||
trim($this->safeGet($response, 'LgAdr3')),
|
||||
trim($this->safeGet($response, 'LgAdr4')),
|
||||
],
|
||||
$response->Ville,
|
||||
$response->Pays,
|
||||
[
|
||||
$this->safeGet($response, 'Localisation1'),
|
||||
$this->safeGet($response, 'Localisation2'),
|
||||
],
|
||||
$response->TypeActivite,
|
||||
$response->Information,
|
||||
$response->Distance,
|
||||
$bussines_hours
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Ticket;
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: albertclaret
|
||||
* Date: 14/06/17
|
||||
* Time: 10:22
|
||||
*/
|
||||
class Ticket
|
||||
{
|
||||
private $stat;
|
||||
private $urlPDFA4;
|
||||
private $urlPDFA5;
|
||||
private $url10x15;
|
||||
|
||||
/**
|
||||
* Ticket constructor.
|
||||
* @param $stat
|
||||
* @param $urlPDFA4
|
||||
* @param $urlPDFA5
|
||||
*/
|
||||
public function __construct($stat, $urlPDFA4, $urlPDFA5, $url10x15)
|
||||
{
|
||||
$this->stat = $stat;
|
||||
$this->urlPDFA4 = $urlPDFA4;
|
||||
$this->urlPDFA5 = $urlPDFA5;
|
||||
$this->url10x15 = $url10x15;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStat()
|
||||
{
|
||||
return $this->stat;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUrlPDFA4()
|
||||
{
|
||||
return $this->urlPDFA4;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUrlPDFA5()
|
||||
{
|
||||
return $this->urlPDFA5;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUrl10x15()
|
||||
{
|
||||
return $this->url10x15;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay\Ticket;
|
||||
|
||||
|
||||
class TicketFactory
|
||||
{
|
||||
|
||||
public function create($stat, $urlPDFA4, $urlPDFA5, $url10x15)
|
||||
{
|
||||
return new Ticket($stat, $urlPDFA4, $urlPDFA5, $url10x15);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
<?php
|
||||
|
||||
namespace MondialRelay;
|
||||
|
||||
use MondialRelay\Expedition\Expedition;
|
||||
use MondialRelay\Point\Point;
|
||||
use MondialRelay\Ticket\Ticket;
|
||||
|
||||
class ApiClientTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
CONST WEBSITEID = "BDTEST13";
|
||||
CONST WEBSITEKEY = "PrivateK";
|
||||
CONST URL = "http://api.mondialrelay.com/Web_Services.asmx?WSDL";
|
||||
|
||||
/** @var ApiClient */
|
||||
private $client;
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->client = new ApiClient(new \SoapClient("http://api.mondialrelay.com/Web_Services.asmx?WSDL"),
|
||||
self::WEBSITEID, self::WEBSITEKEY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function itShouldReturnAnExceptionInvalidParametersAreSent()
|
||||
{
|
||||
$this->client->findDeliveryPoints([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function itShouldReturnAnEmptyStringIfNoPointsAreFound()
|
||||
{
|
||||
$points = $this->client->findDeliveryPoints(array(
|
||||
'Pays' => "ES",
|
||||
'Ville' => "",
|
||||
'CP' => '12345',
|
||||
'Latitude' => "",
|
||||
'Longitude' => "",
|
||||
'Taille' => "",
|
||||
'Poids' => "",
|
||||
'Action' => "",
|
||||
'DelaiEnvoi' => "0",
|
||||
'RayonRecherche' => "0"
|
||||
));
|
||||
$this->assertEmpty($points);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function itShouldReturnAnArrayOfPointsIfParametersMatch()
|
||||
{
|
||||
$points = $this->client->findDeliveryPoints(array(
|
||||
'Pays' => "ES",
|
||||
'Ville' => "",
|
||||
'CP' => '08915',
|
||||
'Latitude' => "",
|
||||
'Longitude' => "",
|
||||
'Taille' => "",
|
||||
'Poids' => "",
|
||||
'Action' => "",
|
||||
'DelaiEnvoi' => "0",
|
||||
'RayonRecherche' => "20"
|
||||
));
|
||||
foreach ($points as $point) {
|
||||
$this->assertInstanceOf(Point::class, $point);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function itShouldReturnAValidPoint()
|
||||
{
|
||||
$point = $this->client->findDeliveryPoint('077712', 'ES');
|
||||
$this->assertInstanceOf(Point::class, $point);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function itShouldReturnAValidExpedition()
|
||||
{
|
||||
$expedition = $this->client->createExpedition(array(
|
||||
'ModeCol' => 'CCC', /*^(CCC|CDR|CDS|REL)$*/
|
||||
'ModeLiv' => '24R', /*^(LCC|LD1|LDS|24R|24L|24X|ESP|DRI)$*/
|
||||
'NDossier' => '55415',
|
||||
'NClient' => '147014',
|
||||
'Expe_Langage' => 'ES',
|
||||
'Expe_Ad1' => 'Albert',
|
||||
'Expe_Ad2' => '',
|
||||
'Expe_Ad3' => 'Calle Falsa',
|
||||
'Expe_Ad4' => '123',
|
||||
'Expe_Ville' => 'Granollers',
|
||||
'Expe_CP' => '08402',
|
||||
'Expe_Pays' => 'ES',
|
||||
'Expe_Tel1' => '+34666234566',
|
||||
'Expe_Tel2' => '',
|
||||
'Expe_Mail' => 'pepe@test.com',
|
||||
'Dest_Langage' => 'ES',
|
||||
'Dest_Ad1' => 'Client1',
|
||||
'Dest_Ad2' => 'LLIBRERIA CASABELLA',
|
||||
'Dest_Ad3' => 'AV PUIG I CADAFALCH',
|
||||
'Dest_Ad4' => '10',
|
||||
'Dest_Ville' => 'Granollers',
|
||||
'Dest_CP' => '08402',
|
||||
'Dest_Pays' => 'ES',
|
||||
'Dest_Tel1' => '',
|
||||
'Dest_Mail' => 'test@test.com',
|
||||
'Poids' => '123',
|
||||
'Longueur' => '1',
|
||||
'Taille' => 'XL',
|
||||
'NbColis' => '1',
|
||||
'CRT_Valeur' => '1780',
|
||||
'CRT_Devise' => 'EUR',
|
||||
'Exp_Valeur' => '1780',
|
||||
'Exp_Devise' => 'EUR',
|
||||
'COL_Rel_Pays' => 'ES',
|
||||
'COL_Rel' => '0000',
|
||||
'LIV_Rel_Pays' => 'ES',
|
||||
'LIV_Rel' => '053589',
|
||||
'TAvisage' => 'N',
|
||||
'TReprise' => 'N',
|
||||
'Montage' => '0',
|
||||
'TRDV' => 'N',
|
||||
'Instructions' => '0',
|
||||
'Assurance' => ''
|
||||
));
|
||||
$this->assertInstanceOf(Expedition::class, $expedition);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function itShouldReturnAValidTicket()
|
||||
{
|
||||
$ticket = $this->client->generateTickets(array(
|
||||
'Expeditions' => '12345678', /*^[0-9]{8}(;[0-9]{8})*$*/
|
||||
'Langue' => 'ES' /*^[A-Z]{2}$*/
|
||||
));
|
||||
|
||||
$this->assertInstanceOf(Ticket::class, $ticket);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @test
|
||||
*/
|
||||
public function itShouldReturnAnArrayOfValidTickets()
|
||||
{
|
||||
$tickets = $this->client->generateTickets(array(
|
||||
'Expeditions' => '12345678;87654321', /*^[0-9]{8}(;[0-9]{8})*$*/
|
||||
'Langue' => 'ES' /*^[A-Z]{2}$*/
|
||||
));
|
||||
|
||||
foreach ($tickets as $ticket) {
|
||||
$this->assertInstanceOf(Ticket::class, $ticket);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function itShouldReturnAnExceptionInvalidParametersOfTicketsAreSent()
|
||||
{
|
||||
$this->client->generateTickets([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @test
|
||||
* @expectedException \InvalidArgumentException
|
||||
*/
|
||||
public function itShouldReturnAnExceptionInvalidParametersOfExpeditionsAreSent()
|
||||
{
|
||||
$this->client->createExpedition([]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user