{"id":16824985,"url":"https://github.com/tomnomnom/flatclass","last_synced_at":"2025-07-22T12:35:46.567Z","repository":{"id":141703363,"uuid":"45427329","full_name":"tomnomnom/flatclass","owner":"tomnomnom","description":"Flatten deep inheritance trees in PHP to aid debugging","archived":false,"fork":false,"pushed_at":"2015-11-08T13:40:39.000Z","size":136,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-24T09:08:22.126Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tomnomnom.png","metadata":{"files":{"readme":"README.mkd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-02T22:51:29.000Z","updated_at":"2021-11-16T22:28:37.000Z","dependencies_parsed_at":"2023-03-16T19:46:27.883Z","dependency_job_id":null,"html_url":"https://github.com/tomnomnom/flatclass","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fflatclass","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fflatclass/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fflatclass/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomnomnom%2Fflatclass/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomnomnom","download_url":"https://codeload.github.com/tomnomnom/flatclass/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244135897,"owners_count":20403797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T11:12:35.989Z","updated_at":"2025-03-18T00:47:23.943Z","avatar_url":"https://github.com/tomnomnom.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flatclass\n\nGiven an object or class name, the `Flatterer` returns a 'flattened' version of a class;\ni.e. with non-overridden methods and properties from parent classes copied into it.\n\nFor example, the following code:\n\n```php\n\u003c?php\nrequire __DIR__.'/vendor/autoload.php';\n\ninterface Nameable {\n    public function getName();\n}\n\nclass Animal implements Nameable {\n    protected $name;\n    public function __construct($name){\n        $this-\u003ename = $name;\n    }\n    public function getName(){\n        return $this-\u003ename;\n    }\n}\n\nclass Dog extends Animal {\n    public function bark(){\n        return \"Woof!\";\n    }\n}\n\n$f = new \\Flatclass\\Flatterer('Dog');\necho $f-\u003eflatten('FlatDog');\n```\n\nWould produce a `FlatDog` class that looked like this:\n\n```php\n\u003c?php\nclass FlatDog extends \\Animal implements \\Nameable {\n\n    protected $name;\n\n    // From class Dog\n    public function bark(){\n        return \"Woof!\";\n    }\n\n    // From class Animal\n    public function __construct($name){\n        $this-\u003ename = $name;\n    }\n\n    // From class Animal\n    public function getName(){\n        return $this-\u003ename;\n    }\n\n}\n```\n\n## Why?\n\nThis is meant as a debugging tool. With very deep inheritance hierarchies it can be difficult to\nmentally follow code execution paths that jump back and forth between several files.\n\nWhile the generated class is not guaranteed to function in the same way as the original, some efforts\nare made to make it more likely; e.g. the resulting class has the same parent as the original to\nallow `parent::method()` calls to work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomnomnom%2Fflatclass","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomnomnom%2Fflatclass","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomnomnom%2Fflatclass/lists"}