{"action":"created","comment":{"url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/comments/45589254","id":45589254,"diff_hunk":"@@ -0,0 +1,108 @@\n+<?php\n+\n+namespace TijsVerkoyen\\CssToInlineStyles\\Css\\Property;\n+\n+class Processor\n+{\n+    /**\n+     * Split a string into seperate properties\n+     *\n+     * @param string $propertiesString\n+     * @return array\n+     */\n+    public function splitIntoSeparateProperties($propertiesString)\n+    {\n+        $propertiesString = $this->cleanup($propertiesString);\n+\n+        $properties = (array) explode(';', $propertiesString);\n+        $keysToRemove = array();\n+        $numberOfProperties = count($properties);\n+\n+        for ($i = 0; $i < $numberOfProperties; $i++) {\n+            $properties[$i] = trim($properties[$i]);\n+\n+            // if the new property begins with base64 it is part of the current property\n+            if (isset($properties[$i + 1]) && strpos(trim($properties[$i + 1]), 'base64,') === 0) {\n+                $properties[$i] .= ';' . trim($properties[$i + 1]);\n+                $keysToRemove[] = $i + 1;\n+            }\n+        }\n+\n+        if (!empty($keysToRemove)) {\n+            foreach ($keysToRemove as $key) {\n+                unset($properties[$key]);\n+            }\n+        }\n+\n+        return array_values($properties);\n+    }\n+\n+    /**\n+     * @param $string\n+     * @return mixed|string\n+     */\n+    protected function cleanup($string)\n+    {\n+        $string = str_replace(array(\"\\r\", \"\\n\"), '', $string);\n+        $string = str_replace(array(\"\\t\"), ' ', $string);\n+        $string = str_replace('\"', '\\'', $string);\n+        $string = preg_replace('|/\\*.*?\\*/|', '', $string);\n+        $string = preg_replace('/\\s\\s+/', ' ', $string);\n+\n+        $string = trim($string);\n+        $string = rtrim($string, ';');\n+\n+        return $string;\n+    }\n+\n+    /**\n+     * Convert a property-string into an object\n+     *\n+     * @param string $property\n+     * @return Property|null\n+     */\n+    public function convertToObject($property)\n+    {\n+        $chunks = (array) explode(':', $property, 2);\n+\n+        if (!isset($chunks[1]) || $chunks[1] == '') {\n+            return null;\n+        }\n+\n+        return new Property(trim($chunks[0]), trim($chunks[1]));\n+    }\n+\n+    /**\n+     * Convert an array of property-strings into objects\n+     *\n+     * @param array $properties\n+     * @return array\n+     */\n+    public function convertArrayToObjects(array $properties)\n+    {\n+        $objects = array();\n+\n+        foreach ($properties as $property) {\n+            $objects[] = $this->convertToObject($property);","path":"src/Css/Property/Processor.php","position":null,"original_position":86,"commit_id":"b3834407de6be247fe23f22a8f40a188d547afaa","original_commit_id":"4e7c36c20f96fcfd62d69f46ce6e567b4b65681d","user":{"login":"tijsverkoyen","id":250042,"avatar_url":"https://avatars.githubusercontent.com/u/250042?v=3","gravatar_id":"","url":"https://api.github.com/users/tijsverkoyen","html_url":"https://github.com/tijsverkoyen","followers_url":"https://api.github.com/users/tijsverkoyen/followers","following_url":"https://api.github.com/users/tijsverkoyen/following{/other_user}","gists_url":"https://api.github.com/users/tijsverkoyen/gists{/gist_id}","starred_url":"https://api.github.com/users/tijsverkoyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tijsverkoyen/subscriptions","organizations_url":"https://api.github.com/users/tijsverkoyen/orgs","repos_url":"https://api.github.com/users/tijsverkoyen/repos","events_url":"https://api.github.com/users/tijsverkoyen/events{/privacy}","received_events_url":"https://api.github.com/users/tijsverkoyen/received_events","type":"User","site_admin":false},"body":"fixed in d1452b451fcc1258ca0ed1b3dad72337787db646","created_at":"2015-11-23T10:38:55Z","updated_at":"2015-11-23T10:38:55Z","html_url":"https://github.com/tijsverkoyen/CssToInlineStyles/pull/111#discussion_r45589254","pull_request_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/111","_links":{"self":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/comments/45589254"},"html":{"href":"https://github.com/tijsverkoyen/CssToInlineStyles/pull/111#discussion_r45589254"},"pull_request":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/111"}}},"pull_request":{"url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/111","id":51377274,"html_url":"https://github.com/tijsverkoyen/CssToInlineStyles/pull/111","diff_url":"https://github.com/tijsverkoyen/CssToInlineStyles/pull/111.diff","patch_url":"https://github.com/tijsverkoyen/CssToInlineStyles/pull/111.patch","issue_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues/111","number":111,"state":"open","locked":false,"title":"2.0 (WIP)","user":{"login":"tijsverkoyen","id":250042,"avatar_url":"https://avatars.githubusercontent.com/u/250042?v=3","gravatar_id":"","url":"https://api.github.com/users/tijsverkoyen","html_url":"https://github.com/tijsverkoyen","followers_url":"https://api.github.com/users/tijsverkoyen/followers","following_url":"https://api.github.com/users/tijsverkoyen/following{/other_user}","gists_url":"https://api.github.com/users/tijsverkoyen/gists{/gist_id}","starred_url":"https://api.github.com/users/tijsverkoyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tijsverkoyen/subscriptions","organizations_url":"https://api.github.com/users/tijsverkoyen/orgs","repos_url":"https://api.github.com/users/tijsverkoyen/repos","events_url":"https://api.github.com/users/tijsverkoyen/events{/privacy}","received_events_url":"https://api.github.com/users/tijsverkoyen/received_events","type":"User","site_admin":false},"body":"The 2.0 version is a major overhaul, which is *not* backwards compatible.\r\n\r\n* From now on you can re-use the class for multiple mails.\r\n* A lot less complicated options, as in: no more options at all.\r\n* More separate classes which handle their own (tested) methods.\r\n* A lot more tests\r\n\r\nThe reason why I did this was to make the class more usable.","created_at":"2015-11-20T16:29:27Z","updated_at":"2015-11-23T10:38:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":"696907391c4b0e50a3fefbd1aa154d62aa0358e6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/111/commits","review_comments_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/111/comments","review_comment_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues/111/comments","statuses_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/statuses/b3834407de6be247fe23f22a8f40a188d547afaa","head":{"label":"tijsverkoyen:2.0","ref":"2.0","sha":"b3834407de6be247fe23f22a8f40a188d547afaa","user":{"login":"tijsverkoyen","id":250042,"avatar_url":"https://avatars.githubusercontent.com/u/250042?v=3","gravatar_id":"","url":"https://api.github.com/users/tijsverkoyen","html_url":"https://github.com/tijsverkoyen","followers_url":"https://api.github.com/users/tijsverkoyen/followers","following_url":"https://api.github.com/users/tijsverkoyen/following{/other_user}","gists_url":"https://api.github.com/users/tijsverkoyen/gists{/gist_id}","starred_url":"https://api.github.com/users/tijsverkoyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tijsverkoyen/subscriptions","organizations_url":"https://api.github.com/users/tijsverkoyen/orgs","repos_url":"https://api.github.com/users/tijsverkoyen/repos","events_url":"https://api.github.com/users/tijsverkoyen/events{/privacy}","received_events_url":"https://api.github.com/users/tijsverkoyen/received_events","type":"User","site_admin":false},"repo":{"id":1023607,"name":"CssToInlineStyles","full_name":"tijsverkoyen/CssToInlineStyles","owner":{"login":"tijsverkoyen","id":250042,"avatar_url":"https://avatars.githubusercontent.com/u/250042?v=3","gravatar_id":"","url":"https://api.github.com/users/tijsverkoyen","html_url":"https://github.com/tijsverkoyen","followers_url":"https://api.github.com/users/tijsverkoyen/followers","following_url":"https://api.github.com/users/tijsverkoyen/following{/other_user}","gists_url":"https://api.github.com/users/tijsverkoyen/gists{/gist_id}","starred_url":"https://api.github.com/users/tijsverkoyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tijsverkoyen/subscriptions","organizations_url":"https://api.github.com/users/tijsverkoyen/orgs","repos_url":"https://api.github.com/users/tijsverkoyen/repos","events_url":"https://api.github.com/users/tijsverkoyen/events{/privacy}","received_events_url":"https://api.github.com/users/tijsverkoyen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tijsverkoyen/CssToInlineStyles","description":"CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.","fork":false,"url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles","forks_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/forks","keys_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/teams","hooks_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/hooks","issue_events_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues/events{/number}","events_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/events","assignees_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/assignees{/user}","branches_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/branches{/branch}","tags_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/tags","blobs_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/refs{/sha}","trees_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/statuses/{sha}","languages_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/languages","stargazers_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/stargazers","contributors_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/contributors","subscribers_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/subscribers","subscription_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/subscription","commits_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/commits{/sha}","git_commits_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/commits{/sha}","comments_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/comments{/number}","issue_comment_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues/comments{/number}","contents_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/contents/{+path}","compare_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/merges","archive_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/downloads","issues_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues{/number}","pulls_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls{/number}","milestones_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/milestones{/number}","notifications_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/labels{/name}","releases_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/releases{/id}","created_at":"2010-10-25T21:12:37Z","updated_at":"2015-11-22T22:29:59Z","pushed_at":"2015-11-23T10:29:05Z","git_url":"git://github.com/tijsverkoyen/CssToInlineStyles.git","ssh_url":"git@github.com:tijsverkoyen/CssToInlineStyles.git","clone_url":"https://github.com/tijsverkoyen/CssToInlineStyles.git","svn_url":"https://github.com/tijsverkoyen/CssToInlineStyles","homepage":"","size":211,"stargazers_count":501,"watchers_count":501,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":86,"mirror_url":null,"open_issues_count":6,"forks":86,"open_issues":6,"watchers":501,"default_branch":"master"}},"base":{"label":"tijsverkoyen:master","ref":"master","sha":"18be24f6f40d8af9134089916014bc543465ddb2","user":{"login":"tijsverkoyen","id":250042,"avatar_url":"https://avatars.githubusercontent.com/u/250042?v=3","gravatar_id":"","url":"https://api.github.com/users/tijsverkoyen","html_url":"https://github.com/tijsverkoyen","followers_url":"https://api.github.com/users/tijsverkoyen/followers","following_url":"https://api.github.com/users/tijsverkoyen/following{/other_user}","gists_url":"https://api.github.com/users/tijsverkoyen/gists{/gist_id}","starred_url":"https://api.github.com/users/tijsverkoyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tijsverkoyen/subscriptions","organizations_url":"https://api.github.com/users/tijsverkoyen/orgs","repos_url":"https://api.github.com/users/tijsverkoyen/repos","events_url":"https://api.github.com/users/tijsverkoyen/events{/privacy}","received_events_url":"https://api.github.com/users/tijsverkoyen/received_events","type":"User","site_admin":false},"repo":{"id":1023607,"name":"CssToInlineStyles","full_name":"tijsverkoyen/CssToInlineStyles","owner":{"login":"tijsverkoyen","id":250042,"avatar_url":"https://avatars.githubusercontent.com/u/250042?v=3","gravatar_id":"","url":"https://api.github.com/users/tijsverkoyen","html_url":"https://github.com/tijsverkoyen","followers_url":"https://api.github.com/users/tijsverkoyen/followers","following_url":"https://api.github.com/users/tijsverkoyen/following{/other_user}","gists_url":"https://api.github.com/users/tijsverkoyen/gists{/gist_id}","starred_url":"https://api.github.com/users/tijsverkoyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tijsverkoyen/subscriptions","organizations_url":"https://api.github.com/users/tijsverkoyen/orgs","repos_url":"https://api.github.com/users/tijsverkoyen/repos","events_url":"https://api.github.com/users/tijsverkoyen/events{/privacy}","received_events_url":"https://api.github.com/users/tijsverkoyen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tijsverkoyen/CssToInlineStyles","description":"CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.","fork":false,"url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles","forks_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/forks","keys_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/teams","hooks_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/hooks","issue_events_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues/events{/number}","events_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/events","assignees_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/assignees{/user}","branches_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/branches{/branch}","tags_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/tags","blobs_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/refs{/sha}","trees_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/statuses/{sha}","languages_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/languages","stargazers_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/stargazers","contributors_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/contributors","subscribers_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/subscribers","subscription_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/subscription","commits_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/commits{/sha}","git_commits_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/git/commits{/sha}","comments_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/comments{/number}","issue_comment_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues/comments{/number}","contents_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/contents/{+path}","compare_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/merges","archive_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/downloads","issues_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues{/number}","pulls_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls{/number}","milestones_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/milestones{/number}","notifications_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/labels{/name}","releases_url":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/releases{/id}","created_at":"2010-10-25T21:12:37Z","updated_at":"2015-11-22T22:29:59Z","pushed_at":"2015-11-23T10:29:05Z","git_url":"git://github.com/tijsverkoyen/CssToInlineStyles.git","ssh_url":"git@github.com:tijsverkoyen/CssToInlineStyles.git","clone_url":"https://github.com/tijsverkoyen/CssToInlineStyles.git","svn_url":"https://github.com/tijsverkoyen/CssToInlineStyles","homepage":"","size":211,"stargazers_count":501,"watchers_count":501,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":86,"mirror_url":null,"open_issues_count":6,"forks":86,"open_issues":6,"watchers":501,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/111"},"html":{"href":"https://github.com/tijsverkoyen/CssToInlineStyles/pull/111"},"issue":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues/111"},"comments":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/issues/111/comments"},"review_comments":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/111/comments"},"review_comment":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/pulls/111/commits"},"statuses":{"href":"https://api.github.com/repos/tijsverkoyen/CssToInlineStyles/statuses/b3834407de6be247fe23f22a8f40a188d547afaa"}}}}