{"action":"created","issue":{"url":"https://api.github.com/repos/hoaproject/Ruler/issues/95","repository_url":"https://api.github.com/repos/hoaproject/Ruler","labels_url":"https://api.github.com/repos/hoaproject/Ruler/issues/95/labels{/name}","comments_url":"https://api.github.com/repos/hoaproject/Ruler/issues/95/comments","events_url":"https://api.github.com/repos/hoaproject/Ruler/issues/95/events","html_url":"https://github.com/hoaproject/Ruler/pull/95","id":176959821,"number":95,"title":"Produce results in response of rule evaluations","user":{"login":"jubianchi","id":327237,"avatar_url":"https://avatars.githubusercontent.com/u/327237?v=3","gravatar_id":"","url":"https://api.github.com/users/jubianchi","html_url":"https://github.com/jubianchi","followers_url":"https://api.github.com/users/jubianchi/followers","following_url":"https://api.github.com/users/jubianchi/following{/other_user}","gists_url":"https://api.github.com/users/jubianchi/gists{/gist_id}","starred_url":"https://api.github.com/users/jubianchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jubianchi/subscriptions","organizations_url":"https://api.github.com/users/jubianchi/orgs","repos_url":"https://api.github.com/users/jubianchi/repos","events_url":"https://api.github.com/users/jubianchi/events{/privacy}","received_events_url":"https://api.github.com/users/jubianchi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hoaproject/Ruler/labels/difficulty:%20hard","name":"difficulty: hard","color":"DE264C"},{"url":"https://api.github.com/repos/hoaproject/Ruler/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/hoaproject/Ruler/labels/in%20progress","name":"in progress","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"Hywan","id":946104,"avatar_url":"https://avatars.githubusercontent.com/u/946104?v=3","gravatar_id":"","url":"https://api.github.com/users/Hywan","html_url":"https://github.com/Hywan","followers_url":"https://api.github.com/users/Hywan/followers","following_url":"https://api.github.com/users/Hywan/following{/other_user}","gists_url":"https://api.github.com/users/Hywan/gists{/gist_id}","starred_url":"https://api.github.com/users/Hywan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hywan/subscriptions","organizations_url":"https://api.github.com/users/Hywan/orgs","repos_url":"https://api.github.com/users/Hywan/repos","events_url":"https://api.github.com/users/Hywan/events{/privacy}","received_events_url":"https://api.github.com/users/Hywan/received_events","type":"User","site_admin":false},"assignees":[{"login":"Hywan","id":946104,"avatar_url":"https://avatars.githubusercontent.com/u/946104?v=3","gravatar_id":"","url":"https://api.github.com/users/Hywan","html_url":"https://github.com/Hywan","followers_url":"https://api.github.com/users/Hywan/followers","following_url":"https://api.github.com/users/Hywan/following{/other_user}","gists_url":"https://api.github.com/users/Hywan/gists{/gist_id}","starred_url":"https://api.github.com/users/Hywan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hywan/subscriptions","organizations_url":"https://api.github.com/users/Hywan/orgs","repos_url":"https://api.github.com/users/Hywan/repos","events_url":"https://api.github.com/users/Hywan/events{/privacy}","received_events_url":"https://api.github.com/users/Hywan/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-09-14T16:45:57Z","updated_at":"2016-10-14T06:27:36Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/hoaproject/Ruler/pulls/95","html_url":"https://github.com/hoaproject/Ruler/pull/95","diff_url":"https://github.com/hoaproject/Ruler/pull/95.diff","patch_url":"https://github.com/hoaproject/Ruler/pull/95.patch"},"body":"See #94 for detailed information.\r\n\r\nTodo:\r\n\r\n* [x] Implement the `Rules` collection with an `SplPriorityQueue`\r\n* [ ] Use the `hoa/heap` library for the `Rules` collection\r\n* [x] Implement the `Then` rule class (it returns a result when the rule validates the input)\r\n* [x] Implement the `ThenElse` rule class (it returns a result when the rule validates the input and another when the rule does not validate the input)\r\n* [ ] Implement an algorithm to resolve rules dependencies (indeed, a rule can depend on another one). `hoa/graph` could be a good candidate for this kind of work.\r\n* [x] Implement a `rule()` function to reference the result of one rule from another rule\r\n\r\nSome notes about the technical choices:\r\n\r\n* I used some `clone`s in the code: this is to guarantee immutability of the passed objects. For example the `Hoa\\Ruler\\Rules::initializeRuler()` may alter the ruler's asserter. Before doing this, we clone the ruler and then alter its content. Finally we return it to be used where needed.\r\n* I introduced a `Hoa\\Ruler\\Result` class (with a magic method: this will change). It also does a `clone` of the result in some cases: this is to avoid mutating the value returned by the rules.\r\n* This class (`Hoa\\Ruler\\Result`) is also here to return a structured result letting developers keep track of the returned value, the rule that produced it and its name in the collection"},"comment":{"url":"https://api.github.com/repos/hoaproject/Ruler/issues/comments/253719988","html_url":"https://github.com/hoaproject/Ruler/pull/95#issuecomment-253719988","issue_url":"https://api.github.com/repos/hoaproject/Ruler/issues/95","id":253719988,"user":{"login":"Hywan","id":946104,"avatar_url":"https://avatars.githubusercontent.com/u/946104?v=3","gravatar_id":"","url":"https://api.github.com/users/Hywan","html_url":"https://github.com/Hywan","followers_url":"https://api.github.com/users/Hywan/followers","following_url":"https://api.github.com/users/Hywan/following{/other_user}","gists_url":"https://api.github.com/users/Hywan/gists{/gist_id}","starred_url":"https://api.github.com/users/Hywan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Hywan/subscriptions","organizations_url":"https://api.github.com/users/Hywan/orgs","repos_url":"https://api.github.com/users/Hywan/repos","events_url":"https://api.github.com/users/Hywan/events{/privacy}","received_events_url":"https://api.github.com/users/Hywan/received_events","type":"User","site_admin":false},"created_at":"2016-10-14T06:27:36Z","updated_at":"2016-10-14T06:27:36Z","body":"ping?"}}
{"actor":{"display_login":"Hywan"}}