{"id":18320278,"url":"https://github.com/gedex/container","last_synced_at":"2025-06-10T17:05:38.504Z","repository":{"id":35839632,"uuid":"40123035","full_name":"gedex/container","owner":"gedex","description":"PHP library for various data structure and its operations.","archived":false,"fork":false,"pushed_at":"2015-08-03T12:53:55.000Z","size":120,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-15T08:25:15.575Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gedex.png","metadata":{"files":{"readme":"README.md","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-08-03T12:17:00.000Z","updated_at":"2015-08-03T12:17:18.000Z","dependencies_parsed_at":"2022-09-17T12:41:09.140Z","dependency_job_id":null,"html_url":"https://github.com/gedex/container","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/gedex%2Fcontainer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gedex%2Fcontainer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gedex%2Fcontainer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gedex%2Fcontainer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gedex","download_url":"https://codeload.github.com/gedex/container/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054382,"owners_count":21039994,"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-11-05T18:15:47.691Z","updated_at":"2025-04-09T14:24:23.439Z","avatar_url":"https://github.com/gedex.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Container\n=========\n\n[![Build Status](https://travis-ci.org/gedex/container.png?branch=master)](https://travis-ci.org/gedex/container)\n[![Coverage Status](https://coveralls.io/repos/gedex/container/badge.svg?branch=master\u0026service=github)](https://coveralls.io/github/gedex/container?branch=master)\n\nLibrary for various data structure and its operations.\n\n## Examples\n\n### Doubly Linked List\n\n~~~php\nuse Gedex\\Container;\n\n$ll = new Container\\DoublyLinkedList();\n$e1 = $ll-\u003epushFront(1);\n$e2 = $ll-\u003epushFront(2);\n$e3 = $ll-\u003epushBack('e3');\n\n$e4 = $ll-\u003einsertBefore('el before e3', $e3);\n$e5 = $ll-\u003einsertAfter('el after e3', $e3);\nprintList($ll); // --\u003e (2) --\u003e (1) --\u003e (el before e3) --\u003e (e3) --\u003e (el after e4)\n\nprintf(\"Remove element (%s)\\n\", $e3-\u003egetValue());\n$ll-\u003eremove($e3);\n\nprintList($ll); // --\u003e (2) --\u003e (1) --\u003e (el before e3) --\u003e (el after e4)\n\nfunction printList($ll) {\n    $el = $ll-\u003egetFront();\n    while (!is_null($el)) {\n        printf('--\u003e (%s) ', $el-\u003egetValue());\n        $el = $el-\u003egetNext();\n    }\n    printf(\"\\n\");\n}\n~~~\n\n### Circular List\n\n~~~php\nuse Gedex\\Container;\n\n$cl = new Container\\CircularList(5);\nfor ($i = 1; $i \u003c= $cl-\u003elen(); $i++) {\n    $el = $cl-\u003ecursor()-\u003esetValue($i);\n    $cl-\u003enext();\n}\n\n$sum = 0;\n$cl-\u003ewalk(function($value) use(\u0026$sum) {\n    printf('--\u003e (%s) ', $value);\n    $sum += $value;\n});\nprintf(\"\\n\");\nprintf(\"%d\\n\", $sum); // 15\n~~~\n\n## License\n\nMIT License - See [LICENSE file](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgedex%2Fcontainer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgedex%2Fcontainer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgedex%2Fcontainer/lists"}