Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

DiscountCodeNonApplicable error #209

Merged
merged 1 commit into from
May 18, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Error/ApiError.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public function fieldDefinitions()
public static function fromArray(array $data, $context = null)
{
if (isset($data['code'])) {
$className = sprintf('\Commercetools\Core\Error\%sError', self::pascalcase($data['code']));
$className = sprintf('\Commercetools\Core\Error\%sError', self::pascalCase($data['code']));
if (class_exists($className)) {
return new $className($data, $context);
}
}
return new static($data, $context);
}

protected static function pascalcase($name)
protected static function pascalCase($name)
{
return ucfirst(
implode(
Expand Down
21 changes: 21 additions & 0 deletions src/Error/DiscountCodeNonApplicableError.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* @author @jayS-de <jens.schulze@commercetools.de>
*/

namespace Commercetools\Core\Error;

use Commercetools\Core\Model\Common\Attribute;

/**
* @package Commercetools\Core\Error
*
* @method string getCode()
* @method DiscountCodeNonApplicableError setCode(string $code = null)
* @method string getMessage()
* @method DiscountCodeNonApplicableError setMessage(string $message = null)
*/
class DiscountCodeNonApplicableError extends ApiError
{
const CODE = 'DiscountCodeNonApplicable';
}
4 changes: 2 additions & 2 deletions src/Error/InvalidTokenError.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* @package Commercetools\Core\Error
*
* @method string getCode()
* @method AccessDeniedError setCode(string $code = null)
* @method InvalidTokenError setCode(string $code = null)
* @method string getMessage()
* @method AccessDeniedError setMessage(string $message = null)
* @method InvalidTokenError setMessage(string $message = null)
*/
class InvalidTokenError extends ApiError
{
Expand Down