{"action":"created","issue":{"url":"https://api.github.com/repos/Ocramius/ProxyManager/issues/226","labels_url":"https://api.github.com/repos/Ocramius/ProxyManager/issues/226/labels{/name}","comments_url":"https://api.github.com/repos/Ocramius/ProxyManager/issues/226/comments","events_url":"https://api.github.com/repos/Ocramius/ProxyManager/issues/226/events","html_url":"https://github.com/Ocramius/ProxyManager/issues/226","id":54340041,"number":226,"title":"Avoid duplication on Generators class","user":{"login":"malukenho","id":3275172,"avatar_url":"https://avatars.githubusercontent.com/u/3275172?v=3","gravatar_id":"","url":"https://api.github.com/users/malukenho","html_url":"https://github.com/malukenho","followers_url":"https://api.github.com/users/malukenho/followers","following_url":"https://api.github.com/users/malukenho/following{/other_user}","gists_url":"https://api.github.com/users/malukenho/gists{/gist_id}","starred_url":"https://api.github.com/users/malukenho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malukenho/subscriptions","organizations_url":"https://api.github.com/users/malukenho/orgs","repos_url":"https://api.github.com/users/malukenho/repos","events_url":"https://api.github.com/users/malukenho/events{/privacy}","received_events_url":"https://api.github.com/users/malukenho/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Ocramius/ProxyManager/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"Ocramius","id":154256,"avatar_url":"https://avatars.githubusercontent.com/u/154256?v=3","gravatar_id":"","url":"https://api.github.com/users/Ocramius","html_url":"https://github.com/Ocramius","followers_url":"https://api.github.com/users/Ocramius/followers","following_url":"https://api.github.com/users/Ocramius/following{/other_user}","gists_url":"https://api.github.com/users/Ocramius/gists{/gist_id}","starred_url":"https://api.github.com/users/Ocramius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ocramius/subscriptions","organizations_url":"https://api.github.com/users/Ocramius/orgs","repos_url":"https://api.github.com/users/Ocramius/repos","events_url":"https://api.github.com/users/Ocramius/events{/privacy}","received_events_url":"https://api.github.com/users/Ocramius/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Ocramius/ProxyManager/milestones/17","labels_url":"https://api.github.com/repos/Ocramius/ProxyManager/milestones/17/labels","id":792342,"number":17,"title":"2.0.0","description":"","creator":{"login":"Ocramius","id":154256,"avatar_url":"https://avatars.githubusercontent.com/u/154256?v=3","gravatar_id":"","url":"https://api.github.com/users/Ocramius","html_url":"https://github.com/Ocramius","followers_url":"https://api.github.com/users/Ocramius/followers","following_url":"https://api.github.com/users/Ocramius/following{/other_user}","gists_url":"https://api.github.com/users/Ocramius/gists{/gist_id}","starred_url":"https://api.github.com/users/Ocramius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ocramius/subscriptions","organizations_url":"https://api.github.com/users/Ocramius/orgs","repos_url":"https://api.github.com/users/Ocramius/repos","events_url":"https://api.github.com/users/Ocramius/events{/privacy}","received_events_url":"https://api.github.com/users/Ocramius/received_events","type":"User","site_admin":false},"open_issues":8,"closed_issues":28,"state":"open","created_at":"2014-09-16T22:17:44Z","updated_at":"2015-01-14T16:10:15Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-01-14T16:09:04Z","updated_at":"2015-01-14T16:20:35Z","closed_at":null,"body":"As we know, today we have code duplication in the configuration of classes \"Generators\".\r\n```php\r\n                [\r\n                    $init,\r\n                    new StaticProxyConstructor(\r\n                        $initializer,\r\n                        Properties::fromReflectionClass($originalClass)\r\n                    ),\r\n                    new MagicGet(\r\n                        $originalClass,\r\n                        $initializer,\r\n                        $init,\r\n                        $publicProperties,\r\n                        $protectedProperties,\r\n                        $privateProperties\r\n                    ),\r\n                    new MagicSet(\r\n                        $originalClass,\r\n                        $initializer,\r\n                        $init,\r\n                        $publicProperties,\r\n                        $protectedProperties,\r\n                        $privateProperties\r\n                    ),\r\n                    new MagicIsset(\r\n                        $originalClass,\r\n                        $initializer,\r\n                        $init,\r\n                        $publicProperties,\r\n                        $protectedProperties,\r\n                        $privateProperties\r\n                    ),\r\n                    new MagicUnset(\r\n                        $originalClass,\r\n                        $initializer,\r\n                        $init,\r\n                        $publicProperties,\r\n                        $protectedProperties,\r\n                        $privateProperties\r\n                    ),\r\n                    new MagicClone($originalClass, $initializer, $init, $publicProperties),\r\n                    new MagicSleep($originalClass, $initializer, $init, $publicProperties),\r\n                    new SetProxyInitializer($initializer),\r\n                    new GetProxyInitializer($initializer),\r\n                    new InitializeProxy($initializer, $init),\r\n                    new IsProxyInitialized($initializer),\r\n                ]\r\n```\r\n\r\nI thinking in anything as a factory to generate values by values passed previously as follow example:\r\n```php\r\n$generatorFactory = new GeneratorFactory(\r\n    $originalClass,\r\n    $initializer,\r\n    $init,\r\n    $publicProperties,\r\n    $protectedProperties,\r\n    $privateProperties\r\n);\r\n\r\n$generatorFactory->addType('MagicClone')\r\n    ->addType('MagicSleep')\r\n    ->addType('IsProxyInitialized');\r\n\r\n// Array with objects generated\r\n$methods = $generatorFactory->asArrayList();\r\n```\r\n\r\nping @Ocramius "},"comment":{"url":"https://api.github.com/repos/Ocramius/ProxyManager/issues/comments/69942427","html_url":"https://github.com/Ocramius/ProxyManager/issues/226#issuecomment-69942427","issue_url":"https://api.github.com/repos/Ocramius/ProxyManager/issues/226","id":69942427,"user":{"login":"malukenho","id":3275172,"avatar_url":"https://avatars.githubusercontent.com/u/3275172?v=3","gravatar_id":"","url":"https://api.github.com/users/malukenho","html_url":"https://github.com/malukenho","followers_url":"https://api.github.com/users/malukenho/followers","following_url":"https://api.github.com/users/malukenho/following{/other_user}","gists_url":"https://api.github.com/users/malukenho/gists{/gist_id}","starred_url":"https://api.github.com/users/malukenho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malukenho/subscriptions","organizations_url":"https://api.github.com/users/malukenho/orgs","repos_url":"https://api.github.com/users/malukenho/repos","events_url":"https://api.github.com/users/malukenho/events{/privacy}","received_events_url":"https://api.github.com/users/malukenho/received_events","type":"User","site_admin":false},"created_at":"2015-01-14T16:20:35Z","updated_at":"2015-01-14T16:20:35Z","body":"OK @Ocramius.\r\nBut I thinks Its not avoid the duplication.\r\n\r\n```php\r\n$generatorFactory = new GeneratorContext(\r\n    $originalClass,\r\n    $initializer,\r\n    $init,\r\n    $publicProperties,\r\n    $protectedProperties,\r\n    $privateProperties\r\n);\r\n\r\n// this thing in every generator\r\n[\r\n     $generatorFactory->getMagicClone(),\r\n     $generatorFactory->getMagicSleep(),\r\n     $generatorFactory->getIsProxyInitialized(),\r\n];\r\n```"}}