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

Commit

Permalink
feat(Type): add type change key action
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Schulze committed Mar 11, 2016
1 parent 72e4bd2 commit 1c2ebf4
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions src/Request/Types/Command/TypeChangeKeyAction.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php
/**
* @author @jayS-de <jens.schulze@commercetools.de>
*/

namespace Commercetools\Core\Request\Types\Command;

use Commercetools\Core\Model\Common\Context;
use Commercetools\Core\Request\AbstractAction;
use Commercetools\Core\Model\Common\LocalizedString;

/**
* @package Commercetools\Core\Request\Types\Command
* @link https://dev.commercetools.com/http-api-projects-types.html#change-key
* @method string getAction()
* @method TypeChangeKeyAction setAction(string $action = null)
* @method string getKey()
* @method TypeChangeKeyAction setKey(string $key = null)
*/
class TypeChangeKeyAction extends AbstractAction
{
public function fieldDefinitions()
{
return [
'action' => [static::TYPE => 'string'],
'key' => [static::TYPE => 'string'],
];
}

/**
* @param array $data
* @param Context|callable $context
*/
public function __construct(array $data = [], $context = null)
{
parent::__construct($data, $context);
$this->setAction('changeKey');
}

/**
* @param string $key
* @param Context|callable $context
* @return TypeChangeKeyAction
*/
public static function ofKey($key, $context = null)
{
return static::of($context)->setKey($key);
}
}

0 comments on commit 1c2ebf4

Please # to comment.