These learning resources primarily focus on programming using Good Design Principles and Design Patterns
- There is an emphasis on learning using PHP, although most patterns are universal to every object orientated language.
| <template> | |
| <inertia-head> | |
| <title v-if="title">{{ title }} - My App</title> | |
| <title v-else>My App</title> | |
| <slot /> | |
| </inertia-head> | |
| </template> | |
| <script> | |
| export default { |
| <?php | |
| use PhpCsFixer\Config; | |
| use PhpCsFixer\Finder; | |
| $rules = [ | |
| 'array_indentation' => true, | |
| 'array_syntax' => ['syntax' => 'short'], | |
| 'binary_operator_spaces' => [ | |
| 'default' => 'single_space', |
| <?php | |
| function memoize($target) { | |
| static $memo = new WeakMap; | |
| return new class ($target, $memo) { | |
| function __construct( | |
| protected $target, | |
| protected &$memo, | |
| ) {} |
| <?php | |
| /** | |
| * Refactor #1: | |
| */ | |
| // Before | |
| if ($user->type === 'admin' || $user->type === 'mod' || $user->type === 'author') { | |
| // Do something. | |
| } |
| <?php | |
| // Reading | |
| CsvReader::read($path)->each(function(array $row) { | |
| // Do something with $row | |
| }); | |
| // Writing | |
| return CsvWriter::for($data)->writeToHttpFile(); |