{"action":"created","comment":{"url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/comments/37280918","id":37280918,"diff_hunk":"@@ -0,0 +1,163 @@\n+<?php\n+namespace Pangaea\\Attribute;\n+\n+use \\Pangaea\\Date;\n+use \\Pangaea\\PangaeaException;\n+use \\Pangaea\\Xml;\n+use \\Pangaea\\Attribute\\AttributeInterface;\n+\n+class NameValueAttribute implements AttributeInterface\n+{\n+    /**\n+     * The attribute name.\n+     *\n+     * @var mixed\n+     */\n+    private $name;\n+\n+    /**\n+     * The attribute type.\n+     *\n+     * @var mixed\n+     */\n+    private $type;\n+\n+    /**\n+     * The attribute value.\n+     *\n+     * @var array\n+     */\n+    private $value = [];\n+\n+    /**\n+     * Create a basic NameValueAttribute.\n+     *\n+     * @param $name\n+     * @param mixed $values\n+     */\n+    public function __construct($name, $value = null)\n+    {\n+        $this->setName($name);\n+        $this->setValue($value);\n+    }\n+\n+    /**\n+     * Set the name\n+     *\n+     * @param $name\n+     * @throw \\Pangaea\\PangaeaException\n+     */\n+    public function setName($name)\n+    {\n+        if (mb_strlen($name) === 0) {\n+            throw new PangaeaException(get_class($this) . ' element \"name\" cannot be empty');\n+        }\n+\n+        $this->name = $name;\n+    }\n+\n+    /**\n+     * Get the name.\n+     *\n+     * @return mixed\n+     */\n+    public function getName()\n+    {\n+        return $this->name;\n+    }\n+\n+    /**\n+     * Set the attribute value (and infer the type automatically).\n+     *\n+     * @param $value\n+     */\n+    public function setValue($values)","path":"src/Attribute/NameValueAttribute.php","position":74,"original_position":74,"commit_id":"26acd5379acd4ac3c67b2abac5cd1879beb43a2c","original_commit_id":"26acd5379acd4ac3c67b2abac5cd1879beb43a2c","user":{"login":"gabriel403","id":118638,"avatar_url":"https://avatars.githubusercontent.com/u/118638?v=3","gravatar_id":"","url":"https://api.github.com/users/gabriel403","html_url":"https://github.com/gabriel403","followers_url":"https://api.github.com/users/gabriel403/followers","following_url":"https://api.github.com/users/gabriel403/following{/other_user}","gists_url":"https://api.github.com/users/gabriel403/gists{/gist_id}","starred_url":"https://api.github.com/users/gabriel403/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gabriel403/subscriptions","organizations_url":"https://api.github.com/users/gabriel403/orgs","repos_url":"https://api.github.com/users/gabriel403/repos","events_url":"https://api.github.com/users/gabriel403/events{/privacy}","received_events_url":"https://api.github.com/users/gabriel403/received_events","type":"User","site_admin":false},"body":"perhaps `setValue` and `setValues` ?","created_at":"2015-08-18T09:41:14Z","updated_at":"2015-08-18T09:41:14Z","html_url":"https://github.com/fusionspim/pangaea-php-sdk/pull/17#discussion_r37280918","pull_request_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/17","_links":{"self":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/comments/37280918"},"html":{"href":"https://github.com/fusionspim/pangaea-php-sdk/pull/17#discussion_r37280918"},"pull_request":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/17"}}},"pull_request":{"url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/17","id":42146467,"html_url":"https://github.com/fusionspim/pangaea-php-sdk/pull/17","diff_url":"https://github.com/fusionspim/pangaea-php-sdk/pull/17.diff","patch_url":"https://github.com/fusionspim/pangaea-php-sdk/pull/17.patch","issue_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues/17","number":17,"state":"open","locked":false,"title":"Add support for base variants (VariantMetaData)","user":{"login":"ziadoz","id":645637,"avatar_url":"https://avatars.githubusercontent.com/u/645637?v=3","gravatar_id":"","url":"https://api.github.com/users/ziadoz","html_url":"https://github.com/ziadoz","followers_url":"https://api.github.com/users/ziadoz/followers","following_url":"https://api.github.com/users/ziadoz/following{/other_user}","gists_url":"https://api.github.com/users/ziadoz/gists{/gist_id}","starred_url":"https://api.github.com/users/ziadoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ziadoz/subscriptions","organizations_url":"https://api.github.com/users/ziadoz/orgs","repos_url":"https://api.github.com/users/ziadoz/repos","events_url":"https://api.github.com/users/ziadoz/events{/privacy}","received_events_url":"https://api.github.com/users/ziadoz/received_events","type":"User","site_admin":false},"body":"Implements the ability to add variant meta data to an item. I've also done some refactoring to make sense of things and added some more tests: \r\n\r\n- Added new `VariantMetaDataAttribute` class which implements the new base variant attribute XML.\r\n- Moved `determineAttributeType()` into `Xml::attributeType()` so it can be re-used across attribute classes.\r\n- Added unit tests for `Xml::escape()` and `Xml::attributeType()`.\r\n- Update the `Item` unit test with multiple variations, plus colours and sizes.\r\n- Added the ability to set the `productSetupType` and `variantGroupID` elements for an item.\r\n- Refactored various attributes into `NameValueAttribute`.\r\n- Added an attribute inferface class `AttributeInterface`.\r\n- Refactored `$item->addAttributes()` to use new attribute classes underneath (arrays still work for backwards compatibility, they just get converted).\r\n- Moved unit test fixture loading into a trait.","created_at":"2015-08-11T16:04:15Z","updated_at":"2015-08-18T09:41:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0e61f515a648614f1968aa795c562c1a3c7cf1f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/17/commits","review_comments_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/17/comments","review_comment_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues/17/comments","statuses_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/statuses/26acd5379acd4ac3c67b2abac5cd1879beb43a2c","head":{"label":"fusionspim:feature/base-variants","ref":"feature/base-variants","sha":"26acd5379acd4ac3c67b2abac5cd1879beb43a2c","user":{"login":"fusionspim","id":7167094,"avatar_url":"https://avatars.githubusercontent.com/u/7167094?v=3","gravatar_id":"","url":"https://api.github.com/users/fusionspim","html_url":"https://github.com/fusionspim","followers_url":"https://api.github.com/users/fusionspim/followers","following_url":"https://api.github.com/users/fusionspim/following{/other_user}","gists_url":"https://api.github.com/users/fusionspim/gists{/gist_id}","starred_url":"https://api.github.com/users/fusionspim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fusionspim/subscriptions","organizations_url":"https://api.github.com/users/fusionspim/orgs","repos_url":"https://api.github.com/users/fusionspim/repos","events_url":"https://api.github.com/users/fusionspim/events{/privacy}","received_events_url":"https://api.github.com/users/fusionspim/received_events","type":"Organization","site_admin":false},"repo":{"id":38920545,"name":"pangaea-php-sdk","full_name":"fusionspim/pangaea-php-sdk","owner":{"login":"fusionspim","id":7167094,"avatar_url":"https://avatars.githubusercontent.com/u/7167094?v=3","gravatar_id":"","url":"https://api.github.com/users/fusionspim","html_url":"https://github.com/fusionspim","followers_url":"https://api.github.com/users/fusionspim/followers","following_url":"https://api.github.com/users/fusionspim/following{/other_user}","gists_url":"https://api.github.com/users/fusionspim/gists{/gist_id}","starred_url":"https://api.github.com/users/fusionspim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fusionspim/subscriptions","organizations_url":"https://api.github.com/users/fusionspim/orgs","repos_url":"https://api.github.com/users/fusionspim/repos","events_url":"https://api.github.com/users/fusionspim/events{/privacy}","received_events_url":"https://api.github.com/users/fusionspim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fusionspim/pangaea-php-sdk","description":"PHP library for working with Pangaea XML/JSON files","fork":false,"url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk","forks_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/forks","keys_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/teams","hooks_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/hooks","issue_events_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/events","assignees_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/tags","blobs_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/languages","stargazers_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/stargazers","contributors_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/contributors","subscribers_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/subscribers","subscription_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/subscription","commits_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/merges","archive_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/downloads","issues_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/labels{/name}","releases_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/releases{/id}","created_at":"2015-07-11T09:16:37Z","updated_at":"2015-07-12T20:09:50Z","pushed_at":"2015-08-17T17:54:42Z","git_url":"git://github.com/fusionspim/pangaea-php-sdk.git","ssh_url":"git@github.com:fusionspim/pangaea-php-sdk.git","clone_url":"https://github.com/fusionspim/pangaea-php-sdk.git","svn_url":"https://github.com/fusionspim/pangaea-php-sdk","homepage":"","size":610,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"fusionspim:master","ref":"master","sha":"0f38593bcaccde9450bc7a4bf27c7cac558f9846","user":{"login":"fusionspim","id":7167094,"avatar_url":"https://avatars.githubusercontent.com/u/7167094?v=3","gravatar_id":"","url":"https://api.github.com/users/fusionspim","html_url":"https://github.com/fusionspim","followers_url":"https://api.github.com/users/fusionspim/followers","following_url":"https://api.github.com/users/fusionspim/following{/other_user}","gists_url":"https://api.github.com/users/fusionspim/gists{/gist_id}","starred_url":"https://api.github.com/users/fusionspim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fusionspim/subscriptions","organizations_url":"https://api.github.com/users/fusionspim/orgs","repos_url":"https://api.github.com/users/fusionspim/repos","events_url":"https://api.github.com/users/fusionspim/events{/privacy}","received_events_url":"https://api.github.com/users/fusionspim/received_events","type":"Organization","site_admin":false},"repo":{"id":38920545,"name":"pangaea-php-sdk","full_name":"fusionspim/pangaea-php-sdk","owner":{"login":"fusionspim","id":7167094,"avatar_url":"https://avatars.githubusercontent.com/u/7167094?v=3","gravatar_id":"","url":"https://api.github.com/users/fusionspim","html_url":"https://github.com/fusionspim","followers_url":"https://api.github.com/users/fusionspim/followers","following_url":"https://api.github.com/users/fusionspim/following{/other_user}","gists_url":"https://api.github.com/users/fusionspim/gists{/gist_id}","starred_url":"https://api.github.com/users/fusionspim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fusionspim/subscriptions","organizations_url":"https://api.github.com/users/fusionspim/orgs","repos_url":"https://api.github.com/users/fusionspim/repos","events_url":"https://api.github.com/users/fusionspim/events{/privacy}","received_events_url":"https://api.github.com/users/fusionspim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fusionspim/pangaea-php-sdk","description":"PHP library for working with Pangaea XML/JSON files","fork":false,"url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk","forks_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/forks","keys_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/teams","hooks_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/hooks","issue_events_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues/events{/number}","events_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/events","assignees_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/assignees{/user}","branches_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/branches{/branch}","tags_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/tags","blobs_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/refs{/sha}","trees_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/statuses/{sha}","languages_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/languages","stargazers_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/stargazers","contributors_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/contributors","subscribers_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/subscribers","subscription_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/subscription","commits_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/commits{/sha}","git_commits_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/git/commits{/sha}","comments_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/comments{/number}","issue_comment_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues/comments{/number}","contents_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/contents/{+path}","compare_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/merges","archive_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/downloads","issues_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues{/number}","pulls_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls{/number}","milestones_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/milestones{/number}","notifications_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/labels{/name}","releases_url":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/releases{/id}","created_at":"2015-07-11T09:16:37Z","updated_at":"2015-07-12T20:09:50Z","pushed_at":"2015-08-17T17:54:42Z","git_url":"git://github.com/fusionspim/pangaea-php-sdk.git","ssh_url":"git@github.com:fusionspim/pangaea-php-sdk.git","clone_url":"https://github.com/fusionspim/pangaea-php-sdk.git","svn_url":"https://github.com/fusionspim/pangaea-php-sdk","homepage":"","size":610,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/17"},"html":{"href":"https://github.com/fusionspim/pangaea-php-sdk/pull/17"},"issue":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues/17"},"comments":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/issues/17/comments"},"review_comments":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/17/comments"},"review_comment":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/pulls/17/commits"},"statuses":{"href":"https://api.github.com/repos/fusionspim/pangaea-php-sdk/statuses/26acd5379acd4ac3c67b2abac5cd1879beb43a2c"}}}}