{"action":"created","comment":{"url":"https://api.github.com/repos/madewithlove/blog/pulls/comments/40471911","id":40471911,"diff_hunk":"@@ -0,0 +1,40 @@\n+---\n+layout: post\n+title: \"*AwareInterfaces\"\n+date: 2015-09-25\n+author: hannes\n+excerpt: \"Packages often come with a boatload of interfaces and traits. You may not see the purpose of these at first. They do have a use case, though. Let me explain in this post.\"\n+---\n+\n+## *AwareInterfaces\n+\n+Sometimes you see simple interfaces with a getter and a setter for a specific type of object. Some examples are `league/event`'s [`EmitterAwareInterface`](https://github.com/thephpleague/event/blob/master/src/EmitterAwareInterface.php) and `league/container`'s [`ImmutableContainerAwareInterface`](https://github.com/thephpleague/container/blob/master/src/ImmutableContainerAwareInterface.php). Also Zend Framework 2 has a ton of ``*AwareInterface`s like (but not limited to) these:\n+\n+```\n+Zend/Db/Adapter/AdapterAwareInterface.php\n+Zend/EventManager/EventManagerAwareInterface.php\n+Zend/EventManager/SharedEventAggregateAwareInterface.php\n+Zend/Log/LoggerAwareInterface.php\n+```\n+\n+These packages often come with a reusable trait that gives you pluggable implementations for these interfaces out of the box. For previous examples there are the [`EmitterAwareTrait`](https://github.com/thephpleague/event/blob/master/src/EmitterAwareTrait.php) and the [`ImmutableContainerAwareTrait`](https://github.com/thephpleague/container/blob/master/src/ImmutableContainerAwareTrait.php).\n+\n+I find these interfaces useful for setting up an IoC container to automatically \"setter-inject\" a dependency. With Laravel 5.0+'s container one configure this:","path":"_posts/2015-09-25-aware-interfaces.md","position":22,"original_position":22,"commit_id":"49ca56ee01b14f34c171c1797c0c5de74feb820e","original_commit_id":"49ca56ee01b14f34c171c1797c0c5de74feb820e","user":{"login":"hannesvdvreken","id":1410358,"avatar_url":"https://avatars.githubusercontent.com/u/1410358?v=3","gravatar_id":"","url":"https://api.github.com/users/hannesvdvreken","html_url":"https://github.com/hannesvdvreken","followers_url":"https://api.github.com/users/hannesvdvreken/followers","following_url":"https://api.github.com/users/hannesvdvreken/following{/other_user}","gists_url":"https://api.github.com/users/hannesvdvreken/gists{/gist_id}","starred_url":"https://api.github.com/users/hannesvdvreken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannesvdvreken/subscriptions","organizations_url":"https://api.github.com/users/hannesvdvreken/orgs","repos_url":"https://api.github.com/users/hannesvdvreken/repos","events_url":"https://api.github.com/users/hannesvdvreken/events{/privacy}","received_events_url":"https://api.github.com/users/hannesvdvreken/received_events","type":"User","site_admin":false},"body":"Ah yeah, that sentence is broken :p","created_at":"2015-09-25T20:26:27Z","updated_at":"2015-09-25T20:26:27Z","html_url":"https://github.com/madewithlove/blog/pull/47#discussion_r40471911","pull_request_url":"https://api.github.com/repos/madewithlove/blog/pulls/47","_links":{"self":{"href":"https://api.github.com/repos/madewithlove/blog/pulls/comments/40471911"},"html":{"href":"https://github.com/madewithlove/blog/pull/47#discussion_r40471911"},"pull_request":{"href":"https://api.github.com/repos/madewithlove/blog/pulls/47"}}},"pull_request":{"url":"https://api.github.com/repos/madewithlove/blog/pulls/47","id":46017879,"html_url":"https://github.com/madewithlove/blog/pull/47","diff_url":"https://github.com/madewithlove/blog/pull/47.diff","patch_url":"https://github.com/madewithlove/blog/pull/47.patch","issue_url":"https://api.github.com/repos/madewithlove/blog/issues/47","number":47,"state":"open","locked":false,"title":"Explanation on aware interfaces","user":{"login":"hannesvdvreken","id":1410358,"avatar_url":"https://avatars.githubusercontent.com/u/1410358?v=3","gravatar_id":"","url":"https://api.github.com/users/hannesvdvreken","html_url":"https://github.com/hannesvdvreken","followers_url":"https://api.github.com/users/hannesvdvreken/followers","following_url":"https://api.github.com/users/hannesvdvreken/following{/other_user}","gists_url":"https://api.github.com/users/hannesvdvreken/gists{/gist_id}","starred_url":"https://api.github.com/users/hannesvdvreken/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hannesvdvreken/subscriptions","organizations_url":"https://api.github.com/users/hannesvdvreken/orgs","repos_url":"https://api.github.com/users/hannesvdvreken/repos","events_url":"https://api.github.com/users/hannesvdvreken/events{/privacy}","received_events_url":"https://api.github.com/users/hannesvdvreken/received_events","type":"User","site_admin":false},"body":"Subsplit of what I wanted to explain in the abstract-classes-are-an-antipattern blog post.\r\n\r\n@madewithlove/development ","created_at":"2015-09-25T14:28:16Z","updated_at":"2015-09-25T20:26:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c372899eccb65b72bee792d8e230181c0c633206","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/madewithlove/blog/pulls/47/commits","review_comments_url":"https://api.github.com/repos/madewithlove/blog/pulls/47/comments","review_comment_url":"https://api.github.com/repos/madewithlove/blog/pulls/comments{/number}","comments_url":"https://api.github.com/repos/madewithlove/blog/issues/47/comments","statuses_url":"https://api.github.com/repos/madewithlove/blog/statuses/49ca56ee01b14f34c171c1797c0c5de74feb820e","head":{"label":"madewithlove:aware-interfaces","ref":"aware-interfaces","sha":"49ca56ee01b14f34c171c1797c0c5de74feb820e","user":{"login":"madewithlove","id":600038,"avatar_url":"https://avatars.githubusercontent.com/u/600038?v=3","gravatar_id":"","url":"https://api.github.com/users/madewithlove","html_url":"https://github.com/madewithlove","followers_url":"https://api.github.com/users/madewithlove/followers","following_url":"https://api.github.com/users/madewithlove/following{/other_user}","gists_url":"https://api.github.com/users/madewithlove/gists{/gist_id}","starred_url":"https://api.github.com/users/madewithlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madewithlove/subscriptions","organizations_url":"https://api.github.com/users/madewithlove/orgs","repos_url":"https://api.github.com/users/madewithlove/repos","events_url":"https://api.github.com/users/madewithlove/events{/privacy}","received_events_url":"https://api.github.com/users/madewithlove/received_events","type":"Organization","site_admin":false},"repo":{"id":28820310,"name":"blog","full_name":"madewithlove/blog","owner":{"login":"madewithlove","id":600038,"avatar_url":"https://avatars.githubusercontent.com/u/600038?v=3","gravatar_id":"","url":"https://api.github.com/users/madewithlove","html_url":"https://github.com/madewithlove","followers_url":"https://api.github.com/users/madewithlove/followers","following_url":"https://api.github.com/users/madewithlove/following{/other_user}","gists_url":"https://api.github.com/users/madewithlove/gists{/gist_id}","starred_url":"https://api.github.com/users/madewithlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madewithlove/subscriptions","organizations_url":"https://api.github.com/users/madewithlove/orgs","repos_url":"https://api.github.com/users/madewithlove/repos","events_url":"https://api.github.com/users/madewithlove/events{/privacy}","received_events_url":"https://api.github.com/users/madewithlove/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/madewithlove/blog","description":"The madewithlove blog","fork":false,"url":"https://api.github.com/repos/madewithlove/blog","forks_url":"https://api.github.com/repos/madewithlove/blog/forks","keys_url":"https://api.github.com/repos/madewithlove/blog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/madewithlove/blog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/madewithlove/blog/teams","hooks_url":"https://api.github.com/repos/madewithlove/blog/hooks","issue_events_url":"https://api.github.com/repos/madewithlove/blog/issues/events{/number}","events_url":"https://api.github.com/repos/madewithlove/blog/events","assignees_url":"https://api.github.com/repos/madewithlove/blog/assignees{/user}","branches_url":"https://api.github.com/repos/madewithlove/blog/branches{/branch}","tags_url":"https://api.github.com/repos/madewithlove/blog/tags","blobs_url":"https://api.github.com/repos/madewithlove/blog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/madewithlove/blog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/madewithlove/blog/git/refs{/sha}","trees_url":"https://api.github.com/repos/madewithlove/blog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/madewithlove/blog/statuses/{sha}","languages_url":"https://api.github.com/repos/madewithlove/blog/languages","stargazers_url":"https://api.github.com/repos/madewithlove/blog/stargazers","contributors_url":"https://api.github.com/repos/madewithlove/blog/contributors","subscribers_url":"https://api.github.com/repos/madewithlove/blog/subscribers","subscription_url":"https://api.github.com/repos/madewithlove/blog/subscription","commits_url":"https://api.github.com/repos/madewithlove/blog/commits{/sha}","git_commits_url":"https://api.github.com/repos/madewithlove/blog/git/commits{/sha}","comments_url":"https://api.github.com/repos/madewithlove/blog/comments{/number}","issue_comment_url":"https://api.github.com/repos/madewithlove/blog/issues/comments{/number}","contents_url":"https://api.github.com/repos/madewithlove/blog/contents/{+path}","compare_url":"https://api.github.com/repos/madewithlove/blog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/madewithlove/blog/merges","archive_url":"https://api.github.com/repos/madewithlove/blog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/madewithlove/blog/downloads","issues_url":"https://api.github.com/repos/madewithlove/blog/issues{/number}","pulls_url":"https://api.github.com/repos/madewithlove/blog/pulls{/number}","milestones_url":"https://api.github.com/repos/madewithlove/blog/milestones{/number}","notifications_url":"https://api.github.com/repos/madewithlove/blog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/madewithlove/blog/labels{/name}","releases_url":"https://api.github.com/repos/madewithlove/blog/releases{/id}","created_at":"2015-01-05T16:13:23Z","updated_at":"2015-09-25T15:37:44Z","pushed_at":"2015-09-25T14:38:08Z","git_url":"git://github.com/madewithlove/blog.git","ssh_url":"git@github.com:madewithlove/blog.git","clone_url":"https://github.com/madewithlove/blog.git","svn_url":"https://github.com/madewithlove/blog","homepage":null,"size":19036,"stargazers_count":3,"watchers_count":3,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":6,"forks":4,"open_issues":6,"watchers":3,"default_branch":"gh-pages"}},"base":{"label":"madewithlove:gh-pages","ref":"gh-pages","sha":"d6fb712d119d52f260939da0a844a53723e5330b","user":{"login":"madewithlove","id":600038,"avatar_url":"https://avatars.githubusercontent.com/u/600038?v=3","gravatar_id":"","url":"https://api.github.com/users/madewithlove","html_url":"https://github.com/madewithlove","followers_url":"https://api.github.com/users/madewithlove/followers","following_url":"https://api.github.com/users/madewithlove/following{/other_user}","gists_url":"https://api.github.com/users/madewithlove/gists{/gist_id}","starred_url":"https://api.github.com/users/madewithlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madewithlove/subscriptions","organizations_url":"https://api.github.com/users/madewithlove/orgs","repos_url":"https://api.github.com/users/madewithlove/repos","events_url":"https://api.github.com/users/madewithlove/events{/privacy}","received_events_url":"https://api.github.com/users/madewithlove/received_events","type":"Organization","site_admin":false},"repo":{"id":28820310,"name":"blog","full_name":"madewithlove/blog","owner":{"login":"madewithlove","id":600038,"avatar_url":"https://avatars.githubusercontent.com/u/600038?v=3","gravatar_id":"","url":"https://api.github.com/users/madewithlove","html_url":"https://github.com/madewithlove","followers_url":"https://api.github.com/users/madewithlove/followers","following_url":"https://api.github.com/users/madewithlove/following{/other_user}","gists_url":"https://api.github.com/users/madewithlove/gists{/gist_id}","starred_url":"https://api.github.com/users/madewithlove/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/madewithlove/subscriptions","organizations_url":"https://api.github.com/users/madewithlove/orgs","repos_url":"https://api.github.com/users/madewithlove/repos","events_url":"https://api.github.com/users/madewithlove/events{/privacy}","received_events_url":"https://api.github.com/users/madewithlove/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/madewithlove/blog","description":"The madewithlove blog","fork":false,"url":"https://api.github.com/repos/madewithlove/blog","forks_url":"https://api.github.com/repos/madewithlove/blog/forks","keys_url":"https://api.github.com/repos/madewithlove/blog/keys{/key_id}","collaborators_url":"https://api.github.com/repos/madewithlove/blog/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/madewithlove/blog/teams","hooks_url":"https://api.github.com/repos/madewithlove/blog/hooks","issue_events_url":"https://api.github.com/repos/madewithlove/blog/issues/events{/number}","events_url":"https://api.github.com/repos/madewithlove/blog/events","assignees_url":"https://api.github.com/repos/madewithlove/blog/assignees{/user}","branches_url":"https://api.github.com/repos/madewithlove/blog/branches{/branch}","tags_url":"https://api.github.com/repos/madewithlove/blog/tags","blobs_url":"https://api.github.com/repos/madewithlove/blog/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/madewithlove/blog/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/madewithlove/blog/git/refs{/sha}","trees_url":"https://api.github.com/repos/madewithlove/blog/git/trees{/sha}","statuses_url":"https://api.github.com/repos/madewithlove/blog/statuses/{sha}","languages_url":"https://api.github.com/repos/madewithlove/blog/languages","stargazers_url":"https://api.github.com/repos/madewithlove/blog/stargazers","contributors_url":"https://api.github.com/repos/madewithlove/blog/contributors","subscribers_url":"https://api.github.com/repos/madewithlove/blog/subscribers","subscription_url":"https://api.github.com/repos/madewithlove/blog/subscription","commits_url":"https://api.github.com/repos/madewithlove/blog/commits{/sha}","git_commits_url":"https://api.github.com/repos/madewithlove/blog/git/commits{/sha}","comments_url":"https://api.github.com/repos/madewithlove/blog/comments{/number}","issue_comment_url":"https://api.github.com/repos/madewithlove/blog/issues/comments{/number}","contents_url":"https://api.github.com/repos/madewithlove/blog/contents/{+path}","compare_url":"https://api.github.com/repos/madewithlove/blog/compare/{base}...{head}","merges_url":"https://api.github.com/repos/madewithlove/blog/merges","archive_url":"https://api.github.com/repos/madewithlove/blog/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/madewithlove/blog/downloads","issues_url":"https://api.github.com/repos/madewithlove/blog/issues{/number}","pulls_url":"https://api.github.com/repos/madewithlove/blog/pulls{/number}","milestones_url":"https://api.github.com/repos/madewithlove/blog/milestones{/number}","notifications_url":"https://api.github.com/repos/madewithlove/blog/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/madewithlove/blog/labels{/name}","releases_url":"https://api.github.com/repos/madewithlove/blog/releases{/id}","created_at":"2015-01-05T16:13:23Z","updated_at":"2015-09-25T15:37:44Z","pushed_at":"2015-09-25T14:38:08Z","git_url":"git://github.com/madewithlove/blog.git","ssh_url":"git@github.com:madewithlove/blog.git","clone_url":"https://github.com/madewithlove/blog.git","svn_url":"https://github.com/madewithlove/blog","homepage":null,"size":19036,"stargazers_count":3,"watchers_count":3,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":4,"mirror_url":null,"open_issues_count":6,"forks":4,"open_issues":6,"watchers":3,"default_branch":"gh-pages"}},"_links":{"self":{"href":"https://api.github.com/repos/madewithlove/blog/pulls/47"},"html":{"href":"https://github.com/madewithlove/blog/pull/47"},"issue":{"href":"https://api.github.com/repos/madewithlove/blog/issues/47"},"comments":{"href":"https://api.github.com/repos/madewithlove/blog/issues/47/comments"},"review_comments":{"href":"https://api.github.com/repos/madewithlove/blog/pulls/47/comments"},"review_comment":{"href":"https://api.github.com/repos/madewithlove/blog/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/madewithlove/blog/pulls/47/commits"},"statuses":{"href":"https://api.github.com/repos/madewithlove/blog/statuses/49ca56ee01b14f34c171c1797c0c5de74feb820e"}}}}