allow usage of a closure for the `code` option of fields
optimization to call `$this->getOption('code')` only once
Added doc & unit tests
Merge pull request #1962 from Bladrak/craueCode

Added documentation & unit tests to PR #174