for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Aimeos (aimeos.org), 2017-2018
* @package Client
* @subpackage JsonApi
*/
namespace Aimeos\Client\JsonApi\Basket;
* Base class for JSON API basket clients
*
class Base extends \Aimeos\Client\JsonApi\Base
{
* Clears the basket cache shared between HTML and JSON clients
protected function clearCache()
$session = $this->getContext()->getSession();
foreach( $session->get( 'aimeos/basket/cache', [] ) as $key => $value ) {
$session->set( $key, null );
}
* Translates the plugin error codes to human readable error strings.
* @param array $codes Associative list of scope and object as key and error code as value
* @return array List of translated error messages
protected function translatePluginErrorCodes( array $codes )
$errors = [];
$i18n = $this->getContext()->getI18n();
foreach( $codes as $scope => $list )
foreach( $list as $object => $errcode )
$key = $scope . ( $scope !== 'product' ? '.' . $object : '' ) . '.' . $errcode;
$errors[] = $i18n->dt( 'mshop/code', $key );
return $errors;