KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm struggling to write readable and easy to understand documentation that describes the multi-tree structure for Array options that are passed to a function. Here is an example array structure. $arr = [ 'fields' => [ 'title' => [ 'name' => 'Document.title', 'format' => 'string', 'readonly' => true ] ] ]; There are many possible options for the above array, but this is used as a parameter to a function that understands that structure. function doSomething(array $arr) { ... } I'd like to document how the array should be structured in PHPDoc, but I'm not sure what the correct approach is. Here is what I have now. /** * Holds configuration settings for each field in a model. * Defining the field options * * array['fields'] array Defines the feilds to be shown by scaffolding. * array['fields'][fieldName] array Defines the options for a field, or just enables the field if array is not applied. * array['fields'][fieldName]['name'] string Overrides the field name (default is the array key) * array['fields'][fieldName]['model'] string (optional) Overrides the model if the field is a belongsTo assoicated value. * array['fields'][fieldName]['width'] string Defines the width of the field for paginate views. Examples are "100px" or "auto" * array['fields'][fieldName]['align'] string Alignment types for paginate views (left, right, center) * array['fields'][fieldName]['format'] string Formatting options for paginate fields. Options include ('currency','nice','niceShort','timeAgoInWords' or a valid Date() format) * array['fields'][fieldName]['title'] string Changes the field name shown in views. * array['fields'][fieldName]['desc'] string The description shown in edit/create views. * array['fields'][fieldName]['readonly'] boolean True prevents users from changing the value in edit/create forms
Tags (comma-separated)
Save Edits
Cancel