{"issue":{"milestone":null,"user":{"id":212248,"login":"avdg","url":"https://api.github.com/users/avdg","avatar_url":"https://secure.gravatar.com/avatar/7601c31131f55d3ebd177a2653c84f2a?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"7601c31131f55d3ebd177a2653c84f2a"},"created_at":"2011-12-16T20:36:45Z","title":"Proposal PPI\\Array\\Rename (draft name)","updated_at":"2011-12-16T20:36:45Z","labels":[],"state":"open","id":2584103,"html_url":"https://github.com/ppi/framework/issues/10","closed_at":null,"pull_request":{"patch_url":null,"html_url":null,"diff_url":null},"body":"The PPI\\Request\\* are array objects which contains their data.\r\nUsing these objects should be pretty simple.\r\n\r\n<?php\r\n$session = new PPI\\Request\\Session;\r\n\r\nif ($session['foo'] === null) {\r\n\t$session['foo'] = 'bar';\r\n}\r\n\r\necho $session['foo'];\r\n?>\r\n\r\nThis works fine, as long you only have to deal with 1 application.\r\nIf you have to deal with multiple applications, you do not want to have conflicts.\r\nTo avoid such an issue, you could use namespaces, just as php has them.\r\n\r\nA way to solve this issue, is to add a layer on top of it which acts as a translator.\r\nNote: the idea is to make the translator a separate generic object which works on every normal array\r\n\r\n```\r\n\t+----------------------------------------------------------------------+\r\n\t| +--------+                            +------------+                 |\r\n\t| | object | <------------------------- | translator | <- $obj['foo']; |\r\n\t| +--------+                            +------------+                 |\r\n\t|             $obj['namespace']['foo']                                 |\r\n\t|                                                                      |\r\n\t|  ^- Actual object     Translation object-^    Actual array call-^    |\r\n\t+----------------------------------------------------------------------+\r\n```\r\n\r\nThe idea of the interface would be like this:\r\n\r\n```php\r\n<?php\r\n\r\nnamespace PPI\\Array\\Translator;\r\n\r\nclass abstract extends /*array stuff over here*/ {\r\n\t/*array stuff*/\r\n\r\n\t/**\r\n\t * Translates names\r\n\t */\r\n\tabstract translator($string)\r\n}\r\n```\r\n\r\nTODO:\r\n - subarray notation: would probably be a \"/\"\r\n - investigate possible array behavior issues\r\n - rewording?\r\n - Opinions\r\n","number":10,"url":"https://api.github.com/repos/ppi/framework/issues/10","comments":0,"assignee":null},"action":"opened"}