{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Coding Style","type":"basic","slug":"misc-coding-style","excerpt":"","body":"# Coding Style\n\nHey Yow! here you can follow our coding style before you commit.\n\nWe follow PSR-2 and PSR-4 coding standards. Although, we're using ``$snake_case`` for variables and native functions\n\n### Variable Style\n```php\n<?php\nnamespace Popeye;\n\nuse Clarity\\Support\\Parser;\n\nclass Result\n{\n      private $results_page;\n\n      public function getResultsPage()\n      {\n           return $this->results_page;\n      }\n}\n\n```\n\n### Native Style Functions\n```php\nif (!function_exists('base_path'))\n{\n    function base_path($extended_path)\n    {\n        // code...\n    }\n}\n\n```\n\nThe rest follow the PSR standards, make your code self explanatory, without using any docblock, we should be able to understand it as is.\n\n---\n\n\n# Comment Blocks\n\nWe are using ``#`` for adding user comments, and ``//`` for unused code comment.\nWe should only use ``/** doc block **/`` for class/class-functions/native-functions.","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"56e2713ae2ee8a0e00f3ef99","version":{"version":"1.3.0","version_clean":"1.3.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["56c1110a5abfe40d00be875e","56c413a254b6030d00ec299d","56c4275048213b1700af6e33","56c42826c0c4630d004e86cb","56c4282cbc41330d009f2607","56c4284ad1f6d91700d3697e","56e271c195d1c60e00a969ee"],"_id":"56c111095abfe40d00be875d","releaseDate":"2016-02-14T23:43:05.566Z","__v":7,"createdAt":"2016-02-14T23:43:05.566Z","project":"56c111095abfe40d00be875a"},"category":{"sync":{"isSync":false,"url":""},"pages":["56e27116e2ee8a0e00f3ef95","56e27128e2ee8a0e00f3ef97","56e271308d79b50e0031d90b","56e2713ae2ee8a0e00f3ef99"],"title":"Miscellaneous","slug":"miscellaneous","order":5,"from_sync":false,"reference":false,"_id":"56c4284ad1f6d91700d3697e","__v":4,"project":"56c111095abfe40d00be875a","createdAt":"2016-02-17T07:59:06.843Z","version":"56c111095abfe40d00be875d"},"parentDoc":null,"project":"56c111095abfe40d00be875a","user":"56c1105874f0b417004baadc","createdAt":"2016-03-11T07:18:18.099Z","githubsync":"","__v":9}
# Coding Style Hey Yow! here you can follow our coding style before you commit. We follow PSR-2 and PSR-4 coding standards. Although, we're using ``$snake_case`` for variables and native functions ### Variable Style ```php <?php namespace Popeye; use Clarity\Support\Parser; class Result { private $results_page; public function getResultsPage() { return $this->results_page; } } ``` ### Native Style Functions ```php if (!function_exists('base_path')) { function base_path($extended_path) { // code... } } ``` The rest follow the PSR standards, make your code self explanatory, without using any docblock, we should be able to understand it as is. --- # Comment Blocks We are using ``#`` for adding user comments, and ``//`` for unused code comment. We should only use ``/** doc block **/`` for class/class-functions/native-functions.