Created
November 12, 2016 17:15
-
-
Save wizonesolutions/39553d7d434324efc3f329d8ee915904 to your computer and use it in GitHub Desktop.
DrupalCamp Oslo 2016
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2016 Eirik Morland http://i.giphy.com/3o7TKHyJHIFAXODsmQ.gif | |
<?php | |
function print_hello_world() { | |
print "Hello world!"; | |
} | |
print_hello_world(); // Prints "Hello world!" | |
<?php | |
namespace Long\String\With\Backslashes; | |
class HelloWorldPrinterFactory implements HelloWorldPrinterFactoryInterface { | |
public function getHelloWorldPrinter() { | |
return new HelloWorldPrinter(); | |
} | |
} | |
class HelloWorldPrinter implements PrinterInterface { | |
protected $hello = 'Hello'; | |
protected $world = 'world!'; | |
public function printHelloWorld(Another\String\With\Backslashes\PrintThings $thingPrinter) { | |
return $thingPrinter->printThing($this->getHello() . ' ' . $this->getWorld()); | |
} | |
private function getHello() { | |
return $this->hello; | |
} | |
private function getWorld() { | |
return $this->world; | |
} | |
} | |
new HelloWorldPrinterFactory() | |
->getHelloWorldPrinter() | |
->printHelloWorld(new Another\String\With\Backslashes\PrintThings()); // Prints "Hello world!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copyright?!?!
Trust me, this is licenced with WTFPL