This workshop is an introduction to the principles outlined by Robert C. Martin; on how to write clean code. We'll refactor code form popular open-source projects, and learn core concepts along the way.
function addItem($item); public function removeItem($item); } interface BasketPaymentProcessor { public function calculateTotal(BasketCollection $collection); public function processPayment($account, $amount); }
null) { // ...gets a value with key, or returns default } public function retrieve($key, $default = null) { // ...gets a value with key, or returns default } public function read($key, $default = null) { // ...gets a value with key, or returns default }
PSL License. * * This source file is subject to the ACME PSL License that is * bundled with this package in the license.txt file. * * @package Acme\Explosions * @author ACME LLC * @license ACME PSL * @copyright (c) 2011-2014, ACME LLC * @link http://acme.com */
function testFullRequestCycle() { // Don't run this if you're short on time! } public function seedDatabase() { // This will overwrite production data... }
TODO check for errors in product data return [ "title" => $this->getFormattedTitle($product->title), "price" => $this->getFormattedPrice($product->price) ]; }